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

[Breadth Coverage] Support Databox in Azure CLI cmdlets #1344

Merged
merged 8 commits into from
Apr 7, 2020

Conversation

jsntcy
Copy link
Member

@jsntcy jsntcy commented Mar 3, 2020

What does this PR do?

What's the key use case?
In the case of an offline transfer, the flow for Databox customers is:

  • Place an order for a device
  • Track the order (forward and reverse shipment)
  • A device is shipped to customer
  • Customer retrieve the credentials to unlock the device
  • Customer copies the data
  • Customer ship back the device
  • Data is transferred to customer storage account

Which commands will be supported?
az databox job create
az databox job update
az databox job show
az databox job cancel
az databox job delete
az databox job list
az databox job list-credentials

Notes
az databox job list-credentials is a special command. Usually only a physical databox device is received, then the credentials for the device can be retrieved by this command. As discussed with service team, I just tested this command manually in service team's test subscription with fixed resource group and databox job and will not include it in automation test.


This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally?

For new extensions:

@azuresdkci
Copy link

If this PR is for a new extension or change to an existing extension, use the following to try out the changes in this PR:

docker run -it microsoft/azure-cli:latest
export EXT=<NAME>
pip install --upgrade --target ~/.azure/cliextensions/$EXT "git+https://github.com/jsntcy/azure-cli-extensions.git@bc-databox-final#subdirectory=src/$EXT&egg=$EXT"

@jsntcy jsntcy self-assigned this Mar 3, 2020
@yonzhan yonzhan added this to the S166 milestone Mar 3, 2020
@yonzhan
Copy link
Collaborator

yonzhan commented Mar 3, 2020

add to S166.

@jsntcy jsntcy changed the title Support Databox in Azure CLI cmdlets [Breadth Coverage]Support Databox in Azure CLI cmdlets Mar 4, 2020
@jsntcy jsntcy changed the title [Breadth Coverage]Support Databox in Azure CLI cmdlets [Breadth Coverage] Support Databox in Azure CLI cmdlets Mar 4, 2020
@jsntcy jsntcy force-pushed the bc-databox-final branch 2 times, most recently from a299798 to 17bd65b Compare March 4, 2020 09:27
'characters in length and use any alphanumeric and underscore only')

with self.argument_context('databox job create') as c:
c.argument('job_name', job_name_type)
Copy link
Member

@jiasli jiasli Mar 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually use --name instead of --job-name, --vault-name or --account-name for the object itself. #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will update it.


In reply to: 388061247 [](ancestors = 388061247)

Copy link
Contributor

@mmyyrroonn mmyyrroonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general except for three_id arguments.

c.argument('location', arg_type=get_location_type(self.cli_ctx), default=None,
validator=get_default_location_from_resource_group)
c.argument('tags', tags_type)
c.argument('sku_name', arg_type=get_enum_type(['DataBox', 'DataBoxDisk', 'DataBoxHeavy']),
Copy link
Contributor

@mmyyrroonn mmyyrroonn Mar 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be sku #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will update it


In reply to: 388066918 [](ancestors = 388066918)

c.argument('postal_code', help='Postal code.')
c.argument('company_name', help='Name of the company.')
c.extra('storage_account_id', help='The destination storage account resource id.', arg_group='Storage Account')
c.extra('staging_storage_account_id',
Copy link
Contributor

@mmyyrroonn mmyyrroonn Mar 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be storage_account_name or storage_account #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be updated.


In reply to: 388067043 [](ancestors = 388067043)

c.argument('country', help='Name of the Country. Ex: US')
c.argument('postal_code', help='Postal code.')
c.argument('company_name', help='Name of the company.')
c.extra('storage_account_id', help='The destination storage account resource id.', arg_group='Storage Account')
Copy link
Contributor

@mmyyrroonn mmyyrroonn Mar 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here. Meanwhile, what's the difference between the storage account id and the staging storage account id? #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will update it


In reply to: 388071425 [](ancestors = 388071425)

c.extra('staging_storage_account_id',
help='The destination storage account id that can be used to copy the vhd for staging.',
arg_group='Managed Disk')
c.extra('resource_group_id',
Copy link
Contributor

@mmyyrroonn mmyyrroonn Mar 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this used for? #Resolved

Copy link
Member Author

@jsntcy jsntcy Mar 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create new resource group if you intend to create managed disks from on-premises VHDs. You can use an existing resource group only if the resource group was created previously when creating a Data Box order for managed disk by Data Box service.


In reply to: 388071552 [](ancestors = 388071552)

street_address3=None,
state_or_province=None,
company_name=None):
job_resource = get_databox_job(client, resource_group_name, job_name)
Copy link
Contributor

@mmyyrroonn mmyyrroonn Mar 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's already a patch method. Why do we need to get it again? #WontFix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the patch method in SDK is not correct. When just pass one property that need to be updated to SDK, it said some other properties cannot be None.


In reply to: 388072098 [](ancestors = 388072098)

return cf_databox(cli_ctx).jobs


def cf_service(cli_ctx, *_):
Copy link
Contributor

@mmyyrroonn mmyyrroonn Mar 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this client factory? #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will remove it.


In reply to: 388072166 [](ancestors = 388072166)

'--job-name {job_name} '
'--contact-name "Public SDK Test 1" '
'--email-list testing1@microsoft.com ',
checks=[])
Copy link
Contributor

@mmyyrroonn mmyyrroonn Mar 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add some checks here? just like the show command #WontFix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the updated parameters are not returned from command and I checked the update result by the following 'show' command


In reply to: 388072600 [](ancestors = 388072600)

Copy link
Contributor

@mmyyrroonn mmyyrroonn Mar 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's quite strange. Is it a long running operation? It should return something. #WontFix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it returns something, but the response doesn't include updated properties. "Show" command below should cover the update logic.


In reply to: 390126507 [](ancestors = 390126507)

==========================================

This package is for the 'databox' extension.
i.e. 'az databox'
Copy link
Member

@fengzhou-msft fengzhou-msft Mar 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add more details on how to use this extension. You can refer to storage-preview. #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll add it.


In reply to: 388083315 [](ancestors = 388083315)

Comment on lines 19 to 21
job_name_type = CLIArgumentType(
help='The name of the job resource within the specified resource group. job names must be between 3 and 24 '
'characters in length and use any alphanumeric and underscore only')
Copy link
Member

@fengzhou-msft fengzhou-msft Mar 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add options_list=['--name', '-n']? #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update it.


In reply to: 388084566 [](ancestors = 388084566)

@jsntcy jsntcy force-pushed the bc-databox-final branch from 7d02f02 to 1d370f1 Compare March 6, 2020 15:40
Comment on lines 32 to 43
c.argument('contact_name', help='Contact name of the person.')
c.argument('phone', help='Phone number of the contact person.')
c.argument('mobile', help='Mobile number of the contact person.')
c.argument('email_list', help='Space-separated list of Email addresses to be notified about job progress.', nargs='+')
c.argument('street_address1', help='Street Address line 1.')
c.argument('street_address2', help='Street Address line 2.')
c.argument('street_address3', help='Street Address line 3.')
c.argument('city', help='Name of the City.')
c.argument('state_or_province', help='Name of the State or Province.')
c.argument('country', help='Name of the Country. Ex: US')
c.argument('postal_code', help='Postal code.')
c.argument('company_name', help='Name of the company.')
Copy link
Member

@fengzhou-msft fengzhou-msft Mar 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add arg_group for these deilvery information so it's more organized in help message. #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good suggestions, will update


In reply to: 389509108 [](ancestors = 389509108)

@jsntcy jsntcy force-pushed the bc-databox-final branch from 5b65682 to 6a1eeba Compare April 7, 2020 06:25
@jsntcy jsntcy merged commit 5e8de4e into Azure:master Apr 7, 2020
ManuInNZ pushed a commit to ManuInNZ/azure-cli-extensions that referenced this pull request Apr 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants