-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[Breadth Coverage] Onboard Import Export #1515
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d7fa25a
[Breadth Coverage] Onboard Import Export
arrownj 78e36be
update CODEOWNERS
arrownj c2fe423
remove unused code
arrownj 2b5f894
fix review problem
arrownj c1435ff
update setup.py & setup.cfg
arrownj 3ff07a3
remove unused code
arrownj e1feead
Merge remote-tracking branch 'upstream/master' into import_export
arrownj bffaa84
fix tags issues
arrownj 17948fc
fix review issues
arrownj c552dcc
Merge branch 'master' into import_export
arrownj 0a27a31
update storage-account-id to storage-account
arrownj 607daf9
add support for location list/show
arrownj abd7e7a
update README.md
arrownj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,4 +98,6 @@ | |
|
|
||
| /src/hpc-cache/ @qianwens | ||
|
|
||
| /src/import-export/ @arrownj | ||
|
|
||
| /src/account/ @zikalino | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| .. :changelog: | ||
|
|
||
| Release History | ||
| =============== | ||
|
|
||
| 0.1.0 | ||
| ++++++ | ||
| * Initial release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| # Azure CLI import-export Extension # | ||
| This package is for the 'import-export' extension, i.e. 'az import-export'. | ||
|
|
||
| ### How to use ### | ||
| Install this extension using the below CLI command | ||
| ``` | ||
| az extension add --name import-export | ||
| ``` | ||
|
|
||
| ### Included Features | ||
| #### Import Export Management: | ||
| Manage Import Export: [more info](https://docs.microsoft.com/en-us/azure/storage/common/storage-import-export-service)\ | ||
| *Examples:* | ||
|
|
||
| ##### Create an Import Job | ||
|
|
||
| ``` | ||
| az import-export create \ | ||
| --resource-group groupName \ | ||
| --name jobName \ | ||
| --location localtionName \ | ||
| --type Import \ | ||
| --log-level Verbose \ | ||
| --storage-account storageAccountID \ | ||
| --backup-drive-manifest true \ | ||
| --diagnostics-path waimportexport \ | ||
| --drive-list \ | ||
| drive-id=00000001 \ | ||
| bit-locker-key=000000-000000-000000-000000-000000-000000-000000-000000 \ | ||
| drive-header-hash="" \ | ||
| manifest-file=\\DriveManifest.xml \ | ||
| manifest-hash=109B21108597EF36D5785F08303F3638 \ | ||
| --return-address \ | ||
| city=Redmond \ | ||
| country-or-region=USA \ | ||
| [email protected] \ | ||
| phone=4250000000 \ | ||
| postal-code=98007 \ | ||
| recipient-name=Tests \ | ||
| state-or-province=wa \ | ||
| street-address1=Street1 \ | ||
| street-address2=street2 | ||
| ``` | ||
|
|
||
| ##### Update an Import Job | ||
|
|
||
| ``` | ||
| az import-export update \ | ||
| --resource-group groupName \ | ||
| --name jobName \ | ||
| --cancel-requested true | ||
| ``` | ||
|
|
||
| ##### List Import Export Jobs | ||
|
|
||
| ``` | ||
| az import-export list \ | ||
| --resource-group groupName | ||
| ``` | ||
|
|
||
| ##### Delete a Job | ||
|
|
||
| ``` | ||
| az import-export delete \ | ||
| --resource-group groupName \ | ||
| --name jobName | ||
| ``` | ||
|
|
||
| ##### List bit locker keys of a Job | ||
|
|
||
| ``` | ||
| az import-export bit-locker-key list \ | ||
| --resource-group groupName \ | ||
| --job-name jobName | ||
| ``` | ||
|
|
||
|
|
||
| If you have issues, please give feedback by opening an issue at https://github.com/Azure/azure-cli-extensions/issues. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| from azure.cli.core import AzCommandsLoader | ||
| from .generated._help import helps # pylint: disable=unused-import | ||
|
|
||
|
|
||
| class ImportExportCommandsLoader(AzCommandsLoader): | ||
|
|
||
| def __init__(self, cli_ctx=None): | ||
| from azure.cli.core.commands import CliCommandType | ||
| from .generated._client_factory import cf_import_export | ||
| import_export_custom = CliCommandType( | ||
| operations_tmpl='azext_import_export.custom#{}', | ||
| client_factory=cf_import_export) | ||
| super(ImportExportCommandsLoader, self).__init__(cli_ctx=cli_ctx, custom_command_type=import_export_custom) | ||
|
|
||
| def load_command_table(self, args): | ||
| from .generated.commands import load_command_table | ||
| load_command_table(self, args) | ||
| return self.command_table | ||
|
|
||
| def load_arguments(self, command): | ||
| from .generated._params import load_arguments | ||
| load_arguments(self, command) | ||
|
|
||
|
|
||
| COMMAND_LOADER_CLS = ImportExportCommandsLoader |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| # pylint: disable=wildcard-import | ||
| # pylint: disable=unused-wildcard-import | ||
|
|
||
| from .generated.action import * # noqa: F403 | ||
| try: | ||
| from .manual.action import * # noqa: F403 | ||
| except ImportError: | ||
| pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "azext.isExperimental": true, | ||
| "azext.minCliCoreVersion": "2.3.1" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| # pylint: disable=wildcard-import | ||
| # pylint: disable=unused-wildcard-import | ||
|
|
||
| from .generated.commands import * # noqa: F403 | ||
| try: | ||
| from .manual.commands import * # noqa: F403 | ||
| except ImportError: | ||
| pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| # pylint: disable=wildcard-import | ||
| # pylint: disable=unused-wildcard-import | ||
|
|
||
| from .generated.custom import * # noqa: F403 | ||
| try: | ||
| from .manual.custom import * # noqa: F403 | ||
| except ImportError: | ||
| pass |
18 changes: 18 additions & 0 deletions
18
src/import-export/azext_import_export/generated/_client_factory.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
|
|
||
| def cf_import_export(cli_ctx, *_): | ||
| from azure.cli.core.commands.client_factory import get_mgmt_service_client | ||
| from ..vendored_sdks.storageimportexport import StorageImportExport | ||
| return get_mgmt_service_client(cli_ctx, StorageImportExport) | ||
|
|
||
|
|
||
| def cf_job(cli_ctx, *_): | ||
| return cf_import_export(cli_ctx).job | ||
|
|
||
|
|
||
| def cf_bit_locker_key(cli_ctx, *_): | ||
| return cf_import_export(cli_ctx).bit_locker_key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| # pylint: disable=line-too-long | ||
| # pylint: disable=too-many-lines | ||
|
|
||
| from knack.help_files import helps | ||
|
|
||
|
|
||
| helps['import-export'] = """ | ||
| type: group | ||
| short-summary: Manage Import Export | ||
| """ | ||
|
|
||
| helps['import-export list'] = """ | ||
| type: command | ||
| short-summary: Returns all active and completed jobs in a subscription. | ||
| examples: | ||
| - name: List jobs in a resource group | ||
| text: |- | ||
| az import-export list --resource-group "myResourceGroup" | ||
| - name: List jobs in current subscription | ||
| text: |- | ||
| az import-export list | ||
| """ | ||
|
|
||
| helps['import-export show'] = """ | ||
| type: command | ||
| short-summary: Gets information about an existing job. | ||
| examples: | ||
| - name: Get job | ||
| text: |- | ||
| az import-export show --resource-group "myResourceGroup" --name "myJob" | ||
| """ | ||
|
|
||
| helps['import-export create'] = """ | ||
| type: command | ||
| short-summary: Creates a new job or updates an existing job in the specified subscription. | ||
| examples: | ||
| - name: Create an import job | ||
| text: |- | ||
| az import-export create --resource-group "myResourceGroup" --name "myJob" | ||
| --location "West US" --backup-drive-manifest true --diagnostics-path "waimportexport" | ||
| --drive-list bit-locker-key=238810-662376-448998-450120-652806-203390-606320-483076 | ||
| drive-header-hash= drive-id=9CA995BB manifest-file=\\\\DriveManifest.xml | ||
| manifest-hash=109B21108597EF36D5785F08303F3638 --type "Import" --log-level "Verbose" | ||
| --return-address city=Redmond country-or-region=USA [email protected] phone=4250000000 | ||
| postal-code=98007 recipient-name=Tests state-or-province=wa street-address1=Street1 | ||
| street-address2=street2 --storage-account "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-\\ | ||
| xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicStorage/storageAccounts/test" | ||
| """ | ||
|
|
||
| helps['import-export update'] = """ | ||
| type: command | ||
| short-summary: Updates specific properties of a job. You can call this operation to notify the Import/Export service that the hard drives comprising the import or export job have been shipped to the Microsoft data center. It can also be used to cancel an existing job. | ||
| examples: | ||
| - name: Update job | ||
| text: |- | ||
| az import-export update --resource-group "myResourceGroup" --name "myJob" | ||
| --backup-drive-manifest true --log-level "Verbose" --state "" | ||
| """ | ||
|
|
||
| helps['import-export delete'] = """ | ||
| type: command | ||
| short-summary: Deletes an existing job. Only jobs in the Creating or Completed states can be deleted. | ||
| examples: | ||
| - name: Delete job | ||
| text: |- | ||
| az import-export delete --resource-group "myResourceGroup" --name "myJob" | ||
| """ | ||
|
|
||
| helps['import-export bit-locker-key'] = """ | ||
| type: group | ||
| short-summary: import-export bit-locker-key | ||
| """ | ||
|
|
||
| helps['import-export bit-locker-key list'] = """ | ||
| type: command | ||
| short-summary: Returns the BitLocker Keys for all drives in the specified job. | ||
| examples: | ||
| - name: List BitLocker Keys for drives in a job | ||
| text: |- | ||
| az import-export bit-locker-key list --resource-group "myResourceGroup" --job-name "myJob" | ||
| """ | ||
73 changes: 73 additions & 0 deletions
73
src/import-export/azext_import_export/generated/_params.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| # pylint: disable=line-too-long | ||
| # pylint: disable=too-many-lines | ||
| # pylint: disable=too-many-statements | ||
|
|
||
| from knack.arguments import CLIArgumentType | ||
| from azure.cli.core.commands.parameters import ( | ||
| tags_type, | ||
| get_three_state_flag, | ||
| get_location_type | ||
| ) | ||
| from azure.cli.core.commands.validators import get_default_location_from_resource_group | ||
| from azext_import_export.action import ( | ||
| AddReturnAddress, | ||
| AddReturnShipping, | ||
| AddShippingInformation, | ||
| AddDeliveryPackage, | ||
| AddReturnPackage, | ||
| AddDriveList, | ||
| AddExport | ||
| ) | ||
|
|
||
|
|
||
| def load_arguments(self, _): | ||
|
|
||
| with self.argument_context('import-export list') as c: | ||
| pass | ||
|
|
||
| with self.argument_context('import-export show') as c: | ||
| c.argument('name', options_list=['--name', '-n'], help='The name of the import/export job.') | ||
|
|
||
| with self.argument_context('import-export create') as c: | ||
| c.argument('name', options_list=['--name', '-n'], help='The name of the import/export job.') | ||
| c.argument('client_tenant_id', help='The tenant ID of the client making the request.') | ||
| c.argument('location', arg_type=get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group) | ||
| c.argument('tags', tags_type) | ||
| c.argument('storage_account', help='Name or ID of the storage account where data will be imported to or exported from.') | ||
| c.argument('type', help='The type of job') | ||
| c.argument('return_address', action=AddReturnAddress, nargs='+', help='Specifies the return address information for the job.') | ||
| c.argument('return_shipping', action=AddReturnShipping, nargs='+', help='Specifies the return carrier and customer\'s account with the carrier.') | ||
| c.argument('shipping_information', action=AddShippingInformation, nargs='+', help='Contains information about the Microsoft datacenter to which the drives should be shipped.') | ||
| c.argument('delivery_package', action=AddDeliveryPackage, nargs='+', help='Contains information about the package being shipped by the customer to the Microsoft data center.') | ||
| c.argument('return_package', action=AddReturnPackage, nargs='+', help='Contains information about the package being shipped by the customer to the Microsoft data center.') | ||
| c.argument('diagnostics_path', help='The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored.') | ||
| c.argument('log_level', help='Default value is Error. Indicates whether error logging or verbose logging will be enabled.') | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this enum in swagger? if yes, pls feedback to code gen team.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's defined as |
||
| c.argument('backup_drive_manifest', arg_type=get_three_state_flag(), help='Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs.') | ||
| c.argument('state', help='Current state of the job.') | ||
| c.argument('cancel_requested', arg_type=get_three_state_flag(), help='Indicates whether a request has been submitted to cancel the job.') | ||
| c.argument('percent_complete', help='Overall percentage completed for the job.') | ||
| c.argument('incomplete_blob_list_uri', help='A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive space. If all blobs were exported successfully, then this element is not included in the response.') | ||
| c.argument('drive_list', action=AddDriveList, nargs='+', help='List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified for export jobs.') | ||
| c.argument('export', action=AddExport, nargs='+', help='A property containing information about the blobs to be exported for an export job. This property is required for export jobs, but must not be specified for import jobs.') | ||
|
|
||
| with self.argument_context('import-export update') as c: | ||
| c.argument('name', options_list=['--name', '-n'], help='The name of the import/export job.') | ||
| c.argument('tags', tags_type) | ||
| c.argument('cancel_requested', arg_type=get_three_state_flag(), help='If specified, the value must be true. The service will attempt to cancel the job.') | ||
| c.argument('state', help='If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, otherwise the request will fail.') | ||
| c.argument('return_address', action=AddReturnAddress, nargs='+', help='Specifies the return address information for the job.') | ||
| c.argument('return_shipping', action=AddReturnShipping, nargs='+', help='Specifies the return carrier and customer\'s account with the carrier.') | ||
| c.argument('delivery_package', action=AddDeliveryPackage, nargs='+', help='Contains information about the package being shipped by the customer to the Microsoft data center.') | ||
| c.argument('log_level', help='Indicates whether error logging or verbose logging is enabled.') | ||
| c.argument('backup_drive_manifest', arg_type=get_three_state_flag(), help='Indicates whether the manifest files on the drives should be copied to block blobs.') | ||
| c.argument('drive_list', action=AddDriveList, nargs='+', help='List of drives that comprise the job.') | ||
|
|
||
| with self.argument_context('import-export delete') as c: | ||
| c.argument('name', options_list=['--name', '-n'], help='The name of the import/export job.') | ||
|
|
||
| with self.argument_context('import-export bit-locker-key list') as c: | ||
| c.argument('job_name', help='The name of the import/export job.') | ||
4 changes: 4 additions & 0 deletions
4
src/import-export/azext_import_export/generated/_validators.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drive-list is an array right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we can specify multi --dirve-list here.