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-blob-preview] az storage account blob-service-properties: deleted since has been moved to main repo #3796

Merged
merged 5 commits into from
Aug 20, 2021
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
4 changes: 4 additions & 0 deletions src/storage-blob-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Release History
===============
0.6.0
++++++
* Remove `az storage account blob-service-properties` since all the preview arguments are supported in main azure cli

0.5.2
++++++
* Apply v2020-06-12 api version for blob operations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from azure.cli.core import AzCommandsLoader
from azure.cli.core.profiles import register_resource_type
from azure.cli.core.commands import AzCommandGroup, AzArgumentContext
from .profiles import CUSTOM_DATA_STORAGE_BLOB, CUSTOM_MGMT_STORAGE
from .profiles import CUSTOM_DATA_STORAGE_BLOB

from ._help import helps # pylint: disable=unused-import

Expand All @@ -15,7 +15,6 @@ class StorageCommandsLoader(AzCommandsLoader):
def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
register_resource_type('latest', CUSTOM_DATA_STORAGE_BLOB, '2020-06-12')
register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2021-01-01')
storage_custom = CliCommandType(operations_tmpl='azure.cli.command_modules.storage.custom#{}')
super(StorageCommandsLoader, self).__init__(cli_ctx=cli_ctx,
resource_type=CUSTOM_DATA_STORAGE_BLOB,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from azure.cli.core.commands.client_factory import get_mgmt_service_client, prepare_client_kwargs_track2
from azure.cli.core.profiles import ResourceType, get_sdk
from .profiles import CUSTOM_DATA_STORAGE_BLOB, CUSTOM_MGMT_STORAGE
from .profiles import CUSTOM_DATA_STORAGE_BLOB

MISSING_CREDENTIALS_ERROR_MESSAGE = """
Missing credentials to access storage service. The following variations are accepted:
Expand All @@ -21,22 +21,6 @@
"""


def storage_client_factory(cli_ctx, **_):
return get_mgmt_service_client(cli_ctx, CUSTOM_MGMT_STORAGE)


def cf_mgmt_blob_services(cli_ctx, _):
return storage_client_factory(cli_ctx).blob_services


def cf_mgmt_policy(cli_ctx, _):
return storage_client_factory(cli_ctx).management_policies


def cf_sa(cli_ctx, _):
return storage_client_factory(cli_ctx).storage_accounts


def get_account_url(cli_ctx, account_name, service):
from knack.util import CLIError
if account_name is None:
Expand Down
67 changes: 2 additions & 65 deletions src/storage-blob-preview/azext_storage_blob_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,23 @@

from azure.cli.core.commands.validators import validate_tags
from azure.cli.core.commands.parameters import (file_type, get_enum_type, get_three_state_flag)
from azure.cli.core.local_context import LocalContextAttribute, LocalContextAction

from ._validators import (validate_metadata, get_permission_validator, get_permission_help_string,
validate_blob_type, validate_included_datasets_v2,
add_download_progress_callback, add_upload_progress_callback,
validate_storage_data_plane_list, as_user_validator, blob_tier_validator,
validate_container_delete_retention_days, validate_delete_retention_days,
process_resource_group)
validate_storage_data_plane_list, as_user_validator, blob_tier_validator)

from .profiles import CUSTOM_DATA_STORAGE_BLOB, CUSTOM_MGMT_STORAGE
from .profiles import CUSTOM_DATA_STORAGE_BLOB


def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statements, too-many-lines
from argcomplete.completers import FilesCompleter

from knack.arguments import ignore_type, CLIArgumentType

from azure.cli.core.commands.parameters import get_resource_name_completion_list

from .sdkutil import get_table_data_type
from .completers import get_storage_name_completion_list

acct_name_type = CLIArgumentType(options_list=['--account-name', '-n'], help='The storage account name.',
id_part='name',
completer=get_resource_name_completion_list('Microsoft.Storage/storageAccounts'),
local_context_attribute=LocalContextAttribute(
name='storage_account_name', actions=[LocalContextAction.GET]))

t_base_blob_service = self.get_sdk('blob.baseblobservice#BaseBlobService')
t_file_service = self.get_sdk('file#FileService')
t_table_service = get_table_data_type(self.cli_ctx, 'table', 'TableService')
Expand Down Expand Up @@ -146,58 +135,6 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
validator=validate_metadata)
c.argument('timeout', help='Request timeout in seconds. Applies to each call to the service.', type=int)

with self.argument_context('storage account blob-service-properties show',
resource_type=CUSTOM_MGMT_STORAGE) as c:
c.argument('account_name', acct_name_type, id_part=None)
c.argument('resource_group_name', required=False, validator=process_resource_group)

with self.argument_context('storage account blob-service-properties update',
resource_type=CUSTOM_MGMT_STORAGE) as c:
from azure.cli.command_modules.storage._validators import get_api_version_type, \
validator_change_feed_retention_days
c.argument('account_name', acct_name_type, id_part=None)
c.argument('resource_group_name', required=False, validator=process_resource_group)
c.argument('enable_change_feed', arg_type=get_three_state_flag(), min_api='2019-04-01',
arg_group='Change Feed Policy')
c.argument('change_feed_retention_days', is_preview=True,
options_list=['--change-feed-retention-days', '--change-feed-days'],
type=int, min_api='2019-06-01', arg_group='Change Feed Policy',
validator=validator_change_feed_retention_days,
help='Indicate the duration of changeFeed retention in days. '
'Minimum value is 1 day and maximum value is 146000 days (400 years). '
'A null value indicates an infinite retention of the change feed.'
'(Use `--enable-change-feed` without `--change-feed-days` to indicate null)')
c.argument('enable_container_delete_retention',
arg_type=get_three_state_flag(),
options_list=['--enable-container-delete-retention', '--container-retention'],
arg_group='Container Delete Retention Policy', min_api='2019-06-01',
help='Enable container delete retention policy for container soft delete when set to true. '
'Disable container delete retention policy when set to false.')
c.argument('container_delete_retention_days',
options_list=['--container-delete-retention-days', '--container-days'],
type=int, arg_group='Container Delete Retention Policy',
min_api='2019-06-01', validator=validate_container_delete_retention_days,
help='Indicate the number of days that the deleted container should be retained. The minimum '
'specified value can be 1 and the maximum value can be 365.')
c.argument('enable_delete_retention', arg_type=get_three_state_flag(), arg_group='Delete Retention Policy',
min_api='2018-07-01')
c.argument('delete_retention_days', type=int, arg_group='Delete Retention Policy',
validator=validate_delete_retention_days, min_api='2018-07-01')
c.argument('enable_restore_policy', arg_type=get_three_state_flag(), arg_group='Restore Policy',
min_api='2019-06-01', help="Enable blob restore policy when it set to true.")
c.argument('restore_days', type=int, arg_group='Restore Policy',
min_api='2019-06-01', help="The number of days for the blob can be restored. It should be greater "
"than zero and less than Delete Retention Days.")
c.argument('enable_versioning', arg_type=get_three_state_flag(), help='Versioning is enabled if set to true.',
min_api='2019-06-01')
c.argument('enable_last_access_tracking', arg_type=get_three_state_flag(), min_api='2019-06-01',
options_list=['--enable-last-access-tracking', '-t'],
help='When set to true last access time based tracking policy is enabled.')
c.argument('default_service_version', options_list=['--default-service-version', '-d'],
type=get_api_version_type(), min_api='2018-07-01',
help="Indicate the default version to use for requests to the Blob service if an incoming request's "
"version is not specified.")

with self.argument_context('storage blob') as c:
c.argument('blob_name', options_list=('--name', '-n'), arg_type=blob_name_type)
c.argument('destination_path', help='The destination path that will be appended to the blob name.')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"azext.isPreview": true,
"azext.minCliCoreVersion": "2.25.0"
"azext.minCliCoreVersion": "2.27.0"
}
25 changes: 2 additions & 23 deletions src/storage-blob-preview/azext_storage_blob_preview/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
from azure.cli.core.commands.arm import show_exception_handler
from azure.cli.core.profiles import ResourceType

from ._client_factory import cf_blob_client, cf_container_client, cf_blob_service, cf_blob_lease_client, \
cf_mgmt_blob_services, cf_sa
from .profiles import CUSTOM_DATA_STORAGE_BLOB, CUSTOM_MGMT_STORAGE
from ._client_factory import cf_blob_client, cf_container_client, cf_blob_service, cf_blob_lease_client
from .profiles import CUSTOM_DATA_STORAGE_BLOB


def load_command_table(self, _): # pylint: disable=too-many-locals, too-many-statements
Expand All @@ -25,26 +24,6 @@ def get_custom_sdk(custom_module, client_factory, resource_type=ResourceType.DAT
resource_type=resource_type
)

blob_service_mgmt_sdk = CliCommandType(
operations_tmpl='azext_storage_blob_preview.vendored_sdks.azure_mgmt_storage.operations#'
'BlobServicesOperations.{}',
client_factory=cf_mgmt_blob_services,
resource_type=CUSTOM_MGMT_STORAGE
)

storage_account_custom_type = CliCommandType(
operations_tmpl='azext_storage_blob_preview.operations.account#{}',
client_factory=cf_sa)

with self.command_group('storage account blob-service-properties', blob_service_mgmt_sdk,
custom_command_type=storage_account_custom_type,
resource_type=CUSTOM_MGMT_STORAGE, min_api='2018-07-01', is_preview=True) as g:
g.show_command('show', 'get_service_properties')
g.generic_update_command('update',
getter_name='get_service_properties',
setter_name='set_service_properties',
custom_func_name='update_blob_service_properties')

blob_client_sdk = CliCommandType(
operations_tmpl='azext_storage_blob_preview.vendored_sdks.azure_storage_blob._blob_client#BlobClient.{}',
client_factory=cf_blob_client,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@

CUSTOM_DATA_STORAGE_BLOB = CustomResourceType('azext_storage_blob_preview.vendored_sdks.azure_storage_blob',
'BlobClient')
CUSTOM_MGMT_STORAGE = CustomResourceType('azext_storage_blob_preview.vendored_sdks.azure_mgmt_storage',
'StorageManagementClient')
Loading