# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from knack.help_files import helps  # pylint: disable=unused-import
# pylint: disable=line-too-long, too-many-lines

helps['storage'] = """
type: group
short-summary: Manage Azure Cloud Storage resources.
"""

helps['storage account'] = """
type: group
short-summary: Manage storage accounts.
"""

helps['storage account create'] = """
type: command
short-summary: Create a storage account.
long-summary: >
    The SKU of the storage account defaults to 'Standard_RAGRS'.
examples:
  - name: Create a storage account 'MyStorageAccount' in resource group 'MyResourceGroup' in the West US region with locally redundant storage.
    text: az storage account create -n MyStorageAccount -g MyResourceGroup -l westus --sku Standard_LRS
    unsupported-profiles: 2017-03-09-profile
  - name: Create a storage account 'MyStorageAccount' in resource group 'MyResourceGroup' in the West US region with locally redundant storage.
    text: az storage account create -n MyStorageAccount -g MyResourceGroup -l westus --account-type Standard_LRS
    supported-profiles: 2017-03-09-profile
"""

helps['storage account delete'] = """
type: command
short-summary: Delete a storage account.
examples:
  - name: Delete a storage account using a resource ID.
    text: az storage account delete --ids /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Storage/storageAccounts/{StorageAccount}
  - name: Delete a storage account using an account name and resource group.
    text: az storage account delete -n MyStorageAccount -g MyResourceGroup
"""

helps['storage account generate-sas'] = """
type: command
parameters:
  - name: --services
    short-summary: 'The storage services the SAS is applicable for. Allowed values: (b)lob (f)ile (q)ueue (t)able. Can be combined.'
  - name: --resource-types
    short-summary: 'The resource types the SAS is applicable for. Allowed values: (s)ervice (c)ontainer (o)bject. Can be combined.'
  - name: --expiry
    short-summary: Specifies the UTC datetime (Y-m-d'T'H:M'Z') at which the SAS becomes invalid.
  - name: --start
    short-summary: Specifies the UTC datetime (Y-m-d'T'H:M'Z') at which the SAS becomes valid. Defaults to the time of the request.
  - name: --account-name
    short-summary: 'Storage account name. Must be used in conjunction with either storage account key or a SAS token. Environment Variable: AZURE_STORAGE_ACCOUNT'
examples:
  - name: Generate a sas token for the account that is valid for queue and table services on Linux.
    text: |
        end=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
        az storage account generate-sas --permissions cdlruwap --account-name MyStorageAccount --services qt --resource-types sco --expiry $end -o tsv
  - name: Generate a sas token for the account that is valid for queue and table services on MacOS.
    text: |
        end=`date -v+30M '+%Y-%m-%dT%H:%MZ'`
        az storage account generate-sas --permissions cdlruwap --account-name MyStorageAccount --services qt --resource-types sco --expiry $end -o tsv
  - name: Generates a shared access signature for the account (autogenerated)
    text: az storage account generate-sas --account-key 00000000 --account-name MyStorageAccount --expiry 2020-01-01 --https-only --permissions acuw --resource-types co --services bfqt
    crafted: true
"""

helps['storage account keys'] = """
type: group
short-summary: Manage storage account keys.
"""

helps['storage account keys list'] = """
type: command
short-summary: List the primary and secondary keys for a storage account.
examples:
  - name: List the primary and secondary keys for a storage account.
    text: az storage account keys list -g MyResourceGroup -n MyStorageAccount
"""

helps['storage account list'] = """
type: command
short-summary: List storage accounts.
examples:
  - name: List all storage accounts in a subscription.
    text: az storage account list
  - name: List all storage accounts in a resource group.
    text: az storage account list -g MyResourceGroup
"""

helps['storage account management-policy'] = """
type: group
short-summary: Manage storage account management policies.
"""

helps['storage account management-policy create'] = """
type: command
short-summary: Creates the data policy rules associated with the specified storage account.
"""

helps['storage account management-policy update'] = """
type: command
short-summary: Updates the data policy rules associated with the specified storage account.
"""

helps['storage account network-rule'] = """
type: group
short-summary: Manage network rules.
"""

helps['storage account network-rule add'] = """
type: command
short-summary: Add a network rule.
long-summary: >
    Rules can be created for an IPv4 address, address range (CIDR format), or a virtual network subnet.
examples:
  - name: Create a rule to allow a specific address-range.
    text: az storage account network-rule add -g myRg --account-name mystorageaccount --ip-address 23.45.1.0/24
  - name: Create a rule to allow access for a subnet.
    text: az storage account network-rule add -g myRg --account-name mystorageaccount --vnet myvnet --subnet mysubnet
"""

helps['storage account network-rule list'] = """
type: command
short-summary: List network rules.
examples:
  - name: List network rules. (autogenerated)
    text: az storage account network-rule list --account-name MyAccount --resource-group MyResourceGroup
    crafted: true
"""

helps['storage account network-rule remove'] = """
type: command
short-summary: Remove a network rule.
examples:
  - name: Remove a network rule. (autogenerated)
    text: az storage account network-rule remove --account-name MyAccount --resource-group MyResourceGroup --subnet mysubnet
    crafted: true
  - name: Remove a network rule. (autogenerated)
    text: az storage account network-rule remove --account-name MyAccount --ip-address 23.45.1.0/24 --resource-group MyResourceGroup
    crafted: true
"""

helps['storage account revoke-delegation-keys'] = """
type: command
short-summary: Revoke all user delegation keys for a storage account.
examples:
  - name: Revoke all user delegation keys for a storage account by resource ID.
    text: az storage account revoke-delegation-keys --ids /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Storage/storageAccounts/{StorageAccount}
  - name: Revoke all user delegation keys for a storage account 'MyStorageAccount' in resource group 'MyResourceGroup' in the West US region with locally redundant storage.
    text: az storage account revoke-delegation-keys -n MyStorageAccount -g MyResourceGroup
"""

helps['storage account show'] = """
type: command
short-summary: Show storage account properties.
examples:
  - name: Show properties for a storage account by resource ID.
    text: az storage account show --ids /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Storage/storageAccounts/{StorageAccount}
  - name: Show properties for a storage account using an account name and resource group.
    text: az storage account show -g MyResourceGroup -n MyStorageAccount
"""

helps['storage account show-connection-string'] = """
type: command
short-summary: Get the connection string for a storage account.
examples:
  - name: Get a connection string for a storage account.
    text: az storage account show-connection-string -g MyResourceGroup -n MyStorageAccount
  - name: Get the connection string for a storage account. (autogenerated)
    text: az storage account show-connection-string --name MyStorageAccount --resource-group MyResourceGroup --subscription MySubscription
    crafted: true
"""

helps['storage account show-usage'] = """
type: command
short-summary: Show the current count and limit of the storage accounts under the subscription.
examples:
  - name: Show the current count and limit of the storage accounts under the subscription. (autogenerated)
    text: az storage account show-usage --location westus2
    crafted: true
"""

helps['storage account update'] = """
type: command
short-summary: Update the properties of a storage account.
examples:
  - name: Update the properties of a storage account. (autogenerated)
    text: az storage account update --default-action Allow --name MyStorageAccount --resource-group MyResourceGroup
    crafted: true
"""

helps['storage blob'] = """
type: group
short-summary: Manage object storage for unstructured data (blobs).
"""

helps['storage blob copy'] = """
type: group
short-summary: Manage blob copy operations. Use `az storage blob show` to check the status of the blobs.
"""

helps['storage blob copy start'] = """
type: command
short-summary: Copies a blob asynchronously. Use `az storage blob show` to check the status of the blobs.
examples:
  - name: Copies a blob asynchronously. Use `az storage blob show` to check the status of the blobs. (autogenerated)
    text: az storage blob copy start --account-key 00000000 --account-name MyAccount --destination-blob MyDestinationBlob --destination-container MyDestinationContainer --source-uri https://storage.blob.core.windows.net/photos
    crafted: true
  - name: Copies a blob asynchronously. Use `az storage blob show` to check the status of the blobs (autogenerated)
    text: az storage blob copy start --account-name MyAccount --destination-blob MyDestinationBlob --destination-container MyDestinationContainer --sas-token $sas --source-uri https://storage.blob.core.windows.net/photos
    crafted: true
"""

helps['storage blob copy start-batch'] = """
type: command
short-summary: Copy multiple blobs or files to a blob container. Use `az storage blob show` to check the status of the blobs.
parameters:
  - name: --destination-container -c
    type: string
    short-summary: The blob container where the selected source files or blobs will be copied to.
  - name: --pattern
    type: string
    short-summary: The pattern used for globbing files or blobs in the source. The supported patterns are '*', '?', '[seq', and '[!seq]'.
  - name: --dryrun
    type: bool
    short-summary: List the files or blobs to be uploaded. No actual data transfer will occur.
  - name: --source-account-name
    type: string
    short-summary: The source storage account from which the files or blobs are copied to the destination. If omitted, the source account is used.
  - name: --source-account-key
    type: string
    short-summary: The account key for the source storage account.
  - name: --source-container
    type: string
    short-summary: The source container from which blobs are copied.
  - name: --source-share
    type: string
    short-summary: The source share from which files are copied.
  - name: --source-uri
    type: string
    short-summary: A URI specifying a file share or blob container from which the files or blobs are copied.
    long-summary: If the source is in another account, the source must either be public or be authenticated by using a shared access signature.
  - name: --source-sas
    type: string
    short-summary: The shared access signature for the source storage account.
examples:
  - name: Copy multiple blobs or files to a blob container. Use `az storage blob show` to check the status of the blobs. (autogenerated)
    text: az storage blob copy start-batch --account-key 00000000 --account-name MyAccount --destination-container MyDestinationContainer --source-account-key MySourceKey --source-account-name MySourceAccount --source-container MySourceContainer
    crafted: true
"""

helps['storage blob delete'] = """
type: command
short-summary: Mark a blob or snapshot for deletion.
long-summary: >
    The blob is marked for later deletion during garbage collection.  In order to delete a blob, all of its snapshots must also be deleted.
    Both can be removed at the same time.
examples:
  - name: Delete a blob.
    text: az storage blob delete -c MyContainer -n MyBlob
"""

helps['storage blob delete-batch'] = """
type: command
short-summary: Delete blobs from a blob container recursively.
parameters:
  - name: --source -s
    type: string
    short-summary: The blob container from where the files will be deleted.
    long-summary: The source can be the container URL or the container name. When the source is the container URL, the storage account name will be parsed from the URL.
  - name: --pattern
    type: string
    short-summary: The pattern used for globbing files or blobs in the source. The supported patterns are '*', '?', '[seq]', and '[!seq]'.
  - name: --dryrun
    type: bool
    short-summary: Show the summary of the operations to be taken instead of actually deleting the file(s).
    long-summary: If this is specified, it will ignore all the Precondition Arguments that include --if-modified-since and --if-unmodified-since. So the file(s) will be deleted with the command without --dryrun may be different from the result list with --dryrun flag on.
  - name: --if-match
    type: string
    short-summary: An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.
  - name: --if-none-match
    type: string
    short-summary: An ETag value, or the wildcard character (*).
    long-summary: Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character (*) to perform the operation only if the resource does not exist, and fail the operation if it does exist.
examples:
  - name: Delete all blobs ending with ".py" in a container that have not been modified for 10 days.
    text: |
        date=`date -d "10 days ago" '+%Y-%m-%dT%H:%MZ'`
        az storage blob delete-batch -s MyContainer --account-name MyStorageAccount --pattern *.py --if-unmodified-since $date
"""

helps['storage blob download-batch'] = """
type: command
short-summary: Download blobs from a blob container recursively.
parameters:
  - name: --source -s
    type: string
    short-summary: The blob container from where the files will be downloaded.
    long-summary: The source can be the container URL or the container name. When the source is the container URL, the storage account name will be parsed from the URL.
  - name: --destination -d
    type: string
    short-summary: The existing destination folder for this download operation.
  - name: --pattern
    type: string
    short-summary: The pattern used for globbing files or blobs in the source. The supported patterns are '*', '?', '[seq]', and '[!seq]'.
  - name: --dryrun
    type: bool
    short-summary: Show the summary of the operations to be taken instead of actually downloading the file(s).
examples:
  - name: Download all blobs that end with .py
    text: az storage blob download-batch -d . --pattern *.py -s MyContainer --account-name MyStorageAccount
"""

helps['storage blob exists'] = """
type: command
short-summary: Check for the existence of a blob in a container.
parameters:
  - name: --name -n
    short-summary: The blob name.
examples:
  - name: Check for the existence of a blob in a container. (autogenerated)
    text: az storage blob exists --account-key 00000000 --account-name MyAccount --container-name MyContainer --name MyBlob
    crafted: true
"""

helps['storage blob generate-sas'] = """
type: command
short-summary: Generates a shared access signature for the blob.
examples:
  - name: Generate a sas token for a blob with read-only permissions.
    text: |
        end=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
        az storage blob generate-sas --account-name MyStorageAccount -c MyContainer -n MyBlob --permissions r --expiry $end --https-only
  - name: Generates a shared access signature for the blob. (autogenerated)
    text: az storage blob generate-sas --account-key 00000000 --account-name MyStorageAccount --container-name MyContainer --expiry 2018-01-01T00:00:00Z --name MyBlob --permissions r
    crafted: true
"""

helps['storage blob incremental-copy'] = """
type: group
short-summary: Manage blob incremental copy operations.
"""

helps['storage blob incremental-copy start'] = """
type: command
short-summary: Copies an incremental copy of a blob asynchronously.
long-summary: This operation returns a copy operation properties object, including a copy ID you can use to check or abort the copy operation. The Blob service copies blobs on a best-effort basis. The source blob for an incremental copy operation must be a page blob. Call get_blob_properties on the destination blob to check the status of the copy operation. The final blob will be committed when the copy completes.
examples:
  - name: Upload all files that end with .py unless blob exists and has been modified since given date.
    text: az storage blob incremental-copy start --source-container MySourceContainer --source-blob MyBlob --source-account-name MySourceAccount --source-account-key MySourceKey --source-snapshot MySnapshot --destination-container MyDestinationContainer --destination-blob MyDestinationBlob
  - name: Copies an incremental copy of a blob asynchronously. (autogenerated)
    text: az storage blob incremental-copy start --account-key 00000000 --account-name MyAccount --destination-blob MyDestinationBlob --destination-container MyDestinationContainer --source-account-key MySourceKey --source-account-name MySourceAccount --source-blob MyBlob --source-container MySourceContainer --source-snapshot MySnapshot
    crafted: true
"""

helps['storage blob lease'] = """
type: group
short-summary: Manage storage blob leases.
"""

helps['storage blob list'] = """
type: command
short-summary: List blobs in a given container.
parameters:
  - name: --include
    short-summary: 'Specifies additional datasets to include: (c)opy-info, (m)etadata, (s)napshots, (d)eleted-soft. Can be combined.'
examples:
  - name: List all storage blobs in a container whose names start with 'foo'; will match names such as 'foo', 'foobar', and 'foo/bar'
    text: az storage blob list -c MyContainer --prefix foo
"""

helps['storage blob metadata'] = """
type: group
short-summary: Manage blob metadata.
"""

helps['storage blob service-properties'] = """
type: group
short-summary: Manage storage blob service properties.
"""

helps['storage blob service-properties delete-policy'] = """
type: group
short-summary: Manage storage blob delete-policy service properties.
"""

helps['storage blob service-properties delete-policy show'] = """
type: command
short-summary: Show the storage blob delete-policy.
examples:
  - name: Show the storage blob delete-policy. (autogenerated)
    text: az storage blob service-properties delete-policy show --account-name MyAccount
    crafted: true
"""

helps['storage blob service-properties delete-policy update'] = """
type: command
short-summary: Update the storage blob delete-policy.
examples:
  - name: Update the storage blob delete-policy. (autogenerated)
    text: az storage blob service-properties delete-policy update --account-name MyAccount --days-retained 7 --enable true
    crafted: true
"""

helps['storage blob service-properties update'] = """
type: command
short-summary: Update storage blob service properties.
examples:
  - name: Update storage blob service properties. (autogenerated)
    text: az storage blob service-properties update --404-document error.html --account-name MyAccount --index-document index.html --static-website true
    crafted: true
"""

helps['storage blob set-tier'] = """
type: command
short-summary: Set the block or page tiers on the blob.
parameters:
  - name: --type -t
    short-summary: The blob type
  - name: --tier
    short-summary: The tier value to set the blob to.
  - name: --timeout
    short-summary: The timeout parameter is expressed in seconds. This method may make multiple calls to the Azure service and the timeout will apply to each call individually.
long-summary: >
    For block blob this command only supports block blob on standard storage accounts.
    For page blob, this command only supports for page blobs on premium accounts.
examples:
  - name: Set the block or page tiers on the blob. (autogenerated)
    text: az storage blob set-tier --account-key 00000000 --account-name MyAccount --container-name MyContainer --name MyBlob --tier P10
    crafted: true
"""

helps['storage blob show'] = """
type: command
short-summary: Get the details of a blob.
examples:
  - name: Show all properties of a blob.
    text: az storage blob show -c MyContainer -n MyBlob
  - name: Get the details of a blob (autogenerated)
    text: az storage blob show --account-name MyAccount --container-name MyContainer --name MyBlob
    crafted: true
"""

helps['storage blob sync'] = """
type: command
short-summary: Sync blobs recursively to a storage blob container.
long-summary: Sync command depends on Azcopy, which only works for 64-bit Operating System now. We will support 32-bit Operating System soon.
examples:
  - name: Sync a single blob to a container.
    text: az storage blob sync -c MyContainer --account-name MyStorageAccount -s "path/to/file" -d NewBlob
  - name: Sync a directory to a container.
    text: az storage blob sync -c MyContainer --account-name MyStorageAccount -s "path/to/directory"
"""

helps['storage blob upload'] = """
type: command
short-summary: Upload a file to a storage blob.
long-summary: Creates a new blob from a file path, or updates the content of an existing blob with automatic chunking and progress notifications.
parameters:
  - name: --type -t
    short-summary: Defaults to 'page' for *.vhd files, or 'block' otherwise.
  - name: --maxsize-condition
    short-summary: The max length in bytes permitted for an append blob.
  - name: --validate-content
    short-summary: Specifies that an MD5 hash shall be calculated for each chunk of the blob and verified by the service when the chunk has arrived.
  - name: --tier
    short-summary: A page blob tier value to set the blob to. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts.
examples:
  - name: Upload to a blob.
    text: az storage blob upload -f /path/to/file -c MyContainer -n MyBlob
"""

helps['storage blob upload-batch'] = """
type: command
short-summary: Upload files from a local directory to a blob container.
parameters:
  - name: --source -s
    type: string
    short-summary: The directory where the files to be uploaded are located.
  - name: --destination -d
    type: string
    short-summary: The blob container where the files will be uploaded.
    long-summary: The destination can be the container URL or the container name. When the destination is the container URL, the storage account name will be parsed from the URL.
  - name: --pattern
    type: string
    short-summary: The pattern used for globbing files or blobs in the source. The supported patterns are '*', '?', '[seq]', and '[!seq]'.
  - name: --dryrun
    type: bool
    short-summary: Show the summary of the operations to be taken instead of actually uploading the file(s).
  - name: --if-match
    type: string
    short-summary: An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.
  - name: --if-none-match
    type: string
    short-summary: An ETag value, or the wildcard character (*).
    long-summary: Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character (*) to perform the operation only if the resource does not exist, and fail the operation if it does exist.
  - name: --validate-content
    short-summary: Specifies that an MD5 hash shall be calculated for each chunk of the blob and verified by the service when the chunk has arrived.
  - name: --type -t
    short-summary: Defaults to 'page' for *.vhd files, or 'block' otherwise. The setting will override blob types for every file.
  - name: --maxsize-condition
    short-summary: The max length in bytes permitted for an append blob.
  - name: --lease-id
    short-summary: The active lease id for the blob
examples:
  - name: Upload all files that end with .py unless blob exists and has been modified since given date.
    text: az storage blob upload-batch -d MyContainer --account-name MyStorageAccount -s directory_path --pattern *.py --if-unmodified-since 2018-08-27T20:51Z
"""

helps['storage blob url'] = """
type: command
short-summary: Create the url to access a blob.
examples:
  - name: Create the url to access a blob (autogenerated)
    text: az storage blob url --connection-string $connectionString --container-name container1 --name blob1
    crafted: true
  - name: Create the url to access a blob (autogenerated)
    text: az storage blob url --account-name storageacct --container-name container1 --name blob1
    crafted: true
"""

helps['storage container'] = """
type: group
short-summary: Manage blob storage containers.
"""

helps['storage container create'] = """
type: command
short-summary: Create a container in a storage account.
long-summary: >
    By default, container data is private ("off") to the account owner. Use "blob" to allow public read access for blobs.
    Use "container" to allow public read and list access to the entire container.
    You can configure the --public-access using `az storage container set-permission -n CONTAINER_NAME --public-access blob/container/off`.
examples:
  - name: Create a storage container in a storage account.
    text: az storage container create -n MyStorageContainer
  - name: Create a storage container in a storage account and return an error if the container already exists.
    text: az storage container create -n MyStorageContainer --fail-on-exist
  - name: Create a storage container in a storage account and allow public read access for blobs.
    text: az storage container create -n MyStorageContainer --public-access blob
"""

helps['storage container delete'] = """
type: command
short-summary: Marks the specified container for deletion.
long-summary: >
    The container and any blobs contained within it are later deleted during garbage collection.
examples:
  - name: Marks the specified container for deletion. (autogenerated)
    text: az storage container delete --account-key 00000000 --account-name MyAccount --name MyContainer
    crafted: true
"""

helps['storage container exists'] = """
type: command
short-summary: Check for the existence of a storage container.
examples:
  - name: Check for the existence of a storage container. (autogenerated)
    text: az storage container exists --account-name MyAccount --name MyContainer
    crafted: true
"""

helps['storage container generate-sas'] = """
type: command
short-summary: Generate a SAS token for a storage container.
examples:
  - name: Generate a sas token for blob container and use it to upload a blob.
    text: |
        end=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
        sas=`az storage container generate-sas -n MyContainer --account-name MyStorageAccount --https-only --permissions dlrw --expiry $end -o tsv`
        az storage blob upload -n MyBlob -c MyContainer --account-name MyStorageAccount -f file.txt --sas-token $sas
  - name: Generates a shared access signature for the container (autogenerated)
    text: az storage container generate-sas --account-key 00000000 --account-name MyStorageAccount --expiry 2020-01-01 --name MyContainer --permissions dlrw
    crafted: true
"""

helps['storage container immutability-policy'] = """
type: group
short-summary: Manage container immutability policies.
"""

helps['storage container lease'] = """
type: group
short-summary: Manage blob storage container leases.
"""

helps['storage container legal-hold'] = """
type: group
short-summary: Manage container legal holds.
"""

helps['storage container legal-hold show'] = """
type: command
short-summary: Get the legal hold properties of a container.
examples:
  - name: Get the legal hold properties of a container. (autogenerated)
    text: az storage container legal-hold show --account-name MyAccount --container-name MyContainer
    crafted: true
"""

helps['storage container list'] = """
type: command
short-summary: List containers in a storage account.
"""

helps['storage container metadata'] = """
type: group
short-summary: Manage container metadata.
"""

helps['storage container policy'] = """
type: group
short-summary: Manage container stored access policies.
"""

helps['storage copy'] = """
type: command
short-summary: Copy files or directories to or from Azure storage.
long-summary: Copy command depends on Azcopy, which only works for 64-bit Operating System now. We will support 32-bit Operating System soon.
examples:
  - name: Upload a single file to Azure Blob using url.
    text: az storage copy -s /path/to/file.txt -d https://[account].blob.core.windows.net/[container]/[path/to/blob]
  - name: Upload a single file to Azure Blob using account name and container name.
    text: az storage copy --source-local-path /path/to/file.txt --destination-account-name mystorageaccount --destination-container mycontainer
  - name: Upload a single file to Azure Blob with MD5 hash of the file content and save it as the blob's Content-MD5 property.
    text: az storage copy -s /path/to/file.txt -d https://[account].blob.core.windows.net/[container]/[path/to/blob] --put-md5
  - name: Upload an entire directory to Azure Blob using url.
    text: az storage copy -s /path/to/dir -d https://[account].blob.core.windows.net/[container]/[path/to/directory] --recursive
  - name: Upload an entire directory to Azure Blob using account name and container name.
    text: az storage copy --source-local-path /path/to/dir --destination-account-name mystorageaccount --destination-container mycontainer --recursive
  - name: Upload a set of files to Azure Blob using wildcards with url.
    text: az storage copy -s /path/*foo/*bar/*.pdf -d https://[account].blob.core.windows.net/[container]/[path/to/directory]
  - name: Upload a set of files to Azure Blob using wildcards with account name and container name.
    text: az storage copy --source-local-path /path/*foo/*bar/*.pdf --destination-account-name mystorageaccount --destination-container mycontainer
  - name: Upload files and directories to Azure Blob using wildcards with url.
    text: az storage copy -s /path/*foo/*bar* -d https://[account].blob.core.windows.net/[container]/[path/to/directory] --recursive
  - name: Upload files and directories to Azure Blob using wildcards with account name and container name.
    text: az storage copy --source-local-path /path/*foo/*bar* --destination-account-name mystorageaccount --destination-container mycontainer --recursive
  - name: Download a single file from Azure Blob using url, and you can also specify your storage account and container information as above.
    text: az storage copy -s https://[account].blob.core.windows.net/[container]/[path/to/blob] -d /path/to/file.txt
  - name: Download an entire directory from Azure Blob, and you can also specify your storage account and container information as above.
    text: az storage copy -s https://[account].blob.core.windows.net/[container]/[path/to/directory] -d /path/to/dir --recursive
  - name: Download a set of files from Azure Blob using wildcards, and you can also specify your storage account and container information as above.
    text: az storage copy -s https://[account].blob.core.windows.net/[container]/foo* -d /path/to/dir --recursive
  - name: Copy a single blob to another blob, and you can also specify the storage account and container information of source and destination as above.
    text: az storage copy -s https://[srcaccount].blob.core.windows.net/[container]/[path/to/blob] -d https://[destaccount].blob.core.windows.net/[container]/[path/to/blob]
  - name: Copy an entire account data from blob account to another blob account, and you can also specify the storage account and container information of source and destination as above.
    text: az storage copy -s https://[srcaccount].blob.core.windows.net -d https://[destaccount].blob.core.windows.net --recursive
  - name: Copy a single object from S3 with access key to blob, and you can also specify your storage account and container information as above.
    text: az storage copy -s https://s3.amazonaws.com/[bucket]/[object] -d https://[destaccount].blob.core.windows.net/[container]/[path/to/blob]
  - name: Copy an entire directory from S3 with access key to blob virtual directory, and you can also specify your storage account and container information as above.
    text: az storage copy -s https://s3.amazonaws.com/[bucket]/[folder] -d https://[destaccount].blob.core.windows.net/[container]/[path/to/directory] --recursive
  - name: Copy all buckets in S3 service with access key to blob account, and you can also specify your storage account information as above.
    text: az storage copy -s https://s3.amazonaws.com/ -d https://[destaccount].blob.core.windows.net --recursive
  - name: Copy all buckets in a S3 region with access key to blob account, and you can also specify your storage account information as above.
    text: az storage copy -s https://s3-[region].amazonaws.com/ -d https://[destaccount].blob.core.windows.net --recursive
  - name: Upload a single file to Azure File Share using url.
    text: az storage copy -s /path/to/file.txt -d https://[account].file.core.windows.net/[share]/[path/to/file]
  - name: Upload a single file to Azure File Share using account name and share name.
    text: az storage copy --source-local-path /path/to/file.txt --destination-account-name mystorageaccount --destination-share myshare
  - name: Upload an entire directory to Azure File Share using url.
    text: az storage copy -s /path/to/dir -d https://[account].file.core.windows.net/[share]/[path/to/directory] --recursive
  - name: Upload an entire directory to Azure File Share using account name and container name.
    text: az storage copy --source-local-path /path/to/dir --destination-account-name mystorageaccount --destination-share myshare --recursive
  - name: Upload a set of files to Azure File Share using wildcards with account name and share name.
    text: az storage copy --source-local-path /path/*foo/*bar/*.pdf --destination-account-name mystorageaccount --destination-share myshare
  - name: Upload files and directories to Azure File Share using wildcards with url.
    text: az storage copy -s /path/*foo/*bar* -d https://[account].file.core.windows.net/[share]/[path/to/directory] --recursive
  - name: Upload files and directories to Azure File Share using wildcards with account name and share name.
    text: az storage copy --source-local-path /path/*foo/*bar* --destination-account-name mystorageaccount --destination-share myshare --recursive
  - name: Download a single file from Azure File Share using url, and you can also specify your storage account and share information as above.
    text: az storage copy -s https://[account].file.core.windows.net/[share]/[path/to/file] -d /path/to/file.txt
  - name: Download an entire directory from Azure File Share, and you can also specify your storage account and share information as above.
    text: az storage copy -s https://[account].file.core.windows.net/[share]/[path/to/directory] -d /path/to/dir --recursive
  - name: Download a set of files from Azure File Share using wildcards, and you can also specify your storage account and share information as above.
    text: az storage copy -s https://[account].file.core.windows.net/[share]/foo* -d /path/to/dir --recursive
"""

helps['storage cors'] = """
type: group
short-summary: Manage storage service Cross-Origin Resource Sharing (CORS).
"""

helps['storage cors add'] = """
type: command
short-summary: Add a CORS rule to a storage account.
parameters:
  - name: --services
    short-summary: >
        The storage service(s) to add rules to. Allowed options are: (b)lob, (f)ile,
        (q)ueue, (t)able. Can be combined.
  - name: --max-age
    short-summary: The maximum number of seconds the client/browser should cache a preflight response.
  - name: --origins
    short-summary: Space-separated list of origin domains that will be allowed via CORS, or '*' to allow all domains.
  - name: --methods
    short-summary: Space-separated list of HTTP methods allowed to be executed by the origin.
  - name: --allowed-headers
    short-summary: Space-separated list of response headers allowed to be part of the cross-origin request.
  - name: --exposed-headers
    short-summary: Space-separated list of response headers to expose to CORS clients.
"""

helps['storage cors clear'] = """
type: command
short-summary: Remove all CORS rules from a storage account.
parameters:
  - name: --services
    short-summary: >
        The storage service(s) to remove rules from. Allowed options are: (b)lob, (f)ile,
        (q)ueue, (t)able. Can be combined.
examples:
  - name: Remove all CORS rules from a storage account. (autogenerated)
    text: az storage cors clear --account-name MyAccount --services bfqt
    crafted: true
"""

helps['storage cors list'] = """
type: command
short-summary: List all CORS rules for a storage account.
parameters:
  - name: --services
    short-summary: >
        The storage service(s) to list rules for. Allowed options are: (b)lob, (f)ile,
        (q)ueue, (t)able. Can be combined.
"""

helps['storage directory'] = """
type: group
short-summary: Manage file storage directories.
"""

helps['storage directory exists'] = """
type: command
short-summary: Check for the existence of a storage directory.
examples:
  - name: Check for the existence of a storage directory. (autogenerated)
    text: az storage directory exists --account-key 00000000 --account-name MyAccount --name MyDirectory --share-name MyShare
    crafted: true
"""

helps['storage directory list'] = """
type: command
short-summary: List directories in a share.
examples:
  - name: List directories in a share. (autogenerated)
    text: az storage directory list --share-name MyShare
    crafted: true
"""

helps['storage directory metadata'] = """
type: group
short-summary: Manage file storage directory metadata.
"""

helps['storage entity'] = """
type: group
short-summary: Manage table storage entities.
"""

helps['storage entity insert'] = """
type: command
short-summary: Insert an entity into a table.
parameters:
  - name: --table-name -t
    type: string
    short-summary: The name of the table to insert the entity into.
  - name: --entity -e
    type: list
    short-summary: Space-separated list of key=value pairs. Must contain a PartitionKey and a RowKey.
    long-summary: The PartitionKey and RowKey must be unique within the table, and may be up to 64Kb in size. If using an integer value as a key, convert it to a fixed-width string which can be canonically sorted. For example, convert the integer value 1 to the string value "0000001" to ensure proper sorting.
  - name: --if-exists
    type: string
    short-summary: Behavior when an entity already exists for the specified PartitionKey and RowKey.
  - name: --timeout
    short-summary: The server timeout, expressed in seconds.
examples:
  - name: Insert an entity into a table. (autogenerated)
    text: az storage entity insert --connection-string $connectionString --entity PartitionKey=AAA RowKey=BBB Content=ASDF2 --table-name MyTable
    crafted: true
"""

helps['storage entity query'] = """
type: command
short-summary: List entities which satisfy a query.
parameters:
  - name: --marker
    type: list
    short-summary: Space-separated list of key=value pairs. Must contain a nextpartitionkey and a nextrowkey.
    long-summary: This value can be retrieved from the next_marker field of a previous generator object if max_results was specified and that generator has finished enumerating results. If specified, this generator will begin returning results from the point where the previous generator stopped.
examples:
  - name: List entities which satisfy a query. (autogenerated)
    text: az storage entity query --table-name MyTable
    crafted: true
"""

helps['storage file'] = """
type: group
short-summary: Manage file shares that use the SMB 3.0 protocol.
"""

helps['storage file copy'] = """
type: group
short-summary: Manage file copy operations.
"""

helps['storage file copy start-batch'] = """
type: command
short-summary: Copy multiple files or blobs to a file share.
parameters:
  - name: --destination-share
    type: string
    short-summary: The file share where the source data is copied to.
  - name: --destination-path
    type: string
    short-summary: The directory where the source data is copied to. If omitted, data is copied to the root directory.
  - name: --pattern
    type: string
    short-summary: The pattern used for globbing files and blobs. The supported patterns are '*', '?', '[seq', and '[!seq]'.
  - name: --dryrun
    type: bool
    short-summary: List the files and blobs to be copied. No actual data transfer will occur.
  - name: --source-account-name
    type: string
    short-summary: The source storage account to copy the data from. If omitted, the destination account is used.
  - name: --source-account-key
    type: string
    short-summary: The account key for the source storage account. If omitted, the active login is used to determine the account key.
  - name: --source-container
    type: string
    short-summary: The source container blobs are copied from.
  - name: --source-share
    type: string
    short-summary: The source share files are copied from.
  - name: --source-uri
    type: string
    short-summary: A URI that specifies a the source file share or blob container.
    long-summary: If the source is in another account, the source must either be public or authenticated via a shared access signature.
  - name: --source-sas
    type: string
    short-summary: The shared access signature for the source storage account.
"""

helps['storage file delete-batch'] = """
type: command
short-summary: Delete files from an Azure Storage File Share.
parameters:
  - name: --source -s
    type: string
    short-summary: The source of the file delete operation. The source can be the file share URL or the share name.
  - name: --pattern
    type: string
    short-summary: The pattern used for file globbing. The supported patterns are '*', '?', '[seq]', and '[!seq]'.
  - name: --dryrun
    type: bool
    short-summary: List the files and blobs to be deleted. No actual data deletion will occur.
examples:
  - name: Delete files from an Azure Storage File Share. (autogenerated)
    text: az storage file delete-batch --account-key 00000000 --account-name MyAccount --source /path/to/file
    crafted: true
  - name: Delete files from an Azure Storage File Share. (autogenerated)
    text: az storage file delete-batch --account-key 00000000 --account-name MyAccount --pattern *.py --source /path/to/file
    crafted: true
"""

helps['storage file download-batch'] = """
type: command
short-summary: Download files from an Azure Storage File Share to a local directory in a batch operation.
parameters:
  - name: --source -s
    type: string
    short-summary: The source of the file download operation. The source can be the file share URL or the share name.
  - name: --destination -d
    type: string
    short-summary: The local directory where the files are downloaded to. This directory must already exist.
  - name: --pattern
    type: string
    short-summary: The pattern used for file globbing. The supported patterns are '*', '?', '[seq]', and '[!seq]'.
  - name: --dryrun
    type: bool
    short-summary: List the files and blobs to be downloaded. No actual data transfer will occur.
  - name: --max-connections
    type: integer
    short-summary: The maximum number of parallel connections to use. Default value is 1.
  - name: --snapshot
    type: string
    short-summary: A string that represents the snapshot version, if applicable.
  - name: --validate-content
    type: bool
    short-summary: If set, calculates an MD5 hash for each range of the file for validation.
    long-summary: >
        The storage service checks the hash of the content that has arrived is identical to the hash that was sent.
        This is mostly valuable for detecting bitflips during transfer if using HTTP instead of HTTPS. This hash is not stored.
examples:
  - name: Download files from an Azure Storage File Share to a local directory in a batch operation. (autogenerated)
    text: az storage file download-batch --account-key 00000000 --account-name MyAccount --destination . --no-progress --source /path/to/file
    crafted: true
"""

helps['storage file exists'] = """
type: command
short-summary: Check for the existence of a file.
examples:
  - name: Check for the existence of a file. (autogenerated)
    text: az storage file exists --account-key 00000000 --account-name MyAccount --path path/file.txt --share-name MyShare
    crafted: true
"""

helps['storage file generate-sas'] = """
type: command
examples:
  - name: Generate a sas token for a file.
    text: |
        end=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
        az storage file generate-sas -p path/file.txt -s MyShare --account-name MyStorageAccount --permissions rcdw --https-only --expiry $end
  - name: Generates a shared access signature for the file. (autogenerated)
    text: az storage file generate-sas --account-name MyStorageAccount --expiry 2037-12-31T23:59:00Z --path path/file.txt --permissions rcdw --share-name MyShare --start 2019-01-01T12:20Z
    crafted: true
"""

helps['storage file list'] = """
type: command
short-summary: List files and directories in a share.
parameters:
  - name: --exclude-dir
    type: bool
    short-summary: List only files in the given share.
examples:
  - name: List files and directories in a share. (autogenerated)
    text: az storage file list --share-name MyShare
    crafted: true
"""

helps['storage file metadata'] = """
type: group
short-summary: Manage file metadata.
"""

helps['storage file upload'] = """
type: command
short-summary: Upload a file to a share that uses the SMB 3.0 protocol.
long-summary: Creates or updates an Azure file from a source path with automatic chunking and progress notifications.
examples:
  - name: Upload to a local file to a share.
    text: az storage file upload -s MyShare --source /path/to/file
  - name: Upload a file to a share that uses the SMB 3.0 protocol. (autogenerated)
    text: az storage file upload --account-key 00000000 --account-name MyStorageAccount --path path/file.txt --share-name MyShare --source /path/to/file
    crafted: true
"""

helps['storage file upload-batch'] = """
type: command
short-summary: Upload files from a local directory to an Azure Storage File Share in a batch operation.
parameters:
  - name: --source -s
    type: string
    short-summary: The directory to upload files from.
  - name: --destination -d
    type: string
    short-summary: The destination of the upload operation.
    long-summary: The destination can be the file share URL or the share name. When the destination is the share URL, the storage account name is parsed from the URL.
  - name: --destination-path
    type: string
    short-summary: The directory where the source data is copied to. If omitted, data is copied to the root directory.
  - name: --pattern
    type: string
    short-summary: The pattern used for file globbing. The supported patterns are '*', '?', '[seq', and '[!seq]'.
  - name: --dryrun
    type: bool
    short-summary: List the files and blobs to be uploaded. No actual data transfer will occur.
  - name: --max-connections
    type: integer
    short-summary: The maximum number of parallel connections to use. Default value is 1.
  - name: --validate-content
    type: bool
    short-summary: If set, calculates an MD5 hash for each range of the file for validation.
    long-summary: >
        The storage service checks the hash of the content that has arrived is identical to the hash that was sent.
        This is mostly valuable for detecting bitflips during transfer if using HTTP instead of HTTPS. This hash is not stored.
examples:
  - name: Upload files from a local directory to an Azure Storage File Share in a batch operation. (autogenerated)
    text: az storage file upload-batch --account-key 00000000 --account-name MyAccount --destination . --source /path/to/file
    crafted: true
"""

helps['storage file url'] = """
type: command
short-summary: Create the url to access a file.
examples:
  - name: Create the url to access a file. (autogenerated)
    text: az storage file url --account-name MyAccount --path path/file.txt --share-name MyShare
    crafted: true
"""

helps['storage logging'] = """
type: group
short-summary: Manage storage service logging information.
"""

helps['storage logging show'] = """
type: command
short-summary: Show logging settings for a storage account.
parameters:
  - name: --services
    short-summary: 'The storage services from which to retrieve logging info: (b)lob (q)ueue (t)able. Can be combined.'
"""

helps['storage logging update'] = """
type: command
short-summary: Update logging settings for a storage account.
parameters:
  - name: --services
    short-summary: 'The storage service(s) for which to update logging info: (b)lob (q)ueue (t)able. Can be combined.'
  - name: --log
    short-summary: 'The operations for which to enable logging: (r)ead (w)rite (d)elete. Can be combined.'
  - name: --retention
    short-summary: Number of days for which to retain logs. 0 to disable.
  - name: --version
    short-summary: Version of the logging schema.
"""

helps['storage message'] = """
type: group
short-summary: Manage queue storage messages.
"""

helps['storage metrics'] = """
type: group
short-summary: Manage storage service metrics.
"""

helps['storage metrics show'] = """
type: command
short-summary: Show metrics settings for a storage account.
parameters:
  - name: --services
    short-summary: 'The storage services from which to retrieve metrics info: (b)lob (q)ueue (t)able. Can be combined.'
  - name: --interval
    short-summary: Filter the set of metrics to retrieve by time interval
examples:
  - name: Show metrics settings for a storage account. (autogenerated)
    text: az storage metrics show --account-key 00000000 --account-name MyAccount
    crafted: true
"""

helps['storage metrics update'] = """
type: command
short-summary: Update metrics settings for a storage account.
parameters:
  - name: --services
    short-summary: 'The storage services from which to retrieve metrics info: (b)lob (q)ueue (t)able. Can be combined.'
  - name: --hour
    short-summary: Update the hourly metrics
  - name: --minute
    short-summary: Update the by-minute metrics
  - name: --api
    short-summary: Specify whether to include API in metrics. Applies to both hour and minute metrics if both are specified. Must be specified if hour or minute metrics are enabled and being updated.
  - name: --retention
    short-summary: Number of days for which to retain metrics. 0 to disable. Applies to both hour and minute metrics if both are specified.
examples:
  - name: Update metrics settings for a storage account. (autogenerated)
    text: az storage metrics update --account-name MyAccount --api true --hour true --minute true --retention 10 --services bfqt
    crafted: true
"""

helps['storage queue'] = """
type: group
short-summary: Manage storage queues.
"""

helps['storage queue list'] = """
type: command
short-summary: List queues in a storage account.
"""

helps['storage queue metadata'] = """
type: group
short-summary: Manage the metadata for a storage queue.
"""

helps['storage queue policy'] = """
type: group
short-summary: Manage shared access policies for a storage queue.
"""

helps['storage remove'] = """
type: command
short-summary: Delete blobs or files from Azure Storage.
long-summary: To delete blobs, both the source must either be public or be authenticated by using a shared access signature. Remove command depends on Azcopy, which only works for 64-bit Operating System now. We will support 32-bit Operating System soon.
examples:
  - name: Remove a single blob.
    text: az storage remove -c MyContainer -n MyBlob
  - name: Remove an entire virtual directory.
    text: az storage remove -c MyContainer -n path/to/directory --recursive
  - name: Remove only the top blobs inside a virtual directory but not its sub-directories.
    text: az storage remove -c MyContainer -n path/to/directory
  - name: Remove a subset of blobs in a virtual directory (For example, only jpg and pdf files, or if the blob name is "exactName").
    text: az storage remove -c MyContainer -n path/to/directory --recursive --include "*.jpg;*.pdf;exactName"
  - name: Remove an entire virtual directory but exclude certain blobs from the scope (For example, every blob that starts with foo or ends with bar).
    text: az storage remove -c MyContainer -n path/to/directory --recursive --include "foo*;*bar"
  - name: Remove a single file.
    text: az storage remove -s MyShare -p MyFile
  - name: Remove an entire directory.
    text: az storage remove -s MyShare -p path/to/directory --recursive
"""

helps['storage share'] = """
type: group
short-summary: Manage file shares.
"""

helps['storage share create'] = """
type: command
short-summary: Creates a new share under the specified account.
examples:
  - name: Creates a new share under the specified account. (autogenerated)
    text: az storage share create --name MyFileShare
    crafted: true
"""

helps['storage share exists'] = """
type: command
short-summary: Check for the existence of a file share.
examples:
  - name: Check for the existence of a file share. (autogenerated)
    text: az storage share exists --account-key 00000000 --account-name MyAccount --name MyFileShare
    crafted: true
"""

helps['storage share generate-sas'] = """
type: command
examples:
  - name: Generate a sas token for a fileshare and use it to upload a file.
    text: |
        end=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
        sas=`az storage share generate-sas -n MyShare --account-name MyStorageAccount --https-only --permissions dlrw --expiry $end -o tsv`
        az storage file upload -s MyShare --account-name MyStorageAccount --source file.txt  --sas-token $sas
  - name: Generates a shared access signature for the share. (autogenerated)
    text: az storage share generate-sas --account-key 00000000 --account-name MyStorageAccount --expiry 2037-12-31T23:59:00Z --name MyShare --permissions dlrw
    crafted: true
  - name: Generates a shared access signature for the share. (autogenerated)
    text: az storage share generate-sas --connection-string $connectionString --expiry 2019-02-01T12:20Z --name MyShare --permissions dlrw
    crafted: true
"""

helps['storage share list'] = """
type: command
short-summary: List the file shares in a storage account.
"""

helps['storage share metadata'] = """
type: group
short-summary: Manage the metadata of a file share.
"""

helps['storage share policy'] = """
type: group
short-summary: Manage shared access policies of a storage file share.
"""

helps['storage share url'] = """
type: command
short-summary: Create a URI to access a file share.
examples:
  - name: Create a URI to access a file share. (autogenerated)
    text: az storage share url --account-key 00000000 --account-name MyAccount --name MyFileShare
    crafted: true
"""

helps['storage table'] = """
type: group
short-summary: Manage NoSQL key-value storage.
"""

helps['storage table list'] = """
type: command
short-summary: List tables in a storage account.
"""

helps['storage table policy'] = """
type: group
short-summary: Manage shared access policies of a storage table.
"""
