Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@
short-summary: The max length in bytes permitted for an append blob.
- name: --lease-id
short-summary: Required if the blob has an active lease
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 download-batch'] = """
Expand All @@ -311,6 +314,9 @@
- 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 delete-batch'] = """
Expand All @@ -337,7 +343,11 @@
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 copy start-batch'] = """
Expand Down Expand Up @@ -799,4 +809,47 @@
- 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.
text: |
end=`date -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 -otsv
"""

helps['storage container generate-sas'] = """
type: command
examples:
- name: Generate a sas token for blob container and use it to upload a blob.
text: |
end=`date -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 -otsv`
az storage blob upload -n MyBlob -c MyContainer --account-name MyStorageAccount -f file.txt --sas-token $sas
"""

helps['storage blob generate-sas'] = """
type: command
examples:
- name: Generate a sas token for a blob with read-only permissions.
text: |
end=`date -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
"""

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 -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 -otsv`
az storage file upload -s MyShare --account-name MyStorageAccount --source file.txt --sas-token $sas
"""

helps['storage file generate-sas'] = """
type: command
examples:
- name: Generate a sas token for a file.
text: |
end=`date -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
"""
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
c.argument('timeout', help='Request timeout in seconds. Applies to each call to the service.', type=int)

with self.argument_context('storage', arg_group='Precondition') as c:
c.argument('if_modified_since', help='Alter only if modified since supplied UTC datetime (Y-m-d\'T\'H:M\'Z\')',
c.argument('if_modified_since',
help='Commence only if modified since supplied UTC datetime (Y-m-d\'T\'H:M\'Z\')',
type=get_datetime_type(False))
c.argument('if_unmodified_since',
help='Alter only if unmodified since supplied UTC datetime (Y-m-d\'T\'H:M\'Z\')',
help='Commence only if unmodified since supplied UTC datetime (Y-m-d\'T\'H:M\'Z\')',
type=get_datetime_type(False))
c.argument('if_match')
c.argument('if_none_match')
Expand Down