Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{Storage-Preview} Bump api version to 2023-05-01 from 2022-09-01 #7777

Merged
merged 5 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/storage-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Release History
===============

1.0.0b1(2023-08-11)
++++++++++++++++++
* `az storage account migration start/show`: Support start and show storage account migration
Expand Down
7 changes: 4 additions & 3 deletions src/storage-preview/azext_storage_preview/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, cli_ctx=None):

register_resource_type('latest', CUSTOM_DATA_STORAGE, '2018-03-28')
register_resource_type('latest', CUSTOM_DATA_STORAGE_ADLS, '2019-02-02-preview')
register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2022-09-01')
register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2023-05-01')
register_resource_type('latest', CUSTOM_DATA_STORAGE_FILESHARE, '2022-11-02')
register_resource_type('latest', CUSTOM_DATA_STORAGE_BLOB, '2022-11-02')
register_resource_type('latest', CUSTOM_DATA_STORAGE_FILEDATALAKE, '2020-06-12')
Expand Down Expand Up @@ -98,8 +98,9 @@ def register_content_settings_argument(self, settings_class, update, arg_group=N
self.extra('clear_content_settings',
help='If this flag is set, then if any one or more of the '
'following properties (--content-cache-control, --content-disposition, --content-encoding, '
'--content-language, --content-md5, --content-type) is set, then all of these properties are '
'set together. If a value is not provided for a given property when at least one of the '
'--content-language, --content-md5, --content-type) is set, '
'then all of these properties are set together. '
'If a value is not provided for a given property when at least one of the '
'properties listed below is set, then that property will be cleared.',
arg_type=get_three_state_flag())

Expand Down
3 changes: 0 additions & 3 deletions src/storage-preview/azext_storage_preview/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.profiles import get_sdk
from .profiles import CUSTOM_DATA_STORAGE


def build_table_output(result, projection):

Expand Down
5 changes: 2 additions & 3 deletions src/storage-preview/azext_storage_preview/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=protected-access, logging-format-interpolation
# pylint: disable=protected-access, logging-format-interpolation, too-many-branches
import os
import argparse

Expand Down Expand Up @@ -888,8 +888,7 @@ def process_file_batch_source_parameters(cmd, namespace):


def validate_source_uri(cmd, namespace): # pylint: disable=too-many-statements
from .util import create_short_lived_blob_sas, create_short_lived_blob_sas_v2, \
create_short_lived_file_sas, create_short_lived_file_sas_v2
from .util import create_short_lived_blob_sas_v2, create_short_lived_file_sas_v2
usage_string = \
'Invalid usage: {}. Supply only one of the following argument sets to specify source:' \
'\n\t --source-uri [--source-sas]' \
Expand Down
10 changes: 5 additions & 5 deletions src/storage-preview/azext_storage_preview/azcopy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
AZCOPY_VERSION = '10.5.0'


class AzCopy(object):
class AzCopy:
system_executable_path = {
'Darwin': ['azcopy_darwin_amd64_{}'.format(AZCOPY_VERSION), 'azcopy'],
'Linux': ['azcopy_linux_amd64_{}'.format(AZCOPY_VERSION), 'azcopy'],
Expand Down Expand Up @@ -55,7 +55,7 @@ def sync(self, source, destination, flags=None):
self.run_command(['sync', source, destination] + flags)


class AzCopyCredentials(object): # pylint: disable=too-few-public-methods
class AzCopyCredentials: # pylint: disable=too-few-public-methods
def __init__(self, sas_token=None, token_info=None):
self.sas_token = sas_token
self.token_info = token_info
Expand All @@ -66,7 +66,7 @@ def login_auth_for_azcopy(cmd):
try:
token_info = _unserialize_non_msi_token_payload(token_info)
except KeyError: # unserialized MSI token payload
raise Exception('MSI auth not yet supported.')
raise RuntimeError('MSI auth not yet supported.')
return AzCopyCredentials(token_info=token_info)


Expand All @@ -80,13 +80,13 @@ def blob_client_auth_for_azcopy(cmd, blob_client):
try:
token_info = _unserialize_non_msi_token_payload(token_info)
except KeyError: # unserialized MSI token payload
raise Exception('MSI auth not yet supported.')
raise RuntimeError('MSI auth not yet supported.')
return AzCopyCredentials(token_info=token_info)


def storage_client_auth_for_azcopy(cmd, client, service):
if service not in SERVICES:
raise Exception('{} not one of: {}'.format(service, str(SERVICES)))
raise KeyError('{} not one of: {}'.format(service, str(SERVICES)))

if client.sas_token:
return AzCopyCredentials(sas_token=client.sas_token)
Expand Down
2 changes: 1 addition & 1 deletion src/storage-preview/azext_storage_preview/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from azure.cli.core.commands import CliCommandType
from azure.cli.core.commands.arm import show_exception_handler
from ._client_factory import (cf_sa, blob_data_service_factory, adls_blob_data_service_factory,
cf_share_client, cf_share_service, cf_share_file_client, cf_share_directory_client)
cf_share_client, cf_share_file_client, cf_share_directory_client)
from .profiles import (CUSTOM_DATA_STORAGE, CUSTOM_DATA_STORAGE_ADLS, CUSTOM_MGMT_STORAGE,
CUSTOM_DATA_STORAGE_FILESHARE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import threading


class TokenUpdater(object):
class TokenUpdater:
"""
This class updates a given token_credential periodically using the provided callback function.
It shows one way of making sure the credential does not become expired.
Expand Down Expand Up @@ -34,7 +34,7 @@ def timer_callback(self):
seconds_left = (datetime.fromtimestamp(int(token['expires_on'])) - datetime.now()).seconds
if seconds_left < 240:
# acquired token expires in less than 4 mins
raise Exception("Acquired a token expiring in less than 4 minutes")
raise RuntimeError("Acquired a token expiring in less than 4 minutes")

with self.lock:
self.timer = threading.Timer(seconds_left - 240, self.timer_callback)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ def update_storage_account(cmd, instance, sku=None, tags=None, custom_domain=Non
if enable_files_adds is not None:
ActiveDirectoryProperties = cmd.get_models('ActiveDirectoryProperties')
if enable_files_adds: # enable AD
if not(domain_name and net_bios_domain_name and forest_name and domain_guid and domain_sid and
azure_storage_sid):
if not (domain_name and net_bios_domain_name and forest_name and domain_guid and domain_sid and
azure_storage_sid):
raise CLIError("To enable ActiveDirectoryDomainServicesForFile, user must specify all of: "
"--domain-name, --net-bios-domain-name, --forest-name, --domain-guid, --domain-sid and "
"--azure_storage_sid arguments in Azure Active Directory Properties Argument group.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .profiles import CUSTOM_DATA_STORAGE


class ServiceProperties(object):
class ServiceProperties:
def __init__(self, cli_ctx, name, service, account_name=None, account_key=None, connection_string=None,
sas_token=None):
self.cli_ctx = cli_ctx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


# pylint: disable=too-few-public-methods, too-many-instance-attributes
class StorageResourceIdentifier(object):
class StorageResourceIdentifier:
def __init__(self, cloud, moniker):
self.is_valid = False
self.account_name = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
from azure.cli.core.profiles import register_resource_type
from ...profiles import CUSTOM_MGMT_STORAGE, CUSTOM_DATA_STORAGE_FILEDATALAKE

register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2022-09-01')
register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2023-05-01')
register_resource_type('latest', CUSTOM_DATA_STORAGE_FILEDATALAKE, '2020-06-12')
Loading
Loading