-
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
Conversation
|
Import Export |
| 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 |
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.
| def load_arguments(self, _): | ||
|
|
||
| with self.argument_context('import-export list') as c: | ||
| c.argument('top', help='An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100.') |
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.
seems this isn't in help file
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.
Currently top value can not be less than total count of jobs. It's very strange. I have sent an email to ask about this. I will remove these 2 parameters temporarily and add them back when get the final answer.
src/import-export/setup.cfg
Outdated
| @@ -0,0 +1,2 @@ | |||
| [bdist_wheel] | |||
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.
azure-cli-core doesn't support Python 2 any more.
Leaving this would lead to the built wheel named as import-export-py2-py3-none-any.whl.
Should Leave this file empty and the wheel name would be import-export-py3-none-any.whl
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.
updated
src/import-export/setup.py
Outdated
| 'Intended Audience :: System Administrators', | ||
| 'Programming Language :: Python', | ||
| 'Programming Language :: Python :: 3', | ||
| 'Programming Language :: Python :: 3.5', |
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.
azure-cli-core don't support Python 3.5 Azure/azure-cli#12694
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.
updated
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
|
|
||
| def example_name_or_id_validator(cmd, namespace): |
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.
Please delete it
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.
deleted.
| if kl == 'recipient-name': | ||
| d['recipient_name'] = v | ||
| elif kl == 'street-address1': | ||
| d['street_address1'] = v | ||
| elif kl == 'street-address2': | ||
| d['street_address2'] = v | ||
| elif kl == 'city': | ||
| d['city'] = v | ||
| elif kl == 'state-or-province': | ||
| d['state_or_province'] = v | ||
| elif kl == 'postal-code': | ||
| d['postal_code'] = v | ||
| elif kl == 'country-or-region': | ||
| d['country_or_region'] = v | ||
| elif kl == 'phone': | ||
| d['phone'] = v | ||
| elif kl == 'email': | ||
| d['email'] = v |
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.
| if kl == 'recipient-name': | |
| d['recipient_name'] = v | |
| elif kl == 'street-address1': | |
| d['street_address1'] = v | |
| elif kl == 'street-address2': | |
| d['street_address2'] = v | |
| elif kl == 'city': | |
| d['city'] = v | |
| elif kl == 'state-or-province': | |
| d['state_or_province'] = v | |
| elif kl == 'postal-code': | |
| d['postal_code'] = v | |
| elif kl == 'country-or-region': | |
| d['country_or_region'] = v | |
| elif kl == 'phone': | |
| d['phone'] = v | |
| elif kl == 'email': | |
| d['email'] = v | |
| if kl in ['recipient-name', 'street-address1', ..., 'email']: | |
| d[kl] = v |
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.
And the variable naming is hard for human to read. d, k, kl, v
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.
Actually the parameter name and the map key are not the same. For example, state-or-province is parameter name, state_or_province is the key, they are not the same. I prefer the current way because it is explicit.
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.
Oh. Sorry. I haven't noticed it.
| if kl == 'carrier-name': | ||
| d['carrier_name'] = v | ||
| elif kl == 'carrier-account-number': | ||
| d['carrier_account_number'] = v |
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.
Can be simplified.
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.
how about feedback this to code gen team
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.
Actually the key and parameter name is not the same. It's a underscore in the key, and a minus in parameter name. I prefer current code because it is more explicitly and we can rename it easily.
| if kl == 'recipient-name': | ||
| d['recipient_name'] = v | ||
| elif kl == 'street-address1': | ||
| d['street_address1'] = v | ||
| elif kl == 'street-address2': | ||
| d['street_address2'] = v | ||
| elif kl == 'city': | ||
| d['city'] = v | ||
| elif kl == 'state-or-province': | ||
| d['state_or_province'] = v | ||
| elif kl == 'postal-code': | ||
| d['postal_code'] = v | ||
| elif kl == 'country-or-region': | ||
| d['country_or_region'] = v | ||
| elif kl == 'phone': | ||
| d['phone'] = v |
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.
Can be simplified.
| if kl == 'carrier-name': | ||
| d['carrier_name'] = v | ||
| elif kl == 'tracking-number': | ||
| d['tracking_number'] = v | ||
| elif kl == 'drive-count': | ||
| d['drive_count'] = v | ||
| elif kl == 'ship-date': | ||
| d['ship_date'] = v |
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.
Can be simplified.
| if kl == 'carrier-name': | ||
| d['carrier_name'] = v | ||
| elif kl == 'tracking-number': | ||
| d['tracking_number'] = v | ||
| elif kl == 'drive-count': | ||
| d['drive_count'] = v | ||
| elif kl == 'ship-date': | ||
| d['ship_date'] = v |
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.
Can be simplified.
| if kl == 'drive-id': | ||
| d['drive_id'] = v | ||
| elif kl == 'bit-locker-key': | ||
| d['bit_locker_key'] = v | ||
| elif kl == 'manifest-file': | ||
| d['manifest_file'] = v | ||
| elif kl == 'manifest-hash': | ||
| d['manifest_hash'] = v | ||
| elif kl == 'drive-header-hash': | ||
| d['drive_header_hash'] = v | ||
| elif kl == 'state': | ||
| d['state'] = v | ||
| elif kl == 'copy-status': | ||
| d['copy_status'] = v | ||
| elif kl == 'percent-complete': | ||
| d['percent_complete'] = v | ||
| elif kl == 'verbose-log-uri': | ||
| d['verbose_log_uri'] = v | ||
| elif kl == 'error-log-uri': | ||
| d['error_log_uri'] = v | ||
| elif kl == 'manifest-uri': | ||
| d['manifest_uri'] = v | ||
| elif kl == 'bytes-succeeded': | ||
| d['bytes_succeeded'] = v |
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.
Can be simplified.
And where do these string literals come from? Are they defined in SDK? If so, avoid so many string literals.
| if kl == 'blob-listblob-path': | ||
| d['blob_listblob_path'] = v | ||
| elif kl == 'blob-path': | ||
| d['blob_path'] = v | ||
| elif kl == 'blob-path-prefix': | ||
| d['blob_path_prefix'] = v |
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.
Can be simplified.
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
| __path__ = __import__('pkgutil').extend_path(__path__, __name__) No newline at end of file |
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.
Is it written by you manually?
Some extensions use the following sentence.
__import__('pkg_resources').declare_namespace(__name__)
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.
should be autogenerated. what's the difference?
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.
Reference document is here. __import__('pkg_resources').declare_namespace(__name__) is no longer recommentded.
| 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_id', help='The resource identifier of the storage account where data will be imported to or exported from.') |
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.
support id or name
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.
updated
| 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.') |
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.
is this enum in swagger? if yes, pls feedback to code gen team.
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.
It's defined as string in swagger.
| 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.') | ||
| c.argument('provisioning_state', help='Specifies the provisioning state of the job.') |
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.
this is an argument?
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.
Nice finding. It should be a bug of swagger file. It reuse a JobDetail object in both PutParameter and JobResponse. As a result of that we can specify this value when create a job, however the server will ignore it. I think we should remove it from create command parameters.
| if kl == 'carrier-name': | ||
| d['carrier_name'] = v | ||
| elif kl == 'carrier-account-number': | ||
| d['carrier_account_number'] = v |
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.
how about feedback this to code gen team
| return client.get(job_name=name, resource_group_name=resource_group_name) | ||
|
|
||
|
|
||
| def import_export_job_create(cmd, client, name, resource_group_name, client_tenant_id=None, location=None, tags=None, |
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.
pls make sure indention correct.
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.
Should be no problem with indention. It's a IDE suggested style and pass our style check.
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
| __path__ = __import__('pkgutil').extend_path(__path__, __name__) No newline at end of file |
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.
should be autogenerated. what's the difference?
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Spec is here
This checklist is used to make sure that common guidelines for a pull request are followed.
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally?For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your PR is merged into master branch, a new PR will be created to update
src/index.jsonautomatically.The precondition is to put your code inside this repo and upgrade the version in the PR but do not modify
src/index.json.