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 @@ -55,6 +55,8 @@
from .legal_hold_py3 import LegalHold
from .list_container_item_py3 import ListContainerItem
from .list_container_items_py3 import ListContainerItems
from .lease_container_request_py3 import LeaseContainerRequest
from .lease_container_response_py3 import LeaseContainerResponse
except (SyntaxError, ImportError):
from .operation_display import OperationDisplay
from .dimension import Dimension
Expand Down Expand Up @@ -101,6 +103,8 @@
from .legal_hold import LegalHold
from .list_container_item import ListContainerItem
from .list_container_items import ListContainerItems
from .lease_container_request import LeaseContainerRequest
from .lease_container_response import LeaseContainerResponse
from .operation_paged import OperationPaged
from .sku_paged import SkuPaged
from .storage_account_paged import StorageAccountPaged
Expand Down Expand Up @@ -180,6 +184,8 @@
'LegalHold',
'ListContainerItem',
'ListContainerItems',
'LeaseContainerRequest',
'LeaseContainerResponse',
'OperationPaged',
'SkuPaged',
'StorageAccountPaged',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class LeaseContainerRequest(Model):
"""Lease Container request schema.

All required parameters must be populated in order to send to Azure.

:param action: Required. Specifies the lease action. Can be one of the
available actions. Possible values include: 'Acquire', 'Renew', 'Change',
'Release', 'Break'
:type action: str or ~azure.mgmt.storage.v2018_02_01.models.enum
:param lease_id: Identifies the lease. Can be specified in any valid GUID
string format.
:type lease_id: str
:param break_period: Optional. For a break action, proposed duration the
lease should continue before it is broken, in seconds, between 0 and 60.
:type break_period: int
:param lease_duration: Required for acquire. Specifies the duration of the
lease, in seconds, or negative one (-1) for a lease that never expires.
:type lease_duration: int
:param proposed_lease_id: Optional for acquire, required for change.
Proposed lease ID, in a GUID string format.
:type proposed_lease_id: str
"""

_validation = {
'action': {'required': True},
}

_attribute_map = {
'action': {'key': 'action', 'type': 'str'},
'lease_id': {'key': 'leaseId', 'type': 'str'},
'break_period': {'key': 'breakPeriod', 'type': 'int'},
'lease_duration': {'key': 'leaseDuration', 'type': 'int'},
'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'},
}

def __init__(self, **kwargs):
super(LeaseContainerRequest, self).__init__(**kwargs)
self.action = kwargs.get('action', None)
self.lease_id = kwargs.get('lease_id', None)
self.break_period = kwargs.get('break_period', None)
self.lease_duration = kwargs.get('lease_duration', None)
self.proposed_lease_id = kwargs.get('proposed_lease_id', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class LeaseContainerRequest(Model):
"""Lease Container request schema.

All required parameters must be populated in order to send to Azure.

:param action: Required. Specifies the lease action. Can be one of the
available actions. Possible values include: 'Acquire', 'Renew', 'Change',
'Release', 'Break'
:type action: str or ~azure.mgmt.storage.v2018_02_01.models.enum
:param lease_id: Identifies the lease. Can be specified in any valid GUID
string format.
:type lease_id: str
:param break_period: Optional. For a break action, proposed duration the
lease should continue before it is broken, in seconds, between 0 and 60.
:type break_period: int
:param lease_duration: Required for acquire. Specifies the duration of the
lease, in seconds, or negative one (-1) for a lease that never expires.
:type lease_duration: int
:param proposed_lease_id: Optional for acquire, required for change.
Proposed lease ID, in a GUID string format.
:type proposed_lease_id: str
"""

_validation = {
'action': {'required': True},
}

_attribute_map = {
'action': {'key': 'action', 'type': 'str'},
'lease_id': {'key': 'leaseId', 'type': 'str'},
'break_period': {'key': 'breakPeriod', 'type': 'int'},
'lease_duration': {'key': 'leaseDuration', 'type': 'int'},
'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'},
}

def __init__(self, *, action, lease_id: str=None, break_period: int=None, lease_duration: int=None, proposed_lease_id: str=None, **kwargs) -> None:
super(LeaseContainerRequest, self).__init__(**kwargs)
self.action = action
self.lease_id = lease_id
self.break_period = break_period
self.lease_duration = lease_duration
self.proposed_lease_id = proposed_lease_id
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class LeaseContainerResponse(Model):
"""Lease Container response schema.

:param lease_id: Returned unique lease ID that must be included with any
request to delete the container, or to renew, change, or release the
lease.
:type lease_id: str
:param lease_time_seconds: Approximate time remaining in the lease period,
in seconds.
:type lease_time_seconds: str
"""

_attribute_map = {
'lease_id': {'key': 'leaseId', 'type': 'str'},
'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'},
}

def __init__(self, **kwargs):
super(LeaseContainerResponse, self).__init__(**kwargs)
self.lease_id = kwargs.get('lease_id', None)
self.lease_time_seconds = kwargs.get('lease_time_seconds', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class LeaseContainerResponse(Model):
"""Lease Container response schema.

:param lease_id: Returned unique lease ID that must be included with any
request to delete the container, or to renew, change, or release the
lease.
:type lease_id: str
:param lease_time_seconds: Approximate time remaining in the lease period,
in seconds.
:type lease_time_seconds: str
"""

_attribute_map = {
'lease_id': {'key': 'leaseId', 'type': 'str'},
'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'},
}

def __init__(self, *, lease_id: str=None, lease_time_seconds: str=None, **kwargs) -> None:
super(LeaseContainerResponse, self).__init__(**kwargs)
self.lease_id = lease_id
self.lease_time_seconds = lease_time_seconds
Original file line number Diff line number Diff line change
Expand Up @@ -1042,3 +1042,87 @@ def extend_immutability_policy(

return deserialized
extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'}

def lease(
self, resource_group_name, account_name, container_name, parameters=None, custom_headers=None, raw=False, **operation_config):
"""The Lease Container operation establishes and manages a lock on a
container for delete operations. The lock duration can be 15 to 60
seconds, or can be infinite.

:param resource_group_name: The name of the resource group within the
user's subscription. The name is case insensitive.
:type resource_group_name: str
:param account_name: The name of the storage account within the
specified resource group. Storage account names must be between 3 and
24 characters in length and use numbers and lower-case letters only.
:type account_name: str
:param container_name: The name of the blob container within the
specified storage account. Blob container names must be between 3 and
63 characters in length and use numbers, lower-case letters and dash
(-) only. Every dash (-) character must be immediately preceded and
followed by a letter or number.
:type container_name: str
:param parameters: Lease Container request body.
:type parameters:
~azure.mgmt.storage.v2018_02_01.models.LeaseContainerRequest
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: LeaseContainerResponse or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.storage.v2018_02_01.models.LeaseContainerResponse
or ~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.lease.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3),
'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1)
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1)

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct body
if parameters is not None:
body_content = self._serialize.body(parameters, 'LeaseContainerRequest')
else:
body_content = None

# Construct and send request
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp

deserialized = None

if response.status_code == 200:
deserialized = self._deserialize('LeaseContainerResponse', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized
lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
from .legal_hold_py3 import LegalHold
from .list_container_item_py3 import ListContainerItem
from .list_container_items_py3 import ListContainerItems
from .lease_container_request_py3 import LeaseContainerRequest
from .lease_container_response_py3 import LeaseContainerResponse
except (SyntaxError, ImportError):
from .operation_display import OperationDisplay
from .dimension import Dimension
Expand Down Expand Up @@ -105,6 +107,8 @@
from .legal_hold import LegalHold
from .list_container_item import ListContainerItem
from .list_container_items import ListContainerItems
from .lease_container_request import LeaseContainerRequest
from .lease_container_response import LeaseContainerResponse
from .operation_paged import OperationPaged
from .sku_paged import SkuPaged
from .storage_account_paged import StorageAccountPaged
Expand Down Expand Up @@ -186,6 +190,8 @@
'LegalHold',
'ListContainerItem',
'ListContainerItems',
'LeaseContainerRequest',
'LeaseContainerResponse',
'OperationPaged',
'SkuPaged',
'StorageAccountPaged',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class LeaseContainerRequest(Model):
"""Lease Container request schema.

All required parameters must be populated in order to send to Azure.

:param action: Required. Specifies the lease action. Can be one of the
available actions. Possible values include: 'Acquire', 'Renew', 'Change',
'Release', 'Break'
:type action: str or ~azure.mgmt.storage.v2018_03_01_preview.models.enum
:param lease_id: Identifies the lease. Can be specified in any valid GUID
string format.
:type lease_id: str
:param break_period: Optional. For a break action, proposed duration the
lease should continue before it is broken, in seconds, between 0 and 60.
:type break_period: int
:param lease_duration: Required for acquire. Specifies the duration of the
lease, in seconds, or negative one (-1) for a lease that never expires.
:type lease_duration: int
:param proposed_lease_id: Optional for acquire, required for change.
Proposed lease ID, in a GUID string format.
:type proposed_lease_id: str
"""

_validation = {
'action': {'required': True},
}

_attribute_map = {
'action': {'key': 'action', 'type': 'str'},
'lease_id': {'key': 'leaseId', 'type': 'str'},
'break_period': {'key': 'breakPeriod', 'type': 'int'},
'lease_duration': {'key': 'leaseDuration', 'type': 'int'},
'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'},
}

def __init__(self, **kwargs):
super(LeaseContainerRequest, self).__init__(**kwargs)
self.action = kwargs.get('action', None)
self.lease_id = kwargs.get('lease_id', None)
self.break_period = kwargs.get('break_period', None)
self.lease_duration = kwargs.get('lease_duration', None)
self.proposed_lease_id = kwargs.get('proposed_lease_id', None)
Loading