id
int64 0
843k
| repository_name
stringlengths 7
55
| file_path
stringlengths 9
332
| class_name
stringlengths 3
290
| human_written_code
stringlengths 12
4.36M
| class_skeleton
stringlengths 19
2.2M
| total_program_units
int64 1
9.57k
| total_doc_str
int64 0
4.2k
| AvgCountLine
float64 0
7.89k
| AvgCountLineBlank
float64 0
300
| AvgCountLineCode
float64 0
7.89k
| AvgCountLineComment
float64 0
7.89k
| AvgCyclomatic
float64 0
130
| CommentToCodeRatio
float64 0
176
| CountClassBase
float64 0
48
| CountClassCoupled
float64 0
589
| CountClassCoupledModified
float64 0
581
| CountClassDerived
float64 0
5.37k
| CountDeclInstanceMethod
float64 0
4.2k
| CountDeclInstanceVariable
float64 0
299
| CountDeclMethod
float64 0
4.2k
| CountDeclMethodAll
float64 0
4.2k
| CountLine
float64 1
115k
| CountLineBlank
float64 0
9.01k
| CountLineCode
float64 0
94.4k
| CountLineCodeDecl
float64 0
46.1k
| CountLineCodeExe
float64 0
91.3k
| CountLineComment
float64 0
27k
| CountStmt
float64 1
93.2k
| CountStmtDecl
float64 0
46.1k
| CountStmtExe
float64 0
90.2k
| MaxCyclomatic
float64 0
759
| MaxInheritanceTree
float64 0
16
| MaxNesting
float64 0
34
| SumCyclomatic
float64 0
6k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10,500 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlUserDefinedFunctionListResult
|
class SqlUserDefinedFunctionListResult(_serialization.Model):
"""The List operation response, that contains the userDefinedFunctions and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of userDefinedFunctions and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults]
"""
_validation = {
"value": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[SqlUserDefinedFunctionGetResults]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
|
class SqlUserDefinedFunctionListResult(_serialization.Model):
'''The List operation response, that contains the userDefinedFunctions and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of userDefinedFunctions and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults]
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 4 | 0 | 3 | 1 | 1 | 0.6 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 16 | 21 | 5 | 10 | 5 | 8 | 6 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,501 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlUserDefinedFunctionResource
|
class SqlUserDefinedFunctionResource(_serialization.Model):
"""Cosmos DB SQL userDefinedFunction resource object.
All required parameters must be populated in order to send to server.
:ivar id: Name of the Cosmos DB SQL userDefinedFunction. Required.
:vartype id: str
:ivar body: Body of the User Defined Function.
:vartype body: str
"""
_validation = {
"id": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"body": {"key": "body", "type": "str"},
}
def __init__(
self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin
) -> None:
"""
:keyword id: Name of the Cosmos DB SQL userDefinedFunction. Required.
:paramtype id: str
:keyword body: Body of the User Defined Function.
:paramtype body: str
"""
super().__init__(**kwargs)
self.id = id
self.body = body
|
class SqlUserDefinedFunctionResource(_serialization.Model):
'''Cosmos DB SQL userDefinedFunction resource object.
All required parameters must be populated in order to send to server.
:ivar id: Name of the Cosmos DB SQL userDefinedFunction. Required.
:vartype id: str
:ivar body: Body of the User Defined Function.
:vartype body: str
'''
def __init__(
self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin
) -> None:
'''
:keyword id: Name of the Cosmos DB SQL userDefinedFunction. Required.
:paramtype id: str
:keyword body: Body of the User Defined Function.
:paramtype body: str
'''
pass
| 2 | 2 | 12 | 0 | 6 | 7 | 1 | 1 | 1 | 3 | 0 | 1 | 1 | 2 | 1 | 16 | 32 | 5 | 14 | 8 | 10 | 14 | 7 | 6 | 5 | 1 | 2 | 0 | 1 |
10,502 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SystemData
|
class SystemData(_serialization.Model):
"""Metadata pertaining to creation and last modification of the resource.
:ivar created_by: The identity that created the resource.
:vartype created_by: str
:ivar created_by_type: The type of identity that created the resource. Known values are:
"User", "Application", "ManagedIdentity", and "Key".
:vartype created_by_type: str or ~azure.mgmt.cosmosdb.models.CreatedByType
:ivar created_at: The timestamp of resource creation (UTC).
:vartype created_at: ~datetime.datetime
:ivar last_modified_by: The identity that last modified the resource.
:vartype last_modified_by: str
:ivar last_modified_by_type: The type of identity that last modified the resource. Known values
are: "User", "Application", "ManagedIdentity", and "Key".
:vartype last_modified_by_type: str or ~azure.mgmt.cosmosdb.models.CreatedByType
:ivar last_modified_at: The timestamp of resource last modification (UTC).
:vartype last_modified_at: ~datetime.datetime
"""
_attribute_map = {
"created_by": {"key": "createdBy", "type": "str"},
"created_by_type": {"key": "createdByType", "type": "str"},
"created_at": {"key": "createdAt", "type": "iso-8601"},
"last_modified_by": {"key": "lastModifiedBy", "type": "str"},
"last_modified_by_type": {"key": "lastModifiedByType", "type": "str"},
"last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"},
}
def __init__(
self,
*,
created_by: Optional[str] = None,
created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
created_at: Optional[datetime.datetime] = None,
last_modified_by: Optional[str] = None,
last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
last_modified_at: Optional[datetime.datetime] = None,
**kwargs: Any
) -> None:
"""
:keyword created_by: The identity that created the resource.
:paramtype created_by: str
:keyword created_by_type: The type of identity that created the resource. Known values are:
"User", "Application", "ManagedIdentity", and "Key".
:paramtype created_by_type: str or ~azure.mgmt.cosmosdb.models.CreatedByType
:keyword created_at: The timestamp of resource creation (UTC).
:paramtype created_at: ~datetime.datetime
:keyword last_modified_by: The identity that last modified the resource.
:paramtype last_modified_by: str
:keyword last_modified_by_type: The type of identity that last modified the resource. Known
values are: "User", "Application", "ManagedIdentity", and "Key".
:paramtype last_modified_by_type: str or ~azure.mgmt.cosmosdb.models.CreatedByType
:keyword last_modified_at: The timestamp of resource last modification (UTC).
:paramtype last_modified_at: ~datetime.datetime
"""
super().__init__(**kwargs)
self.created_by = created_by
self.created_by_type = created_by_type
self.created_at = created_at
self.last_modified_by = last_modified_by
self.last_modified_by_type = last_modified_by_type
self.last_modified_at = last_modified_at
|
class SystemData(_serialization.Model):
'''Metadata pertaining to creation and last modification of the resource.
:ivar created_by: The identity that created the resource.
:vartype created_by: str
:ivar created_by_type: The type of identity that created the resource. Known values are:
"User", "Application", "ManagedIdentity", and "Key".
:vartype created_by_type: str or ~azure.mgmt.cosmosdb.models.CreatedByType
:ivar created_at: The timestamp of resource creation (UTC).
:vartype created_at: ~datetime.datetime
:ivar last_modified_by: The identity that last modified the resource.
:vartype last_modified_by: str
:ivar last_modified_by_type: The type of identity that last modified the resource. Known values
are: "User", "Application", "ManagedIdentity", and "Key".
:vartype last_modified_by_type: str or ~azure.mgmt.cosmosdb.models.CreatedByType
:ivar last_modified_at: The timestamp of resource last modification (UTC).
:vartype last_modified_at: ~datetime.datetime
'''
def __init__(
self,
*,
created_by: Optional[str] = None,
created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
created_at: Optional[datetime.datetime] = None,
last_modified_by: Optional[str] = None,
last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
last_modified_at: Optional[datetime.datetime] = None,
**kwargs: Any
) -> None:
'''
:keyword created_by: The identity that created the resource.
:paramtype created_by: str
:keyword created_by_type: The type of identity that created the resource. Known values are:
"User", "Application", "ManagedIdentity", and "Key".
:paramtype created_by_type: str or ~azure.mgmt.cosmosdb.models.CreatedByType
:keyword created_at: The timestamp of resource creation (UTC).
:paramtype created_at: ~datetime.datetime
:keyword last_modified_by: The identity that last modified the resource.
:paramtype last_modified_by: str
:keyword last_modified_by_type: The type of identity that last modified the resource. Known
values are: "User", "Application", "ManagedIdentity", and "Key".
:paramtype last_modified_by_type: str or ~azure.mgmt.cosmosdb.models.CreatedByType
:keyword last_modified_at: The timestamp of resource last modification (UTC).
:paramtype last_modified_at: ~datetime.datetime
'''
pass
| 2 | 2 | 34 | 0 | 18 | 16 | 1 | 1.19 | 1 | 4 | 0 | 0 | 1 | 6 | 1 | 16 | 62 | 3 | 27 | 19 | 15 | 32 | 10 | 9 | 8 | 1 | 2 | 0 | 1 |
10,503 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.TableCreateUpdateParameters
|
class TableCreateUpdateParameters(ARMResourceProperties):
"""Parameters to create and update Cosmos DB Table.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource: The standard JSON format of a Table. Required.
:vartype resource: ~azure.mgmt.cosmosdb.models.TableResource
:ivar options: A key-value pair of options to be applied for the request. This corresponds to
the headers sent with the request.
:vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"resource": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"location": {"key": "location", "type": "str"},
"tags": {"key": "tags", "type": "{str}"},
"identity": {"key": "identity", "type": "ManagedServiceIdentity"},
"resource": {"key": "properties.resource", "type": "TableResource"},
"options": {"key": "properties.options", "type": "CreateUpdateOptions"},
}
def __init__(
self,
*,
resource: "_models.TableResource",
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
options: Optional["_models.CreateUpdateOptions"] = None,
**kwargs: Any
) -> None:
"""
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource: The standard JSON format of a Table. Required.
:paramtype resource: ~azure.mgmt.cosmosdb.models.TableResource
:keyword options: A key-value pair of options to be applied for the request. This corresponds
to the headers sent with the request.
:paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
"""
super().__init__(location=location, tags=tags, identity=identity, **kwargs)
self.resource = resource
self.options = options
|
class TableCreateUpdateParameters(ARMResourceProperties):
'''Parameters to create and update Cosmos DB Table.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource: The standard JSON format of a Table. Required.
:vartype resource: ~azure.mgmt.cosmosdb.models.TableResource
:ivar options: A key-value pair of options to be applied for the request. This corresponds to
the headers sent with the request.
:vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
'''
def __init__(
self,
*,
resource: "_models.TableResource",
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
options: Optional["_models.CreateUpdateOptions"] = None,
**kwargs: Any
) -> None:
'''
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource: The standard JSON format of a Table. Required.
:paramtype resource: ~azure.mgmt.cosmosdb.models.TableResource
:keyword options: A key-value pair of options to be applied for the request. This corresponds
to the headers sent with the request.
:paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
'''
pass
| 2 | 2 | 31 | 0 | 13 | 18 | 1 | 1.47 | 1 | 3 | 0 | 0 | 1 | 2 | 1 | 17 | 80 | 6 | 30 | 15 | 19 | 44 | 7 | 6 | 5 | 1 | 3 | 0 | 1 |
10,504 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.TableGetPropertiesOptions
|
class TableGetPropertiesOptions(OptionsResource):
"""TableGetPropertiesOptions.
:ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the
ThroughputSetting resource when retrieving offer details.
:vartype throughput: int
:ivar autoscale_settings: Specifies the Autoscale settings.
:vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings
"""
|
class TableGetPropertiesOptions(OptionsResource):
'''TableGetPropertiesOptions.
:ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the
ThroughputSetting resource when retrieving offer details.
:vartype throughput: int
:ivar autoscale_settings: Specifies the Autoscale settings.
:vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings
'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 7 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 16 | 9 | 1 | 1 | 1 | 0 | 7 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
10,505 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.TableGetPropertiesResource
|
class TableGetPropertiesResource(TableResource, ExtendedResourceProperties):
"""TableGetPropertiesResource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar rid: A system generated property. A unique identifier.
:vartype rid: str
:ivar ts: A system generated property that denotes the last updated timestamp of the resource.
:vartype ts: float
:ivar etag: A system generated property representing the resource etag required for optimistic
concurrency control.
:vartype etag: str
:ivar id: Name of the Cosmos DB table. Required.
:vartype id: str
:ivar restore_parameters: Parameters to indicate the information about the restore.
:vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters
:ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default"
and "Restore".
:vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode
"""
_validation = {
"rid": {"readonly": True},
"ts": {"readonly": True},
"etag": {"readonly": True},
"id": {"required": True},
}
_attribute_map = {
"rid": {"key": "_rid", "type": "str"},
"ts": {"key": "_ts", "type": "float"},
"etag": {"key": "_etag", "type": "str"},
"id": {"key": "id", "type": "str"},
"restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"},
"create_mode": {"key": "createMode", "type": "str"},
}
def __init__(
self,
*,
id: str, # pylint: disable=redefined-builtin
restore_parameters: Optional["_models.ResourceRestoreParameters"] = None,
create_mode: Union[str, "_models.CreateMode"] = "Default",
**kwargs: Any
) -> None:
"""
:keyword id: Name of the Cosmos DB table. Required.
:paramtype id: str
:keyword restore_parameters: Parameters to indicate the information about the restore.
:paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters
:keyword create_mode: Enum to indicate the mode of resource creation. Known values are:
"Default" and "Restore".
:paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode
"""
super().__init__(id=id, restore_parameters=restore_parameters, create_mode=create_mode, **kwargs)
self.rid = None
self.ts = None
self.etag = None
self.id = id
self.restore_parameters = restore_parameters
self.create_mode = create_mode
|
class TableGetPropertiesResource(TableResource, ExtendedResourceProperties):
'''TableGetPropertiesResource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar rid: A system generated property. A unique identifier.
:vartype rid: str
:ivar ts: A system generated property that denotes the last updated timestamp of the resource.
:vartype ts: float
:ivar etag: A system generated property representing the resource etag required for optimistic
concurrency control.
:vartype etag: str
:ivar id: Name of the Cosmos DB table. Required.
:vartype id: str
:ivar restore_parameters: Parameters to indicate the information about the restore.
:vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters
:ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default"
and "Restore".
:vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode
'''
def __init__(
self,
*,
id: str, # pylint: disable=redefined-builtin
restore_parameters: Optional["_models.ResourceRestoreParameters"] = None,
create_mode: Union[str, "_models.CreateMode"] = "Default",
**kwargs: Any
) -> None:
'''
:keyword id: Name of the Cosmos DB table. Required.
:paramtype id: str
:keyword restore_parameters: Parameters to indicate the information about the restore.
:paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters
:keyword create_mode: Enum to indicate the mode of resource creation. Known values are:
"Default" and "Restore".
:paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode
'''
pass
| 2 | 2 | 24 | 0 | 15 | 10 | 1 | 0.93 | 2 | 3 | 0 | 0 | 1 | 6 | 1 | 18 | 63 | 6 | 30 | 17 | 21 | 28 | 11 | 10 | 9 | 1 | 3 | 0 | 1 |
10,506 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.TableGetResults
|
class TableGetResults(ARMResourceProperties):
"""An Azure Cosmos DB Table.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource:
:vartype resource: ~azure.mgmt.cosmosdb.models.TableGetPropertiesResource
:ivar options:
:vartype options: ~azure.mgmt.cosmosdb.models.TableGetPropertiesOptions
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"location": {"key": "location", "type": "str"},
"tags": {"key": "tags", "type": "{str}"},
"identity": {"key": "identity", "type": "ManagedServiceIdentity"},
"resource": {"key": "properties.resource", "type": "TableGetPropertiesResource"},
"options": {"key": "properties.options", "type": "TableGetPropertiesOptions"},
}
def __init__(
self,
*,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
resource: Optional["_models.TableGetPropertiesResource"] = None,
options: Optional["_models.TableGetPropertiesOptions"] = None,
**kwargs: Any
) -> None:
"""
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource:
:paramtype resource: ~azure.mgmt.cosmosdb.models.TableGetPropertiesResource
:keyword options:
:paramtype options: ~azure.mgmt.cosmosdb.models.TableGetPropertiesOptions
"""
super().__init__(location=location, tags=tags, identity=identity, **kwargs)
self.resource = resource
self.options = options
|
class TableGetResults(ARMResourceProperties):
'''An Azure Cosmos DB Table.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource:
:vartype resource: ~azure.mgmt.cosmosdb.models.TableGetPropertiesResource
:ivar options:
:vartype options: ~azure.mgmt.cosmosdb.models.TableGetPropertiesOptions
'''
def __init__(
self,
*,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
resource: Optional["_models.TableGetPropertiesResource"] = None,
options: Optional["_models.TableGetPropertiesOptions"] = None,
**kwargs: Any
) -> None:
'''
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource:
:paramtype resource: ~azure.mgmt.cosmosdb.models.TableGetPropertiesResource
:keyword options:
:paramtype options: ~azure.mgmt.cosmosdb.models.TableGetPropertiesOptions
'''
pass
| 2 | 2 | 30 | 0 | 13 | 17 | 1 | 1.41 | 1 | 3 | 0 | 0 | 1 | 2 | 1 | 17 | 75 | 5 | 29 | 15 | 18 | 41 | 7 | 6 | 5 | 1 | 3 | 0 | 1 |
10,507 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.TableListResult
|
class TableListResult(_serialization.Model):
"""The List operation response, that contains the Table and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of Table and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.TableGetResults]
"""
_validation = {
"value": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[TableGetResults]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
|
class TableListResult(_serialization.Model):
'''The List operation response, that contains the Table and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of Table and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.TableGetResults]
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 4 | 0 | 3 | 1 | 1 | 0.6 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 16 | 21 | 5 | 10 | 5 | 8 | 6 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,508 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.TableResource
|
class TableResource(_serialization.Model):
"""Cosmos DB table resource object.
All required parameters must be populated in order to send to server.
:ivar id: Name of the Cosmos DB table. Required.
:vartype id: str
:ivar restore_parameters: Parameters to indicate the information about the restore.
:vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters
:ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default"
and "Restore".
:vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode
"""
_validation = {
"id": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"},
"create_mode": {"key": "createMode", "type": "str"},
}
def __init__(
self,
*,
id: str, # pylint: disable=redefined-builtin
restore_parameters: Optional["_models.ResourceRestoreParameters"] = None,
create_mode: Union[str, "_models.CreateMode"] = "Default",
**kwargs: Any
) -> None:
"""
:keyword id: Name of the Cosmos DB table. Required.
:paramtype id: str
:keyword restore_parameters: Parameters to indicate the information about the restore.
:paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters
:keyword create_mode: Enum to indicate the mode of resource creation. Known values are:
"Default" and "Restore".
:paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode
"""
super().__init__(**kwargs)
self.id = id
self.restore_parameters = restore_parameters
self.create_mode = create_mode
|
class TableResource(_serialization.Model):
'''Cosmos DB table resource object.
All required parameters must be populated in order to send to server.
:ivar id: Name of the Cosmos DB table. Required.
:vartype id: str
:ivar restore_parameters: Parameters to indicate the information about the restore.
:vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters
:ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default"
and "Restore".
:vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode
'''
def __init__(
self,
*,
id: str, # pylint: disable=redefined-builtin
restore_parameters: Optional["_models.ResourceRestoreParameters"] = None,
create_mode: Union[str, "_models.CreateMode"] = "Default",
**kwargs: Any
) -> None:
'''
:keyword id: Name of the Cosmos DB table. Required.
:paramtype id: str
:keyword restore_parameters: Parameters to indicate the information about the restore.
:paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters
:keyword create_mode: Enum to indicate the mode of resource creation. Known values are:
"Default" and "Restore".
:paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode
'''
pass
| 2 | 2 | 21 | 0 | 12 | 10 | 1 | 0.95 | 1 | 3 | 0 | 1 | 1 | 3 | 1 | 16 | 45 | 5 | 21 | 14 | 12 | 20 | 8 | 7 | 6 | 1 | 2 | 0 | 1 |
10,509 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.TableRoleAssignmentListResult
|
class TableRoleAssignmentListResult(_serialization.Model):
"""The relevant Role Assignments.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of Role Assignments and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource]
:ivar next_link: The link used to get the next page of results.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[TableRoleAssignmentResource]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
|
class TableRoleAssignmentListResult(_serialization.Model):
'''The relevant Role Assignments.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of Role Assignments and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource]
:ivar next_link: The link used to get the next page of results.
:vartype next_link: str
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 5 | 0 | 4 | 1 | 1 | 0.62 | 1 | 2 | 0 | 0 | 1 | 2 | 1 | 16 | 26 | 5 | 13 | 6 | 11 | 8 | 7 | 6 | 5 | 1 | 2 | 0 | 1 |
10,510 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.TableRoleAssignmentResource
|
class TableRoleAssignmentResource(ProxyResource):
"""Parameters to create and update an Azure Cosmos DB Table Role Assignment.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. E.g.
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData
:ivar role_definition_id: The unique identifier for the associated Role Definition.
:vartype role_definition_id: str
:ivar scope: The data plane resource path for which access is being granted through this Table
Role Assignment.
:vartype scope: str
:ivar principal_id: The unique identifier for the associated AAD principal in the AAD graph to
which access is being granted through this Table Role Assignment. Tenant ID for the principal
is inferred using the tenant associated with the subscription.
:vartype principal_id: str
:ivar provisioning_state: Provisioning state of the resource.
:vartype provisioning_state: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"system_data": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"system_data": {"key": "systemData", "type": "SystemData"},
"role_definition_id": {"key": "properties.roleDefinitionId", "type": "str"},
"scope": {"key": "properties.scope", "type": "str"},
"principal_id": {"key": "properties.principalId", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
}
def __init__(
self,
*,
role_definition_id: Optional[str] = None,
scope: Optional[str] = None,
principal_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword role_definition_id: The unique identifier for the associated Role Definition.
:paramtype role_definition_id: str
:keyword scope: The data plane resource path for which access is being granted through this
Table Role Assignment.
:paramtype scope: str
:keyword principal_id: The unique identifier for the associated AAD principal in the AAD graph
to which access is being granted through this Table Role Assignment. Tenant ID for the
principal is inferred using the tenant associated with the subscription.
:paramtype principal_id: str
"""
super().__init__(**kwargs)
self.role_definition_id = role_definition_id
self.scope = scope
self.principal_id = principal_id
self.provisioning_state = None
|
class TableRoleAssignmentResource(ProxyResource):
'''Parameters to create and update an Azure Cosmos DB Table Role Assignment.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. E.g.
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData
:ivar role_definition_id: The unique identifier for the associated Role Definition.
:vartype role_definition_id: str
:ivar scope: The data plane resource path for which access is being granted through this Table
Role Assignment.
:vartype scope: str
:ivar principal_id: The unique identifier for the associated AAD principal in the AAD graph to
which access is being granted through this Table Role Assignment. Tenant ID for the principal
is inferred using the tenant associated with the subscription.
:vartype principal_id: str
:ivar provisioning_state: Provisioning state of the resource.
:vartype provisioning_state: str
'''
def __init__(
self,
*,
role_definition_id: Optional[str] = None,
scope: Optional[str] = None,
principal_id: Optional[str] = None,
**kwargs: Any
) -> None:
'''
:keyword role_definition_id: The unique identifier for the associated Role Definition.
:paramtype role_definition_id: str
:keyword scope: The data plane resource path for which access is being granted through this
Table Role Assignment.
:paramtype scope: str
:keyword principal_id: The unique identifier for the associated AAD principal in the AAD graph
to which access is being granted through this Table Role Assignment. Tenant ID for the
principal is inferred using the tenant associated with the subscription.
:paramtype principal_id: str
'''
pass
| 2 | 2 | 24 | 0 | 13 | 11 | 1 | 1.16 | 1 | 3 | 0 | 0 | 1 | 4 | 1 | 17 | 72 | 5 | 31 | 15 | 22 | 36 | 9 | 8 | 7 | 1 | 4 | 0 | 1 |
10,511 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.TableRoleDefinitionListResult
|
class TableRoleDefinitionListResult(_serialization.Model):
"""The relevant Role Definitions.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of Role Definitions and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource]
:ivar next_link: The link used to get the next page of results.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[TableRoleDefinitionResource]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
|
class TableRoleDefinitionListResult(_serialization.Model):
'''The relevant Role Definitions.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of Role Definitions and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource]
:ivar next_link: The link used to get the next page of results.
:vartype next_link: str
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 5 | 0 | 4 | 1 | 1 | 0.62 | 1 | 2 | 0 | 0 | 1 | 2 | 1 | 16 | 26 | 5 | 13 | 6 | 11 | 8 | 7 | 6 | 5 | 1 | 2 | 0 | 1 |
10,512 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.TableRoleDefinitionResource
|
class TableRoleDefinitionResource(ProxyResource):
"""Parameters to create and update an Azure Cosmos DB Table Role Definition.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. E.g.
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData
:ivar id_properties_id: The path id for the Role Definition.
:vartype id_properties_id: str
:ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database
account.
:vartype role_name: str
:ivar type_properties_type: Indicates whether the Role Definition was built-in or user created.
Known values are: "BuiltInRole" and "CustomRole".
:vartype type_properties_type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType
:ivar assignable_scopes: A set of fully qualified Scopes at or below which Table Role
Assignments may be created using this Role Definition. This will allow application of this Role
Definition on the entire database account or any underlying Database / Collection. Must have at
least one element. Scopes higher than Database account are not enforceable as assignable
Scopes. Note that resources referenced in assignable Scopes need not exist.
:vartype assignable_scopes: list[str]
:ivar permissions: The set of operations allowed through this Role Definition.
:vartype permissions: list[~azure.mgmt.cosmosdb.models.PermissionAutoGenerated]
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"system_data": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"system_data": {"key": "systemData", "type": "SystemData"},
"id_properties_id": {"key": "properties.id", "type": "str"},
"role_name": {"key": "properties.roleName", "type": "str"},
"type_properties_type": {"key": "properties.type", "type": "str"},
"assignable_scopes": {"key": "properties.assignableScopes", "type": "[str]"},
"permissions": {"key": "properties.permissions", "type": "[PermissionAutoGenerated]"},
}
def __init__(
self,
*,
id_properties_id: Optional[str] = None,
role_name: Optional[str] = None,
type_properties_type: Optional[Union[str, "_models.RoleDefinitionType"]] = None,
assignable_scopes: Optional[List[str]] = None,
permissions: Optional[List["_models.PermissionAutoGenerated"]] = None,
**kwargs: Any
) -> None:
"""
:keyword id_properties_id: The path id for the Role Definition.
:paramtype id_properties_id: str
:keyword role_name: A user-friendly name for the Role Definition. Must be unique for the
database account.
:paramtype role_name: str
:keyword type_properties_type: Indicates whether the Role Definition was built-in or user
created. Known values are: "BuiltInRole" and "CustomRole".
:paramtype type_properties_type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType
:keyword assignable_scopes: A set of fully qualified Scopes at or below which Table Role
Assignments may be created using this Role Definition. This will allow application of this Role
Definition on the entire database account or any underlying Database / Collection. Must have at
least one element. Scopes higher than Database account are not enforceable as assignable
Scopes. Note that resources referenced in assignable Scopes need not exist.
:paramtype assignable_scopes: list[str]
:keyword permissions: The set of operations allowed through this Role Definition.
:paramtype permissions: list[~azure.mgmt.cosmosdb.models.PermissionAutoGenerated]
"""
super().__init__(**kwargs)
self.id_properties_id = id_properties_id
self.role_name = role_name
self.type_properties_type = type_properties_type
self.assignable_scopes = assignable_scopes
self.permissions = permissions
|
class TableRoleDefinitionResource(ProxyResource):
'''Parameters to create and update an Azure Cosmos DB Table Role Definition.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. E.g.
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData
:ivar id_properties_id: The path id for the Role Definition.
:vartype id_properties_id: str
:ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database
account.
:vartype role_name: str
:ivar type_properties_type: Indicates whether the Role Definition was built-in or user created.
Known values are: "BuiltInRole" and "CustomRole".
:vartype type_properties_type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType
:ivar assignable_scopes: A set of fully qualified Scopes at or below which Table Role
Assignments may be created using this Role Definition. This will allow application of this Role
Definition on the entire database account or any underlying Database / Collection. Must have at
least one element. Scopes higher than Database account are not enforceable as assignable
Scopes. Note that resources referenced in assignable Scopes need not exist.
:vartype assignable_scopes: list[str]
:ivar permissions: The set of operations allowed through this Role Definition.
:vartype permissions: list[~azure.mgmt.cosmosdb.models.PermissionAutoGenerated]
'''
def __init__(
self,
*,
id_properties_id: Optional[str] = None,
role_name: Optional[str] = None,
type_properties_type: Optional[Union[str, "_models.RoleDefinitionType"]] = None,
assignable_scopes: Optional[List[str]] = None,
permissions: Optional[List["_models.PermissionAutoGenerated"]] = None,
**kwargs: Any
) -> None:
'''
:keyword id_properties_id: The path id for the Role Definition.
:paramtype id_properties_id: str
:keyword role_name: A user-friendly name for the Role Definition. Must be unique for the
database account.
:paramtype role_name: str
:keyword type_properties_type: Indicates whether the Role Definition was built-in or user
created. Known values are: "BuiltInRole" and "CustomRole".
:paramtype type_properties_type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType
:keyword assignable_scopes: A set of fully qualified Scopes at or below which Table Role
Assignments may be created using this Role Definition. This will allow application of this Role
Definition on the entire database account or any underlying Database / Collection. Must have at
least one element. Scopes higher than Database account are not enforceable as assignable
Scopes. Note that resources referenced in assignable Scopes need not exist.
:paramtype assignable_scopes: list[str]
:keyword permissions: The set of operations allowed through this Role Definition.
:paramtype permissions: list[~azure.mgmt.cosmosdb.models.PermissionAutoGenerated]
'''
pass
| 2 | 2 | 34 | 0 | 16 | 18 | 1 | 1.41 | 1 | 3 | 0 | 0 | 1 | 5 | 1 | 17 | 87 | 5 | 34 | 18 | 23 | 48 | 10 | 9 | 8 | 1 | 4 | 0 | 1 |
10,513 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.ThroughputBucketResource
|
class ThroughputBucketResource(_serialization.Model):
"""Cosmos DB throughput bucket object.
All required parameters must be populated in order to send to server.
:ivar id: Represents the throughput bucket id. Required.
:vartype id: int
:ivar max_throughput_percentage: Represents maximum percentage throughput that can be used by
the bucket. Required.
:vartype max_throughput_percentage: int
"""
_validation = {
"id": {"required": True},
"max_throughput_percentage": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "int"},
"max_throughput_percentage": {"key": "maxThroughputPercentage", "type": "int"},
}
def __init__(
self, *, id: int, max_throughput_percentage: int, **kwargs: Any # pylint: disable=redefined-builtin
) -> None:
"""
:keyword id: Represents the throughput bucket id. Required.
:paramtype id: int
:keyword max_throughput_percentage: Represents maximum percentage throughput that can be used
by the bucket. Required.
:paramtype max_throughput_percentage: int
"""
super().__init__(**kwargs)
self.id = id
self.max_throughput_percentage = max_throughput_percentage
|
class ThroughputBucketResource(_serialization.Model):
'''Cosmos DB throughput bucket object.
All required parameters must be populated in order to send to server.
:ivar id: Represents the throughput bucket id. Required.
:vartype id: int
:ivar max_throughput_percentage: Represents maximum percentage throughput that can be used by
the bucket. Required.
:vartype max_throughput_percentage: int
'''
def __init__(
self, *, id: int, max_throughput_percentage: int, **kwargs: Any # pylint: disable=redefined-builtin
) -> None:
'''
:keyword id: Represents the throughput bucket id. Required.
:paramtype id: int
:keyword max_throughput_percentage: Represents maximum percentage throughput that can be used
by the bucket. Required.
:paramtype max_throughput_percentage: int
'''
pass
| 2 | 2 | 13 | 0 | 6 | 8 | 1 | 1.07 | 1 | 3 | 0 | 0 | 1 | 2 | 1 | 16 | 35 | 5 | 15 | 8 | 11 | 16 | 7 | 6 | 5 | 1 | 2 | 0 | 1 |
10,514 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.ThroughputPolicyResource
|
class ThroughputPolicyResource(_serialization.Model):
"""Cosmos DB resource throughput policy.
:ivar is_enabled: Determines whether the ThroughputPolicy is active or not.
:vartype is_enabled: bool
:ivar increment_percent: Represents the percentage by which throughput can increase every time
throughput policy kicks in.
:vartype increment_percent: int
"""
_attribute_map = {
"is_enabled": {"key": "isEnabled", "type": "bool"},
"increment_percent": {"key": "incrementPercent", "type": "int"},
}
def __init__(
self, *, is_enabled: Optional[bool] = None, increment_percent: Optional[int] = None, **kwargs: Any
) -> None:
"""
:keyword is_enabled: Determines whether the ThroughputPolicy is active or not.
:paramtype is_enabled: bool
:keyword increment_percent: Represents the percentage by which throughput can increase every
time throughput policy kicks in.
:paramtype increment_percent: int
"""
super().__init__(**kwargs)
self.is_enabled = is_enabled
self.increment_percent = increment_percent
|
class ThroughputPolicyResource(_serialization.Model):
'''Cosmos DB resource throughput policy.
:ivar is_enabled: Determines whether the ThroughputPolicy is active or not.
:vartype is_enabled: bool
:ivar increment_percent: Represents the percentage by which throughput can increase every time
throughput policy kicks in.
:vartype increment_percent: int
'''
def __init__(
self, *, is_enabled: Optional[bool] = None, increment_percent: Optional[int] = None, **kwargs: Any
) -> None:
'''
:keyword is_enabled: Determines whether the ThroughputPolicy is active or not.
:paramtype is_enabled: bool
:keyword increment_percent: Represents the percentage by which throughput can increase every
time throughput policy kicks in.
:paramtype increment_percent: int
'''
pass
| 2 | 2 | 13 | 0 | 6 | 7 | 1 | 1.27 | 1 | 4 | 0 | 0 | 1 | 2 | 1 | 16 | 28 | 3 | 11 | 7 | 7 | 14 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,515 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.ThroughputPoolAccountCreateParameters
|
class ThroughputPoolAccountCreateParameters(_serialization.Model):
"""Parameters for creating a Azure Cosmos DB throughput pool account.
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar account_resource_identifier: The resource identifier of global database account in the
throughputPool.
:vartype account_resource_identifier: str
:ivar account_location: The location of global database account in the throughputPool.
:vartype account_location: str
"""
_attribute_map = {
"tags": {"key": "tags", "type": "{str}"},
"account_resource_identifier": {"key": "properties.accountResourceIdentifier", "type": "str"},
"account_location": {"key": "properties.accountLocation", "type": "str"},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
account_resource_identifier: Optional[str] = None,
account_location: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword account_resource_identifier: The resource identifier of global database account in the
throughputPool.
:paramtype account_resource_identifier: str
:keyword account_location: The location of global database account in the throughputPool.
:paramtype account_location: str
"""
super().__init__(**kwargs)
self.tags = tags
self.account_resource_identifier = account_resource_identifier
self.account_location = account_location
|
class ThroughputPoolAccountCreateParameters(_serialization.Model):
'''Parameters for creating a Azure Cosmos DB throughput pool account.
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar account_resource_identifier: The resource identifier of global database account in the
throughputPool.
:vartype account_resource_identifier: str
:ivar account_location: The location of global database account in the throughputPool.
:vartype account_location: str
'''
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
account_resource_identifier: Optional[str] = None,
account_location: Optional[str] = None,
**kwargs: Any
) -> None:
'''
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword account_resource_identifier: The resource identifier of global database account in the
throughputPool.
:paramtype account_resource_identifier: str
:keyword account_location: The location of global database account in the throughputPool.
:paramtype account_location: str
'''
pass
| 2 | 2 | 26 | 0 | 12 | 14 | 1 | 1.56 | 1 | 3 | 0 | 0 | 1 | 3 | 1 | 16 | 49 | 3 | 18 | 13 | 9 | 28 | 7 | 6 | 5 | 1 | 2 | 0 | 1 |
10,516 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlUserDefinedFunctionGetPropertiesResource
|
class SqlUserDefinedFunctionGetPropertiesResource(
SqlUserDefinedFunctionResource, ExtendedResourceProperties
): # pylint: disable=name-too-long
"""SqlUserDefinedFunctionGetPropertiesResource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar rid: A system generated property. A unique identifier.
:vartype rid: str
:ivar ts: A system generated property that denotes the last updated timestamp of the resource.
:vartype ts: float
:ivar etag: A system generated property representing the resource etag required for optimistic
concurrency control.
:vartype etag: str
:ivar id: Name of the Cosmos DB SQL userDefinedFunction. Required.
:vartype id: str
:ivar body: Body of the User Defined Function.
:vartype body: str
"""
_validation = {
"rid": {"readonly": True},
"ts": {"readonly": True},
"etag": {"readonly": True},
"id": {"required": True},
}
_attribute_map = {
"rid": {"key": "_rid", "type": "str"},
"ts": {"key": "_ts", "type": "float"},
"etag": {"key": "_etag", "type": "str"},
"id": {"key": "id", "type": "str"},
"body": {"key": "body", "type": "str"},
}
def __init__(
self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin
) -> None:
"""
:keyword id: Name of the Cosmos DB SQL userDefinedFunction. Required.
:paramtype id: str
:keyword body: Body of the User Defined Function.
:paramtype body: str
"""
super().__init__(id=id, body=body, **kwargs)
self.rid = None
self.ts = None
self.etag = None
self.id = id
self.body = body
|
class SqlUserDefinedFunctionGetPropertiesResource(
SqlUserDefinedFunctionResource, ExtendedResourceProperties
):
'''SqlUserDefinedFunctionGetPropertiesResource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar rid: A system generated property. A unique identifier.
:vartype rid: str
:ivar ts: A system generated property that denotes the last updated timestamp of the resource.
:vartype ts: float
:ivar etag: A system generated property representing the resource etag required for optimistic
concurrency control.
:vartype etag: str
:ivar id: Name of the Cosmos DB SQL userDefinedFunction. Required.
:vartype id: str
:ivar body: Body of the User Defined Function.
:vartype body: str
'''
def __init__(
self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin
) -> None:
'''
:keyword id: Name of the Cosmos DB SQL userDefinedFunction. Required.
:paramtype id: str
:keyword body: Body of the User Defined Function.
:paramtype body: str
'''
pass
| 2 | 2 | 15 | 0 | 9 | 7 | 1 | 0.92 | 2 | 3 | 0 | 0 | 1 | 5 | 1 | 18 | 52 | 6 | 25 | 13 | 19 | 23 | 10 | 9 | 8 | 1 | 3 | 0 | 1 |
10,517 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.ThroughputPoolAccountResource
|
class ThroughputPoolAccountResource(ProxyResource):
"""An Azure Cosmos DB Throughputpool Account.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. E.g.
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData
:ivar provisioning_state: A provisioning state of the ThroughputPool Account. Known values are:
"Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded",
"Failed", "Canceled", and "Updating".
:vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status
:ivar account_resource_identifier: The resource identifier of global database account in the
throughputPool.
:vartype account_resource_identifier: str
:ivar account_location: The location of global database account in the throughputPool.
:vartype account_location: str
:ivar account_instance_id: The instance id of global database account in the throughputPool.
:vartype account_instance_id: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"system_data": {"readonly": True},
"account_instance_id": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"system_data": {"key": "systemData", "type": "SystemData"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"account_resource_identifier": {"key": "properties.accountResourceIdentifier", "type": "str"},
"account_location": {"key": "properties.accountLocation", "type": "str"},
"account_instance_id": {"key": "properties.accountInstanceId", "type": "str"},
}
def __init__(
self,
*,
provisioning_state: Optional[Union[str, "_models.Status"]] = None,
account_resource_identifier: Optional[str] = None,
account_location: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword provisioning_state: A provisioning state of the ThroughputPool Account. Known values
are: "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded",
"Failed", "Canceled", and "Updating".
:paramtype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status
:keyword account_resource_identifier: The resource identifier of global database account in the
throughputPool.
:paramtype account_resource_identifier: str
:keyword account_location: The location of global database account in the throughputPool.
:paramtype account_location: str
"""
super().__init__(**kwargs)
self.provisioning_state = provisioning_state
self.account_resource_identifier = account_resource_identifier
self.account_location = account_location
self.account_instance_id = None
|
class ThroughputPoolAccountResource(ProxyResource):
'''An Azure Cosmos DB Throughputpool Account.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. E.g.
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData
:ivar provisioning_state: A provisioning state of the ThroughputPool Account. Known values are:
"Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded",
"Failed", "Canceled", and "Updating".
:vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status
:ivar account_resource_identifier: The resource identifier of global database account in the
throughputPool.
:vartype account_resource_identifier: str
:ivar account_location: The location of global database account in the throughputPool.
:vartype account_location: str
:ivar account_instance_id: The instance id of global database account in the throughputPool.
:vartype account_instance_id: str
'''
def __init__(
self,
*,
provisioning_state: Optional[Union[str, "_models.Status"]] = None,
account_resource_identifier: Optional[str] = None,
account_location: Optional[str] = None,
**kwargs: Any
) -> None:
'''
:keyword provisioning_state: A provisioning state of the ThroughputPool Account. Known values
are: "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded",
"Failed", "Canceled", and "Updating".
:paramtype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status
:keyword account_resource_identifier: The resource identifier of global database account in the
throughputPool.
:paramtype account_resource_identifier: str
:keyword account_location: The location of global database account in the throughputPool.
:paramtype account_location: str
'''
pass
| 2 | 2 | 24 | 0 | 13 | 11 | 1 | 1.16 | 1 | 3 | 0 | 0 | 1 | 4 | 1 | 17 | 72 | 5 | 31 | 15 | 22 | 36 | 9 | 8 | 7 | 1 | 4 | 0 | 1 |
10,518 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlUserDefinedFunctionCreateUpdateParameters
|
class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): # pylint: disable=name-too-long
"""Parameters to create and update Cosmos DB userDefinedFunction.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource: The standard JSON format of a userDefinedFunction. Required.
:vartype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionResource
:ivar options: A key-value pair of options to be applied for the request. This corresponds to
the headers sent with the request.
:vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"resource": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"location": {"key": "location", "type": "str"},
"tags": {"key": "tags", "type": "{str}"},
"identity": {"key": "identity", "type": "ManagedServiceIdentity"},
"resource": {"key": "properties.resource", "type": "SqlUserDefinedFunctionResource"},
"options": {"key": "properties.options", "type": "CreateUpdateOptions"},
}
def __init__(
self,
*,
resource: "_models.SqlUserDefinedFunctionResource",
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
options: Optional["_models.CreateUpdateOptions"] = None,
**kwargs: Any
) -> None:
"""
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource: The standard JSON format of a userDefinedFunction. Required.
:paramtype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionResource
:keyword options: A key-value pair of options to be applied for the request. This corresponds
to the headers sent with the request.
:paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
"""
super().__init__(location=location, tags=tags, identity=identity, **kwargs)
self.resource = resource
self.options = options
|
class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties):
'''Parameters to create and update Cosmos DB userDefinedFunction.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource: The standard JSON format of a userDefinedFunction. Required.
:vartype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionResource
:ivar options: A key-value pair of options to be applied for the request. This corresponds to
the headers sent with the request.
:vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
'''
def __init__(
self,
*,
resource: "_models.SqlUserDefinedFunctionResource",
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
options: Optional["_models.CreateUpdateOptions"] = None,
**kwargs: Any
) -> None:
'''
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource: The standard JSON format of a userDefinedFunction. Required.
:paramtype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionResource
:keyword options: A key-value pair of options to be applied for the request. This corresponds
to the headers sent with the request.
:paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
'''
pass
| 2 | 2 | 31 | 0 | 13 | 18 | 1 | 1.5 | 1 | 3 | 0 | 0 | 1 | 2 | 1 | 17 | 80 | 6 | 30 | 15 | 19 | 45 | 7 | 6 | 5 | 1 | 3 | 0 | 1 |
10,519 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlTriggerListResult
|
class SqlTriggerListResult(_serialization.Model):
"""The List operation response, that contains the triggers and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of triggers and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults]
"""
_validation = {
"value": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[SqlTriggerGetResults]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
|
class SqlTriggerListResult(_serialization.Model):
'''The List operation response, that contains the triggers and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of triggers and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults]
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 4 | 0 | 3 | 1 | 1 | 0.6 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 16 | 21 | 5 | 10 | 5 | 8 | 6 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,520 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlDedicatedGatewayServiceResource
|
class SqlDedicatedGatewayServiceResource(_serialization.Model):
"""Describes the service response property for SqlDedicatedGateway.
:ivar properties: Properties for SqlDedicatedGatewayServiceResource.
:vartype properties: ~azure.mgmt.cosmosdb.models.SqlDedicatedGatewayServiceResourceProperties
"""
_attribute_map = {
"properties": {"key": "properties", "type": "SqlDedicatedGatewayServiceResourceProperties"},
}
def __init__(
self, *, properties: Optional["_models.SqlDedicatedGatewayServiceResourceProperties"] = None, **kwargs: Any
) -> None:
"""
:keyword properties: Properties for SqlDedicatedGatewayServiceResource.
:paramtype properties: ~azure.mgmt.cosmosdb.models.SqlDedicatedGatewayServiceResourceProperties
"""
super().__init__(**kwargs)
self.properties = properties
|
class SqlDedicatedGatewayServiceResource(_serialization.Model):
'''Describes the service response property for SqlDedicatedGateway.
:ivar properties: Properties for SqlDedicatedGatewayServiceResource.
:vartype properties: ~azure.mgmt.cosmosdb.models.SqlDedicatedGatewayServiceResourceProperties
'''
def __init__(
self, *, properties: Optional["_models.SqlDedicatedGatewayServiceResourceProperties"] = None, **kwargs: Any
) -> None:
'''
:keyword properties: Properties for SqlDedicatedGatewayServiceResource.
:paramtype properties: ~azure.mgmt.cosmosdb.models.SqlDedicatedGatewayServiceResourceProperties
'''
pass
| 2 | 2 | 9 | 0 | 5 | 4 | 1 | 0.89 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 16 | 20 | 3 | 9 | 6 | 5 | 8 | 5 | 4 | 3 | 1 | 2 | 0 | 1 |
10,521 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlDedicatedGatewayServiceResourceCreateUpdateProperties
|
class SqlDedicatedGatewayServiceResourceCreateUpdateProperties(
ServiceResourceCreateUpdateProperties
): # pylint: disable=name-too-long
"""Properties for Create or Update request for SqlDedicatedGatewayServiceResource.
All required parameters must be populated in order to send to server.
:ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s",
"Cosmos.D8s", and "Cosmos.D16s".
:vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize
:ivar instance_count: Instance count for the service.
:vartype instance_count: int
:ivar service_type: ServiceType for the service. Required. Known values are:
"SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", and "MaterializedViewsBuilder".
:vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType
:ivar dedicated_gateway_type: DedicatedGatewayType for the service. Known values are:
"IntegratedCache" and "DistributedQuery".
:vartype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType
"""
_validation = {
"instance_count": {"minimum": 0},
"service_type": {"required": True},
}
_attribute_map = {
"instance_size": {"key": "instanceSize", "type": "str"},
"instance_count": {"key": "instanceCount", "type": "int"},
"service_type": {"key": "serviceType", "type": "str"},
"dedicated_gateway_type": {"key": "dedicatedGatewayType", "type": "str"},
}
def __init__(
self,
*,
instance_size: Optional[Union[str, "_models.ServiceSize"]] = None,
instance_count: Optional[int] = None,
dedicated_gateway_type: Optional[Union[str, "_models.DedicatedGatewayType"]] = None,
**kwargs: Any
) -> None:
"""
:keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s",
"Cosmos.D8s", and "Cosmos.D16s".
:paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize
:keyword instance_count: Instance count for the service.
:paramtype instance_count: int
:keyword dedicated_gateway_type: DedicatedGatewayType for the service. Known values are:
"IntegratedCache" and "DistributedQuery".
:paramtype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType
"""
super().__init__(instance_size=instance_size, instance_count=instance_count, **kwargs)
self.service_type: str = "SqlDedicatedGateway"
self.dedicated_gateway_type = dedicated_gateway_type
|
class SqlDedicatedGatewayServiceResourceCreateUpdateProperties(
ServiceResourceCreateUpdateProperties
):
'''Properties for Create or Update request for SqlDedicatedGatewayServiceResource.
All required parameters must be populated in order to send to server.
:ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s",
"Cosmos.D8s", and "Cosmos.D16s".
:vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize
:ivar instance_count: Instance count for the service.
:vartype instance_count: int
:ivar service_type: ServiceType for the service. Required. Known values are:
"SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", and "MaterializedViewsBuilder".
:vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType
:ivar dedicated_gateway_type: DedicatedGatewayType for the service. Known values are:
"IntegratedCache" and "DistributedQuery".
:vartype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType
'''
def __init__(
self,
*,
instance_size: Optional[Union[str, "_models.ServiceSize"]] = None,
instance_count: Optional[int] = None,
dedicated_gateway_type: Optional[Union[str, "_models.DedicatedGatewayType"]] = None,
**kwargs: Any
) -> None:
'''
:keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s",
"Cosmos.D8s", and "Cosmos.D16s".
:paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize
:keyword instance_count: Instance count for the service.
:paramtype instance_count: int
:keyword dedicated_gateway_type: DedicatedGatewayType for the service. Known values are:
"IntegratedCache" and "DistributedQuery".
:paramtype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType
'''
pass
| 2 | 2 | 21 | 0 | 11 | 10 | 1 | 1.04 | 1 | 4 | 0 | 0 | 1 | 2 | 1 | 17 | 53 | 5 | 24 | 15 | 13 | 25 | 7 | 6 | 5 | 1 | 3 | 0 | 1 |
10,522 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlDedicatedGatewayServiceResourceProperties
|
class SqlDedicatedGatewayServiceResourceProperties(ServiceResourceProperties): # pylint: disable=name-too-long
"""Properties for SqlDedicatedGatewayServiceResource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar additional_properties: Unmatched properties from the message are deserialized to this
collection.
:vartype additional_properties: dict[str, any]
:ivar creation_time: Time of the last state change (ISO-8601 format).
:vartype creation_time: ~datetime.datetime
:ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s",
"Cosmos.D8s", and "Cosmos.D16s".
:vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize
:ivar instance_count: Instance count for the service.
:vartype instance_count: int
:ivar service_type: ServiceType for the service. Required. Known values are:
"SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", and "MaterializedViewsBuilder".
:vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType
:ivar status: Describes the status of a service. Known values are: "Creating", "Running",
"Updating", "Deleting", "Error", and "Stopped".
:vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus
:ivar sql_dedicated_gateway_endpoint: SqlDedicatedGateway endpoint for the service.
:vartype sql_dedicated_gateway_endpoint: str
:ivar dedicated_gateway_type: DedicatedGatewayType for the service. Known values are:
"IntegratedCache" and "DistributedQuery".
:vartype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType
:ivar locations: An array that contains all of the locations for the service.
:vartype locations:
list[~azure.mgmt.cosmosdb.models.SqlDedicatedGatewayRegionalServiceResource]
"""
_validation = {
"creation_time": {"readonly": True},
"instance_count": {"minimum": 0},
"service_type": {"required": True},
"status": {"readonly": True},
"locations": {"readonly": True},
}
_attribute_map = {
"additional_properties": {"key": "", "type": "{object}"},
"creation_time": {"key": "creationTime", "type": "iso-8601"},
"instance_size": {"key": "instanceSize", "type": "str"},
"instance_count": {"key": "instanceCount", "type": "int"},
"service_type": {"key": "serviceType", "type": "str"},
"status": {"key": "status", "type": "str"},
"sql_dedicated_gateway_endpoint": {"key": "sqlDedicatedGatewayEndpoint", "type": "str"},
"dedicated_gateway_type": {"key": "dedicatedGatewayType", "type": "str"},
"locations": {"key": "locations", "type": "[SqlDedicatedGatewayRegionalServiceResource]"},
}
def __init__(
self,
*,
additional_properties: Optional[Dict[str, Any]] = None,
instance_size: Optional[Union[str, "_models.ServiceSize"]] = None,
instance_count: Optional[int] = None,
sql_dedicated_gateway_endpoint: Optional[str] = None,
dedicated_gateway_type: Optional[Union[str, "_models.DedicatedGatewayType"]] = None,
**kwargs: Any
) -> None:
"""
:keyword additional_properties: Unmatched properties from the message are deserialized to this
collection.
:paramtype additional_properties: dict[str, any]
:keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s",
"Cosmos.D8s", and "Cosmos.D16s".
:paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize
:keyword instance_count: Instance count for the service.
:paramtype instance_count: int
:keyword sql_dedicated_gateway_endpoint: SqlDedicatedGateway endpoint for the service.
:paramtype sql_dedicated_gateway_endpoint: str
:keyword dedicated_gateway_type: DedicatedGatewayType for the service. Known values are:
"IntegratedCache" and "DistributedQuery".
:paramtype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType
"""
super().__init__(
additional_properties=additional_properties,
instance_size=instance_size,
instance_count=instance_count,
**kwargs
)
self.service_type: str = "SqlDedicatedGateway"
self.sql_dedicated_gateway_endpoint = sql_dedicated_gateway_endpoint
self.dedicated_gateway_type = dedicated_gateway_type
self.locations = None
|
class SqlDedicatedGatewayServiceResourceProperties(ServiceResourceProperties):
'''Properties for SqlDedicatedGatewayServiceResource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar additional_properties: Unmatched properties from the message are deserialized to this
collection.
:vartype additional_properties: dict[str, any]
:ivar creation_time: Time of the last state change (ISO-8601 format).
:vartype creation_time: ~datetime.datetime
:ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s",
"Cosmos.D8s", and "Cosmos.D16s".
:vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize
:ivar instance_count: Instance count for the service.
:vartype instance_count: int
:ivar service_type: ServiceType for the service. Required. Known values are:
"SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", and "MaterializedViewsBuilder".
:vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType
:ivar status: Describes the status of a service. Known values are: "Creating", "Running",
"Updating", "Deleting", "Error", and "Stopped".
:vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus
:ivar sql_dedicated_gateway_endpoint: SqlDedicatedGateway endpoint for the service.
:vartype sql_dedicated_gateway_endpoint: str
:ivar dedicated_gateway_type: DedicatedGatewayType for the service. Known values are:
"IntegratedCache" and "DistributedQuery".
:vartype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType
:ivar locations: An array that contains all of the locations for the service.
:vartype locations:
list[~azure.mgmt.cosmosdb.models.SqlDedicatedGatewayRegionalServiceResource]
'''
def __init__(
self,
*,
additional_properties: Optional[Dict[str, Any]] = None,
instance_size: Optional[Union[str, "_models.ServiceSize"]] = None,
instance_count: Optional[int] = None,
sql_dedicated_gateway_endpoint: Optional[str] = None,
dedicated_gateway_type: Optional[Union[str, "_models.DedicatedGatewayType"]] = None,
**kwargs: Any
) -> None:
'''
:keyword additional_properties: Unmatched properties from the message are deserialized to this
collection.
:paramtype additional_properties: dict[str, any]
:keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s",
"Cosmos.D8s", and "Cosmos.D16s".
:paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize
:keyword instance_count: Instance count for the service.
:paramtype instance_count: int
:keyword sql_dedicated_gateway_endpoint: SqlDedicatedGateway endpoint for the service.
:paramtype sql_dedicated_gateway_endpoint: str
:keyword dedicated_gateway_type: DedicatedGatewayType for the service. Known values are:
"IntegratedCache" and "DistributedQuery".
:paramtype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType
'''
pass
| 2 | 2 | 35 | 0 | 20 | 15 | 1 | 1.13 | 1 | 4 | 0 | 0 | 1 | 4 | 1 | 17 | 88 | 6 | 39 | 17 | 28 | 44 | 9 | 8 | 7 | 1 | 3 | 0 | 1 |
10,523 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlRoleAssignmentCreateUpdateParameters
|
class SqlRoleAssignmentCreateUpdateParameters(_serialization.Model):
"""Parameters to create and update an Azure Cosmos DB SQL Role Assignment.
:ivar role_definition_id: The unique identifier for the associated Role Definition.
:vartype role_definition_id: str
:ivar scope: The data plane resource path for which access is being granted through this Role
Assignment.
:vartype scope: str
:ivar principal_id: The unique identifier for the associated AAD principal in the AAD graph to
which access is being granted through this Role Assignment. Tenant ID for the principal is
inferred using the tenant associated with the subscription.
:vartype principal_id: str
"""
_attribute_map = {
"role_definition_id": {"key": "properties.roleDefinitionId", "type": "str"},
"scope": {"key": "properties.scope", "type": "str"},
"principal_id": {"key": "properties.principalId", "type": "str"},
}
def __init__(
self,
*,
role_definition_id: Optional[str] = None,
scope: Optional[str] = None,
principal_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword role_definition_id: The unique identifier for the associated Role Definition.
:paramtype role_definition_id: str
:keyword scope: The data plane resource path for which access is being granted through this
Role Assignment.
:paramtype scope: str
:keyword principal_id: The unique identifier for the associated AAD principal in the AAD graph
to which access is being granted through this Role Assignment. Tenant ID for the principal is
inferred using the tenant associated with the subscription.
:paramtype principal_id: str
"""
super().__init__(**kwargs)
self.role_definition_id = role_definition_id
self.scope = scope
self.principal_id = principal_id
|
class SqlRoleAssignmentCreateUpdateParameters(_serialization.Model):
'''Parameters to create and update an Azure Cosmos DB SQL Role Assignment.
:ivar role_definition_id: The unique identifier for the associated Role Definition.
:vartype role_definition_id: str
:ivar scope: The data plane resource path for which access is being granted through this Role
Assignment.
:vartype scope: str
:ivar principal_id: The unique identifier for the associated AAD principal in the AAD graph to
which access is being granted through this Role Assignment. Tenant ID for the principal is
inferred using the tenant associated with the subscription.
:vartype principal_id: str
'''
def __init__(
self,
*,
role_definition_id: Optional[str] = None,
scope: Optional[str] = None,
principal_id: Optional[str] = None,
**kwargs: Any
) -> None:
'''
:keyword role_definition_id: The unique identifier for the associated Role Definition.
:paramtype role_definition_id: str
:keyword scope: The data plane resource path for which access is being granted through this
Role Assignment.
:paramtype scope: str
:keyword principal_id: The unique identifier for the associated AAD principal in the AAD graph
to which access is being granted through this Role Assignment. Tenant ID for the principal is
inferred using the tenant associated with the subscription.
:paramtype principal_id: str
'''
pass
| 2 | 2 | 23 | 0 | 12 | 11 | 1 | 1.22 | 1 | 3 | 0 | 0 | 1 | 3 | 1 | 16 | 43 | 3 | 18 | 13 | 9 | 22 | 7 | 6 | 5 | 1 | 2 | 0 | 1 |
10,524 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlRoleAssignmentGetResults
|
class SqlRoleAssignmentGetResults(ARMProxyResource):
"""An Azure Cosmos DB Role Assignment.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the database account.
:vartype id: str
:ivar name: The name of the database account.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar role_definition_id: The unique identifier for the associated Role Definition.
:vartype role_definition_id: str
:ivar scope: The data plane resource path for which access is being granted through this Role
Assignment.
:vartype scope: str
:ivar principal_id: The unique identifier for the associated AAD principal in the AAD graph to
which access is being granted through this Role Assignment. Tenant ID for the principal is
inferred using the tenant associated with the subscription.
:vartype principal_id: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"role_definition_id": {"key": "properties.roleDefinitionId", "type": "str"},
"scope": {"key": "properties.scope", "type": "str"},
"principal_id": {"key": "properties.principalId", "type": "str"},
}
def __init__(
self,
*,
role_definition_id: Optional[str] = None,
scope: Optional[str] = None,
principal_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword role_definition_id: The unique identifier for the associated Role Definition.
:paramtype role_definition_id: str
:keyword scope: The data plane resource path for which access is being granted through this
Role Assignment.
:paramtype scope: str
:keyword principal_id: The unique identifier for the associated AAD principal in the AAD graph
to which access is being granted through this Role Assignment. Tenant ID for the principal is
inferred using the tenant associated with the subscription.
:paramtype principal_id: str
"""
super().__init__(**kwargs)
self.role_definition_id = role_definition_id
self.scope = scope
self.principal_id = principal_id
|
class SqlRoleAssignmentGetResults(ARMProxyResource):
'''An Azure Cosmos DB Role Assignment.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the database account.
:vartype id: str
:ivar name: The name of the database account.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar role_definition_id: The unique identifier for the associated Role Definition.
:vartype role_definition_id: str
:ivar scope: The data plane resource path for which access is being granted through this Role
Assignment.
:vartype scope: str
:ivar principal_id: The unique identifier for the associated AAD principal in the AAD graph to
which access is being granted through this Role Assignment. Tenant ID for the principal is
inferred using the tenant associated with the subscription.
:vartype principal_id: str
'''
def __init__(
self,
*,
role_definition_id: Optional[str] = None,
scope: Optional[str] = None,
principal_id: Optional[str] = None,
**kwargs: Any
) -> None:
'''
:keyword role_definition_id: The unique identifier for the associated Role Definition.
:paramtype role_definition_id: str
:keyword scope: The data plane resource path for which access is being granted through this
Role Assignment.
:paramtype scope: str
:keyword principal_id: The unique identifier for the associated AAD principal in the AAD graph
to which access is being granted through this Role Assignment. Tenant ID for the principal is
inferred using the tenant associated with the subscription.
:paramtype principal_id: str
'''
pass
| 2 | 2 | 23 | 0 | 12 | 11 | 1 | 1.12 | 1 | 3 | 0 | 0 | 1 | 3 | 1 | 17 | 60 | 5 | 26 | 14 | 17 | 29 | 8 | 7 | 6 | 1 | 3 | 0 | 1 |
10,525 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlRoleAssignmentListResult
|
class SqlRoleAssignmentListResult(_serialization.Model):
"""The relevant Role Assignments.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of Role Assignments and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults]
"""
_validation = {
"value": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[SqlRoleAssignmentGetResults]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
|
class SqlRoleAssignmentListResult(_serialization.Model):
'''The relevant Role Assignments.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of Role Assignments and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults]
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 4 | 0 | 3 | 1 | 1 | 0.6 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 16 | 21 | 5 | 10 | 5 | 8 | 6 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,526 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlRoleDefinitionCreateUpdateParameters
|
class SqlRoleDefinitionCreateUpdateParameters(_serialization.Model):
"""Parameters to create and update an Azure Cosmos DB SQL Role Definition.
:ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database
account.
:vartype role_name: str
:ivar type: Indicates whether the Role Definition was built-in or user created. Known values
are: "BuiltInRole" and "CustomRole".
:vartype type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType
:ivar assignable_scopes: A set of fully qualified Scopes at or below which Role Assignments may
be created using this Role Definition. This will allow application of this Role Definition on
the entire database account or any underlying Database / Collection. Must have at least one
element. Scopes higher than Database account are not enforceable as assignable Scopes. Note
that resources referenced in assignable Scopes need not exist.
:vartype assignable_scopes: list[str]
:ivar permissions: The set of operations allowed through this Role Definition.
:vartype permissions: list[~azure.mgmt.cosmosdb.models.Permission]
"""
_attribute_map = {
"role_name": {"key": "properties.roleName", "type": "str"},
"type": {"key": "properties.type", "type": "str"},
"assignable_scopes": {"key": "properties.assignableScopes", "type": "[str]"},
"permissions": {"key": "properties.permissions", "type": "[Permission]"},
}
def __init__(
self,
*,
role_name: Optional[str] = None,
type: Optional[Union[str, "_models.RoleDefinitionType"]] = None,
assignable_scopes: Optional[List[str]] = None,
permissions: Optional[List["_models.Permission"]] = None,
**kwargs: Any
) -> None:
"""
:keyword role_name: A user-friendly name for the Role Definition. Must be unique for the
database account.
:paramtype role_name: str
:keyword type: Indicates whether the Role Definition was built-in or user created. Known values
are: "BuiltInRole" and "CustomRole".
:paramtype type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType
:keyword assignable_scopes: A set of fully qualified Scopes at or below which Role Assignments
may be created using this Role Definition. This will allow application of this Role Definition
on the entire database account or any underlying Database / Collection. Must have at least one
element. Scopes higher than Database account are not enforceable as assignable Scopes. Note
that resources referenced in assignable Scopes need not exist.
:paramtype assignable_scopes: list[str]
:keyword permissions: The set of operations allowed through this Role Definition.
:paramtype permissions: list[~azure.mgmt.cosmosdb.models.Permission]
"""
super().__init__(**kwargs)
self.role_name = role_name
self.type = type
self.assignable_scopes = assignable_scopes
self.permissions = permissions
|
class SqlRoleDefinitionCreateUpdateParameters(_serialization.Model):
'''Parameters to create and update an Azure Cosmos DB SQL Role Definition.
:ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database
account.
:vartype role_name: str
:ivar type: Indicates whether the Role Definition was built-in or user created. Known values
are: "BuiltInRole" and "CustomRole".
:vartype type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType
:ivar assignable_scopes: A set of fully qualified Scopes at or below which Role Assignments may
be created using this Role Definition. This will allow application of this Role Definition on
the entire database account or any underlying Database / Collection. Must have at least one
element. Scopes higher than Database account are not enforceable as assignable Scopes. Note
that resources referenced in assignable Scopes need not exist.
:vartype assignable_scopes: list[str]
:ivar permissions: The set of operations allowed through this Role Definition.
:vartype permissions: list[~azure.mgmt.cosmosdb.models.Permission]
'''
def __init__(
self,
*,
role_name: Optional[str] = None,
type: Optional[Union[str, "_models.RoleDefinitionType"]] = None,
assignable_scopes: Optional[List[str]] = None,
permissions: Optional[List["_models.Permission"]] = None,
**kwargs: Any
) -> None:
'''
:keyword role_name: A user-friendly name for the Role Definition. Must be unique for the
database account.
:paramtype role_name: str
:keyword type: Indicates whether the Role Definition was built-in or user created. Known values
are: "BuiltInRole" and "CustomRole".
:paramtype type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType
:keyword assignable_scopes: A set of fully qualified Scopes at or below which Role Assignments
may be created using this Role Definition. This will allow application of this Role Definition
on the entire database account or any underlying Database / Collection. Must have at least one
element. Scopes higher than Database account are not enforceable as assignable Scopes. Note
that resources referenced in assignable Scopes need not exist.
:paramtype assignable_scopes: list[str]
:keyword permissions: The set of operations allowed through this Role Definition.
:paramtype permissions: list[~azure.mgmt.cosmosdb.models.Permission]
'''
pass
| 2 | 2 | 30 | 0 | 14 | 16 | 1 | 1.52 | 1 | 3 | 0 | 0 | 1 | 4 | 1 | 16 | 56 | 3 | 21 | 15 | 11 | 32 | 8 | 7 | 6 | 1 | 2 | 0 | 1 |
10,527 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlRoleDefinitionGetResults
|
class SqlRoleDefinitionGetResults(ARMProxyResource):
"""An Azure Cosmos DB SQL Role Definition.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the database account.
:vartype id: str
:ivar name: The name of the database account.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database
account.
:vartype role_name: str
:ivar type_properties_type: Indicates whether the Role Definition was built-in or user created.
Known values are: "BuiltInRole" and "CustomRole".
:vartype type_properties_type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType
:ivar assignable_scopes: A set of fully qualified Scopes at or below which Role Assignments may
be created using this Role Definition. This will allow application of this Role Definition on
the entire database account or any underlying Database / Collection. Must have at least one
element. Scopes higher than Database account are not enforceable as assignable Scopes. Note
that resources referenced in assignable Scopes need not exist.
:vartype assignable_scopes: list[str]
:ivar permissions: The set of operations allowed through this Role Definition.
:vartype permissions: list[~azure.mgmt.cosmosdb.models.Permission]
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"role_name": {"key": "properties.roleName", "type": "str"},
"type_properties_type": {"key": "properties.type", "type": "str"},
"assignable_scopes": {"key": "properties.assignableScopes", "type": "[str]"},
"permissions": {"key": "properties.permissions", "type": "[Permission]"},
}
def __init__(
self,
*,
role_name: Optional[str] = None,
type_properties_type: Optional[Union[str, "_models.RoleDefinitionType"]] = None,
assignable_scopes: Optional[List[str]] = None,
permissions: Optional[List["_models.Permission"]] = None,
**kwargs: Any
) -> None:
"""
:keyword role_name: A user-friendly name for the Role Definition. Must be unique for the
database account.
:paramtype role_name: str
:keyword type_properties_type: Indicates whether the Role Definition was built-in or user
created. Known values are: "BuiltInRole" and "CustomRole".
:paramtype type_properties_type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType
:keyword assignable_scopes: A set of fully qualified Scopes at or below which Role Assignments
may be created using this Role Definition. This will allow application of this Role Definition
on the entire database account or any underlying Database / Collection. Must have at least one
element. Scopes higher than Database account are not enforceable as assignable Scopes. Note
that resources referenced in assignable Scopes need not exist.
:paramtype assignable_scopes: list[str]
:keyword permissions: The set of operations allowed through this Role Definition.
:paramtype permissions: list[~azure.mgmt.cosmosdb.models.Permission]
"""
super().__init__(**kwargs)
self.role_name = role_name
self.type_properties_type = type_properties_type
self.assignable_scopes = assignable_scopes
self.permissions = permissions
|
class SqlRoleDefinitionGetResults(ARMProxyResource):
'''An Azure Cosmos DB SQL Role Definition.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the database account.
:vartype id: str
:ivar name: The name of the database account.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database
account.
:vartype role_name: str
:ivar type_properties_type: Indicates whether the Role Definition was built-in or user created.
Known values are: "BuiltInRole" and "CustomRole".
:vartype type_properties_type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType
:ivar assignable_scopes: A set of fully qualified Scopes at or below which Role Assignments may
be created using this Role Definition. This will allow application of this Role Definition on
the entire database account or any underlying Database / Collection. Must have at least one
element. Scopes higher than Database account are not enforceable as assignable Scopes. Note
that resources referenced in assignable Scopes need not exist.
:vartype assignable_scopes: list[str]
:ivar permissions: The set of operations allowed through this Role Definition.
:vartype permissions: list[~azure.mgmt.cosmosdb.models.Permission]
'''
def __init__(
self,
*,
role_name: Optional[str] = None,
type_properties_type: Optional[Union[str, "_models.RoleDefinitionType"]] = None,
assignable_scopes: Optional[List[str]] = None,
permissions: Optional[List["_models.Permission"]] = None,
**kwargs: Any
) -> None:
'''
:keyword role_name: A user-friendly name for the Role Definition. Must be unique for the
database account.
:paramtype role_name: str
:keyword type_properties_type: Indicates whether the Role Definition was built-in or user
created. Known values are: "BuiltInRole" and "CustomRole".
:paramtype type_properties_type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType
:keyword assignable_scopes: A set of fully qualified Scopes at or below which Role Assignments
may be created using this Role Definition. This will allow application of this Role Definition
on the entire database account or any underlying Database / Collection. Must have at least one
element. Scopes higher than Database account are not enforceable as assignable Scopes. Note
that resources referenced in assignable Scopes need not exist.
:paramtype assignable_scopes: list[str]
:keyword permissions: The set of operations allowed through this Role Definition.
:paramtype permissions: list[~azure.mgmt.cosmosdb.models.Permission]
'''
pass
| 2 | 2 | 30 | 0 | 14 | 16 | 1 | 1.34 | 1 | 3 | 0 | 0 | 1 | 4 | 1 | 17 | 73 | 5 | 29 | 16 | 19 | 39 | 9 | 8 | 7 | 1 | 3 | 0 | 1 |
10,528 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlRoleDefinitionListResult
|
class SqlRoleDefinitionListResult(_serialization.Model):
"""The relevant Role Definitions.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of Role Definitions and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults]
"""
_validation = {
"value": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[SqlRoleDefinitionGetResults]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
|
class SqlRoleDefinitionListResult(_serialization.Model):
'''The relevant Role Definitions.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of Role Definitions and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults]
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 4 | 0 | 3 | 1 | 1 | 0.6 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 16 | 21 | 5 | 10 | 5 | 8 | 6 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,529 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlStoredProcedureCreateUpdateParameters
|
class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties):
"""Parameters to create and update Cosmos DB storedProcedure.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource: The standard JSON format of a storedProcedure. Required.
:vartype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureResource
:ivar options: A key-value pair of options to be applied for the request. This corresponds to
the headers sent with the request.
:vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"resource": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"location": {"key": "location", "type": "str"},
"tags": {"key": "tags", "type": "{str}"},
"identity": {"key": "identity", "type": "ManagedServiceIdentity"},
"resource": {"key": "properties.resource", "type": "SqlStoredProcedureResource"},
"options": {"key": "properties.options", "type": "CreateUpdateOptions"},
}
def __init__(
self,
*,
resource: "_models.SqlStoredProcedureResource",
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
options: Optional["_models.CreateUpdateOptions"] = None,
**kwargs: Any
) -> None:
"""
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource: The standard JSON format of a storedProcedure. Required.
:paramtype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureResource
:keyword options: A key-value pair of options to be applied for the request. This corresponds
to the headers sent with the request.
:paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
"""
super().__init__(location=location, tags=tags, identity=identity, **kwargs)
self.resource = resource
self.options = options
|
class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties):
'''Parameters to create and update Cosmos DB storedProcedure.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource: The standard JSON format of a storedProcedure. Required.
:vartype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureResource
:ivar options: A key-value pair of options to be applied for the request. This corresponds to
the headers sent with the request.
:vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
'''
def __init__(
self,
*,
resource: "_models.SqlStoredProcedureResource",
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
options: Optional["_models.CreateUpdateOptions"] = None,
**kwargs: Any
) -> None:
'''
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource: The standard JSON format of a storedProcedure. Required.
:paramtype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureResource
:keyword options: A key-value pair of options to be applied for the request. This corresponds
to the headers sent with the request.
:paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
'''
pass
| 2 | 2 | 31 | 0 | 13 | 18 | 1 | 1.47 | 1 | 3 | 0 | 0 | 1 | 2 | 1 | 17 | 80 | 6 | 30 | 15 | 19 | 44 | 7 | 6 | 5 | 1 | 3 | 0 | 1 |
10,530 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlStoredProcedureGetPropertiesResource
|
class SqlStoredProcedureGetPropertiesResource(SqlStoredProcedureResource, ExtendedResourceProperties):
"""SqlStoredProcedureGetPropertiesResource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar rid: A system generated property. A unique identifier.
:vartype rid: str
:ivar ts: A system generated property that denotes the last updated timestamp of the resource.
:vartype ts: float
:ivar etag: A system generated property representing the resource etag required for optimistic
concurrency control.
:vartype etag: str
:ivar id: Name of the Cosmos DB SQL storedProcedure. Required.
:vartype id: str
:ivar body: Body of the Stored Procedure.
:vartype body: str
"""
_validation = {
"rid": {"readonly": True},
"ts": {"readonly": True},
"etag": {"readonly": True},
"id": {"required": True},
}
_attribute_map = {
"rid": {"key": "_rid", "type": "str"},
"ts": {"key": "_ts", "type": "float"},
"etag": {"key": "_etag", "type": "str"},
"id": {"key": "id", "type": "str"},
"body": {"key": "body", "type": "str"},
}
def __init__(
self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin
) -> None:
"""
:keyword id: Name of the Cosmos DB SQL storedProcedure. Required.
:paramtype id: str
:keyword body: Body of the Stored Procedure.
:paramtype body: str
"""
super().__init__(id=id, body=body, **kwargs)
self.rid = None
self.ts = None
self.etag = None
self.id = id
self.body = body
|
class SqlStoredProcedureGetPropertiesResource(SqlStoredProcedureResource, ExtendedResourceProperties):
'''SqlStoredProcedureGetPropertiesResource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar rid: A system generated property. A unique identifier.
:vartype rid: str
:ivar ts: A system generated property that denotes the last updated timestamp of the resource.
:vartype ts: float
:ivar etag: A system generated property representing the resource etag required for optimistic
concurrency control.
:vartype etag: str
:ivar id: Name of the Cosmos DB SQL storedProcedure. Required.
:vartype id: str
:ivar body: Body of the Stored Procedure.
:vartype body: str
'''
def __init__(
self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin
) -> None:
'''
:keyword id: Name of the Cosmos DB SQL storedProcedure. Required.
:paramtype id: str
:keyword body: Body of the Stored Procedure.
:paramtype body: str
'''
pass
| 2 | 2 | 15 | 0 | 9 | 7 | 1 | 0.96 | 2 | 3 | 0 | 0 | 1 | 5 | 1 | 18 | 50 | 6 | 23 | 11 | 19 | 22 | 10 | 9 | 8 | 1 | 3 | 0 | 1 |
10,531 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlStoredProcedureGetResults
|
class SqlStoredProcedureGetResults(ARMResourceProperties):
"""An Azure Cosmos DB storedProcedure.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource:
:vartype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetPropertiesResource
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"location": {"key": "location", "type": "str"},
"tags": {"key": "tags", "type": "{str}"},
"identity": {"key": "identity", "type": "ManagedServiceIdentity"},
"resource": {"key": "properties.resource", "type": "SqlStoredProcedureGetPropertiesResource"},
}
def __init__(
self,
*,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
resource: Optional["_models.SqlStoredProcedureGetPropertiesResource"] = None,
**kwargs: Any
) -> None:
"""
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource:
:paramtype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetPropertiesResource
"""
super().__init__(location=location, tags=tags, identity=identity, **kwargs)
self.resource = resource
|
class SqlStoredProcedureGetResults(ARMResourceProperties):
'''An Azure Cosmos DB storedProcedure.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource:
:vartype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetPropertiesResource
'''
def __init__(
self,
*,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
resource: Optional["_models.SqlStoredProcedureGetPropertiesResource"] = None,
**kwargs: Any
) -> None:
'''
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource:
:paramtype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetPropertiesResource
'''
pass
| 2 | 2 | 26 | 0 | 11 | 15 | 1 | 1.42 | 1 | 3 | 0 | 0 | 1 | 1 | 1 | 17 | 68 | 5 | 26 | 13 | 16 | 37 | 6 | 5 | 4 | 1 | 3 | 0 | 1 |
10,532 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlStoredProcedureListResult
|
class SqlStoredProcedureListResult(_serialization.Model):
"""The List operation response, that contains the storedProcedures and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of storedProcedures and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults]
"""
_validation = {
"value": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[SqlStoredProcedureGetResults]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
|
class SqlStoredProcedureListResult(_serialization.Model):
'''The List operation response, that contains the storedProcedures and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of storedProcedures and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults]
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 4 | 0 | 3 | 1 | 1 | 0.6 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 16 | 21 | 5 | 10 | 5 | 8 | 6 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,533 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlStoredProcedureResource
|
class SqlStoredProcedureResource(_serialization.Model):
"""Cosmos DB SQL storedProcedure resource object.
All required parameters must be populated in order to send to server.
:ivar id: Name of the Cosmos DB SQL storedProcedure. Required.
:vartype id: str
:ivar body: Body of the Stored Procedure.
:vartype body: str
"""
_validation = {
"id": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"body": {"key": "body", "type": "str"},
}
def __init__(
self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin
) -> None:
"""
:keyword id: Name of the Cosmos DB SQL storedProcedure. Required.
:paramtype id: str
:keyword body: Body of the Stored Procedure.
:paramtype body: str
"""
super().__init__(**kwargs)
self.id = id
self.body = body
|
class SqlStoredProcedureResource(_serialization.Model):
'''Cosmos DB SQL storedProcedure resource object.
All required parameters must be populated in order to send to server.
:ivar id: Name of the Cosmos DB SQL storedProcedure. Required.
:vartype id: str
:ivar body: Body of the Stored Procedure.
:vartype body: str
'''
def __init__(
self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin
) -> None:
'''
:keyword id: Name of the Cosmos DB SQL storedProcedure. Required.
:paramtype id: str
:keyword body: Body of the Stored Procedure.
:paramtype body: str
'''
pass
| 2 | 2 | 12 | 0 | 6 | 7 | 1 | 1 | 1 | 3 | 0 | 1 | 1 | 2 | 1 | 16 | 32 | 5 | 14 | 8 | 10 | 14 | 7 | 6 | 5 | 1 | 2 | 0 | 1 |
10,534 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlTriggerCreateUpdateParameters
|
class SqlTriggerCreateUpdateParameters(ARMResourceProperties):
"""Parameters to create and update Cosmos DB trigger.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource: The standard JSON format of a trigger. Required.
:vartype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerResource
:ivar options: A key-value pair of options to be applied for the request. This corresponds to
the headers sent with the request.
:vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"resource": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"location": {"key": "location", "type": "str"},
"tags": {"key": "tags", "type": "{str}"},
"identity": {"key": "identity", "type": "ManagedServiceIdentity"},
"resource": {"key": "properties.resource", "type": "SqlTriggerResource"},
"options": {"key": "properties.options", "type": "CreateUpdateOptions"},
}
def __init__(
self,
*,
resource: "_models.SqlTriggerResource",
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
options: Optional["_models.CreateUpdateOptions"] = None,
**kwargs: Any
) -> None:
"""
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource: The standard JSON format of a trigger. Required.
:paramtype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerResource
:keyword options: A key-value pair of options to be applied for the request. This corresponds
to the headers sent with the request.
:paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
"""
super().__init__(location=location, tags=tags, identity=identity, **kwargs)
self.resource = resource
self.options = options
|
class SqlTriggerCreateUpdateParameters(ARMResourceProperties):
'''Parameters to create and update Cosmos DB trigger.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource: The standard JSON format of a trigger. Required.
:vartype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerResource
:ivar options: A key-value pair of options to be applied for the request. This corresponds to
the headers sent with the request.
:vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
'''
def __init__(
self,
*,
resource: "_models.SqlTriggerResource",
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
options: Optional["_models.CreateUpdateOptions"] = None,
**kwargs: Any
) -> None:
'''
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource: The standard JSON format of a trigger. Required.
:paramtype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerResource
:keyword options: A key-value pair of options to be applied for the request. This corresponds
to the headers sent with the request.
:paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions
'''
pass
| 2 | 2 | 31 | 0 | 13 | 18 | 1 | 1.47 | 1 | 3 | 0 | 0 | 1 | 2 | 1 | 17 | 80 | 6 | 30 | 15 | 19 | 44 | 7 | 6 | 5 | 1 | 3 | 0 | 1 |
10,535 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlTriggerGetPropertiesResource
|
class SqlTriggerGetPropertiesResource(SqlTriggerResource, ExtendedResourceProperties):
"""SqlTriggerGetPropertiesResource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar rid: A system generated property. A unique identifier.
:vartype rid: str
:ivar ts: A system generated property that denotes the last updated timestamp of the resource.
:vartype ts: float
:ivar etag: A system generated property representing the resource etag required for optimistic
concurrency control.
:vartype etag: str
:ivar id: Name of the Cosmos DB SQL trigger. Required.
:vartype id: str
:ivar body: Body of the Trigger.
:vartype body: str
:ivar trigger_type: Type of the Trigger. Known values are: "Pre" and "Post".
:vartype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType
:ivar trigger_operation: The operation the trigger is associated with. Known values are: "All",
"Create", "Update", "Delete", and "Replace".
:vartype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation
"""
_validation = {
"rid": {"readonly": True},
"ts": {"readonly": True},
"etag": {"readonly": True},
"id": {"required": True},
}
_attribute_map = {
"rid": {"key": "_rid", "type": "str"},
"ts": {"key": "_ts", "type": "float"},
"etag": {"key": "_etag", "type": "str"},
"id": {"key": "id", "type": "str"},
"body": {"key": "body", "type": "str"},
"trigger_type": {"key": "triggerType", "type": "str"},
"trigger_operation": {"key": "triggerOperation", "type": "str"},
}
def __init__(
self,
*,
id: str, # pylint: disable=redefined-builtin
body: Optional[str] = None,
trigger_type: Optional[Union[str, "_models.TriggerType"]] = None,
trigger_operation: Optional[Union[str, "_models.TriggerOperation"]] = None,
**kwargs: Any
) -> None:
"""
:keyword id: Name of the Cosmos DB SQL trigger. Required.
:paramtype id: str
:keyword body: Body of the Trigger.
:paramtype body: str
:keyword trigger_type: Type of the Trigger. Known values are: "Pre" and "Post".
:paramtype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType
:keyword trigger_operation: The operation the trigger is associated with. Known values are:
"All", "Create", "Update", "Delete", and "Replace".
:paramtype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation
"""
super().__init__(id=id, body=body, trigger_type=trigger_type, trigger_operation=trigger_operation, **kwargs)
self.rid = None
self.ts = None
self.etag = None
self.id = id
self.body = body
self.trigger_type = trigger_type
self.trigger_operation = trigger_operation
|
class SqlTriggerGetPropertiesResource(SqlTriggerResource, ExtendedResourceProperties):
'''SqlTriggerGetPropertiesResource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar rid: A system generated property. A unique identifier.
:vartype rid: str
:ivar ts: A system generated property that denotes the last updated timestamp of the resource.
:vartype ts: float
:ivar etag: A system generated property representing the resource etag required for optimistic
concurrency control.
:vartype etag: str
:ivar id: Name of the Cosmos DB SQL trigger. Required.
:vartype id: str
:ivar body: Body of the Trigger.
:vartype body: str
:ivar trigger_type: Type of the Trigger. Known values are: "Pre" and "Post".
:vartype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType
:ivar trigger_operation: The operation the trigger is associated with. Known values are: "All",
"Create", "Update", "Delete", and "Replace".
:vartype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation
'''
def __init__(
self,
*,
id: str, # pylint: disable=redefined-builtin
body: Optional[str] = None,
trigger_type: Optional[Union[str, "_models.TriggerType"]] = None,
trigger_operation: Optional[Union[str, "_models.TriggerOperation"]] = None,
**kwargs: Any
) -> None:
'''
:keyword id: Name of the Cosmos DB SQL trigger. Required.
:paramtype id: str
:keyword body: Body of the Trigger.
:paramtype body: str
:keyword trigger_type: Type of the Trigger. Known values are: "Pre" and "Post".
:paramtype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType
:keyword trigger_operation: The operation the trigger is associated with. Known values are:
"All", "Create", "Update", "Delete", and "Replace".
:paramtype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation
'''
pass
| 2 | 2 | 28 | 0 | 17 | 12 | 1 | 0.97 | 2 | 3 | 0 | 0 | 1 | 7 | 1 | 18 | 70 | 6 | 33 | 19 | 23 | 32 | 12 | 11 | 10 | 1 | 3 | 0 | 1 |
10,536 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlTriggerGetResults
|
class SqlTriggerGetResults(ARMResourceProperties):
"""An Azure Cosmos DB trigger.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource:
:vartype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerGetPropertiesResource
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"location": {"key": "location", "type": "str"},
"tags": {"key": "tags", "type": "{str}"},
"identity": {"key": "identity", "type": "ManagedServiceIdentity"},
"resource": {"key": "properties.resource", "type": "SqlTriggerGetPropertiesResource"},
}
def __init__(
self,
*,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
resource: Optional["_models.SqlTriggerGetPropertiesResource"] = None,
**kwargs: Any
) -> None:
"""
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource:
:paramtype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerGetPropertiesResource
"""
super().__init__(location=location, tags=tags, identity=identity, **kwargs)
self.resource = resource
|
class SqlTriggerGetResults(ARMResourceProperties):
'''An Azure Cosmos DB trigger.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource:
:vartype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerGetPropertiesResource
'''
def __init__(
self,
*,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
resource: Optional["_models.SqlTriggerGetPropertiesResource"] = None,
**kwargs: Any
) -> None:
'''
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource:
:paramtype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerGetPropertiesResource
'''
pass
| 2 | 2 | 26 | 0 | 11 | 15 | 1 | 1.42 | 1 | 3 | 0 | 0 | 1 | 1 | 1 | 17 | 68 | 5 | 26 | 13 | 16 | 37 | 6 | 5 | 4 | 1 | 3 | 0 | 1 |
10,537 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlTriggerResource
|
class SqlTriggerResource(_serialization.Model):
"""Cosmos DB SQL trigger resource object.
All required parameters must be populated in order to send to server.
:ivar id: Name of the Cosmos DB SQL trigger. Required.
:vartype id: str
:ivar body: Body of the Trigger.
:vartype body: str
:ivar trigger_type: Type of the Trigger. Known values are: "Pre" and "Post".
:vartype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType
:ivar trigger_operation: The operation the trigger is associated with. Known values are: "All",
"Create", "Update", "Delete", and "Replace".
:vartype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation
"""
_validation = {
"id": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"body": {"key": "body", "type": "str"},
"trigger_type": {"key": "triggerType", "type": "str"},
"trigger_operation": {"key": "triggerOperation", "type": "str"},
}
def __init__(
self,
*,
id: str, # pylint: disable=redefined-builtin
body: Optional[str] = None,
trigger_type: Optional[Union[str, "_models.TriggerType"]] = None,
trigger_operation: Optional[Union[str, "_models.TriggerOperation"]] = None,
**kwargs: Any
) -> None:
"""
:keyword id: Name of the Cosmos DB SQL trigger. Required.
:paramtype id: str
:keyword body: Body of the Trigger.
:paramtype body: str
:keyword trigger_type: Type of the Trigger. Known values are: "Pre" and "Post".
:paramtype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType
:keyword trigger_operation: The operation the trigger is associated with. Known values are:
"All", "Create", "Update", "Delete", and "Replace".
:paramtype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation
"""
super().__init__(**kwargs)
self.id = id
self.body = body
self.trigger_type = trigger_type
self.trigger_operation = trigger_operation
|
class SqlTriggerResource(_serialization.Model):
'''Cosmos DB SQL trigger resource object.
All required parameters must be populated in order to send to server.
:ivar id: Name of the Cosmos DB SQL trigger. Required.
:vartype id: str
:ivar body: Body of the Trigger.
:vartype body: str
:ivar trigger_type: Type of the Trigger. Known values are: "Pre" and "Post".
:vartype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType
:ivar trigger_operation: The operation the trigger is associated with. Known values are: "All",
"Create", "Update", "Delete", and "Replace".
:vartype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation
'''
def __init__(
self,
*,
id: str, # pylint: disable=redefined-builtin
body: Optional[str] = None,
trigger_type: Optional[Union[str, "_models.TriggerType"]] = None,
trigger_operation: Optional[Union[str, "_models.TriggerOperation"]] = None,
**kwargs: Any
) -> None:
'''
:keyword id: Name of the Cosmos DB SQL trigger. Required.
:paramtype id: str
:keyword body: Body of the Trigger.
:paramtype body: str
:keyword trigger_type: Type of the Trigger. Known values are: "Pre" and "Post".
:paramtype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType
:keyword trigger_operation: The operation the trigger is associated with. Known values are:
"All", "Create", "Update", "Delete", and "Replace".
:paramtype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation
'''
pass
| 2 | 2 | 25 | 0 | 14 | 12 | 1 | 1 | 1 | 3 | 0 | 1 | 1 | 4 | 1 | 16 | 52 | 5 | 24 | 16 | 14 | 24 | 9 | 8 | 7 | 1 | 2 | 0 | 1 |
10,538 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.ThroughputPoolAccountsListResult
|
class ThroughputPoolAccountsListResult(_serialization.Model):
"""The List operation response, that contains the global database accounts and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of global database accounts in a throughput pool and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource]
:ivar next_link: The link used to get the next page of results.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[ThroughputPoolAccountResource]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
|
class ThroughputPoolAccountsListResult(_serialization.Model):
'''The List operation response, that contains the global database accounts and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of global database accounts in a throughput pool and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource]
:ivar next_link: The link used to get the next page of results.
:vartype next_link: str
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 5 | 0 | 4 | 1 | 1 | 0.62 | 1 | 2 | 0 | 0 | 1 | 2 | 1 | 16 | 26 | 5 | 13 | 6 | 11 | 8 | 7 | 6 | 5 | 1 | 2 | 0 | 1 |
10,539 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.ThroughputPoolResource
|
class ThroughputPoolResource(TrackedResource):
"""An Azure Cosmos DB Throughputpool.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. E.g.
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData
:ivar tags: Resource tags.
:vartype tags: dict[str, str]
:ivar location: The geo-location where the resource lives. Required.
:vartype location: str
:ivar provisioning_state: A provisioning state of the ThroughputPool. Known values are:
"Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded",
"Failed", "Canceled", and "Updating".
:vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status
:ivar max_throughput: Value for throughput to be shared among CosmosDB resources in the pool.
:vartype max_throughput: int
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"system_data": {"readonly": True},
"location": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"system_data": {"key": "systemData", "type": "SystemData"},
"tags": {"key": "tags", "type": "{str}"},
"location": {"key": "location", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"max_throughput": {"key": "properties.maxThroughput", "type": "int"},
}
def __init__(
self,
*,
location: str,
tags: Optional[Dict[str, str]] = None,
provisioning_state: Optional[Union[str, "_models.Status"]] = None,
max_throughput: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword tags: Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The geo-location where the resource lives. Required.
:paramtype location: str
:keyword provisioning_state: A provisioning state of the ThroughputPool. Known values are:
"Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded",
"Failed", "Canceled", and "Updating".
:paramtype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status
:keyword max_throughput: Value for throughput to be shared among CosmosDB resources in the
pool.
:paramtype max_throughput: int
"""
super().__init__(tags=tags, location=location, **kwargs)
self.provisioning_state = provisioning_state
self.max_throughput = max_throughput
|
class ThroughputPoolResource(TrackedResource):
'''An Azure Cosmos DB Throughputpool.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. E.g.
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData
:ivar tags: Resource tags.
:vartype tags: dict[str, str]
:ivar location: The geo-location where the resource lives. Required.
:vartype location: str
:ivar provisioning_state: A provisioning state of the ThroughputPool. Known values are:
"Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded",
"Failed", "Canceled", and "Updating".
:vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status
:ivar max_throughput: Value for throughput to be shared among CosmosDB resources in the pool.
:vartype max_throughput: int
'''
def __init__(
self,
*,
location: str,
tags: Optional[Dict[str, str]] = None,
provisioning_state: Optional[Union[str, "_models.Status"]] = None,
max_throughput: Optional[int] = None,
**kwargs: Any
) -> None:
'''
:keyword tags: Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The geo-location where the resource lives. Required.
:paramtype location: str
:keyword provisioning_state: A provisioning state of the ThroughputPool. Known values are:
"Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded",
"Failed", "Canceled", and "Updating".
:paramtype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status
:keyword max_throughput: Value for throughput to be shared among CosmosDB resources in the
pool.
:paramtype max_throughput: int
'''
pass
| 2 | 2 | 25 | 0 | 12 | 13 | 1 | 1.27 | 1 | 4 | 0 | 0 | 1 | 2 | 1 | 18 | 74 | 6 | 30 | 14 | 20 | 38 | 7 | 6 | 5 | 1 | 4 | 0 | 1 |
10,540 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.ThroughputPoolUpdate
|
class ThroughputPoolUpdate(_serialization.Model):
"""Represents a throughput pool resource for updates.
:ivar provisioning_state: A provisioning state of the ThroughputPool. Known values are:
"Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded",
"Failed", "Canceled", and "Updating".
:vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status
:ivar max_throughput: Value for throughput to be shared among CosmosDB resources in the pool.
:vartype max_throughput: int
"""
_attribute_map = {
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"max_throughput": {"key": "properties.maxThroughput", "type": "int"},
}
def __init__(
self,
*,
provisioning_state: Optional[Union[str, "_models.Status"]] = None,
max_throughput: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword provisioning_state: A provisioning state of the ThroughputPool. Known values are:
"Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded",
"Failed", "Canceled", and "Updating".
:paramtype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status
:keyword max_throughput: Value for throughput to be shared among CosmosDB resources in the
pool.
:paramtype max_throughput: int
"""
super().__init__(**kwargs)
self.provisioning_state = provisioning_state
self.max_throughput = max_throughput
|
class ThroughputPoolUpdate(_serialization.Model):
'''Represents a throughput pool resource for updates.
:ivar provisioning_state: A provisioning state of the ThroughputPool. Known values are:
"Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded",
"Failed", "Canceled", and "Updating".
:vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status
:ivar max_throughput: Value for throughput to be shared among CosmosDB resources in the pool.
:vartype max_throughput: int
'''
def __init__(
self,
*,
provisioning_state: Optional[Union[str, "_models.Status"]] = None,
max_throughput: Optional[int] = None,
**kwargs: Any
) -> None:
'''
:keyword provisioning_state: A provisioning state of the ThroughputPool. Known values are:
"Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded",
"Failed", "Canceled", and "Updating".
:paramtype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status
:keyword max_throughput: Value for throughput to be shared among CosmosDB resources in the
pool.
:paramtype max_throughput: int
'''
pass
| 2 | 2 | 19 | 0 | 10 | 9 | 1 | 1.13 | 1 | 4 | 0 | 0 | 1 | 2 | 1 | 16 | 35 | 3 | 15 | 11 | 7 | 17 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,541 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_collection_partition_region_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._collection_partition_region_operations.CollectionPartitionRegionOperations
|
class CollectionPartitionRegionOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`collection_partition_region` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_metrics(
self,
resource_group_name: str,
account_name: str,
region: str,
database_rid: str,
collection_rid: str,
filter: str,
**kwargs: Any
) -> Iterable["_models.PartitionMetric"]:
"""Retrieves the metrics determined by the given filter for the given collection and region, split
by partition.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region: Cosmos DB region, with spaces between words and each word capitalized. Required.
:type region: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param collection_rid: Cosmos DB collection rid. Required.
:type collection_rid: str
:param filter: An OData filter expression that describes a subset of metrics to return. The
parameters that can be filtered are name.value (name of the metric, can have an or of multiple
names), startTime, endTime, and timeGrain. The supported operator is eq. Required.
:type filter: str
:return: An iterator like instance of either PartitionMetric or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_metrics_request(
resource_group_name=resource_group_name,
account_name=account_name,
region=region,
database_rid=database_rid,
collection_rid=collection_rid,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("PartitionMetricListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
|
class CollectionPartitionRegionOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`collection_partition_region` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list_metrics(
self,
resource_group_name: str,
account_name: str,
region: str,
database_rid: str,
collection_rid: str,
filter: str,
**kwargs: Any
) -> Iterable["_models.PartitionMetric"]:
'''Retrieves the metrics determined by the given filter for the given collection and region, split
by partition.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region: Cosmos DB region, with spaces between words and each word capitalized. Required.
:type region: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param collection_rid: Cosmos DB collection rid. Required.
:type collection_rid: str
:param filter: An OData filter expression that describes a subset of metrics to return. The
parameters that can be filtered are name.value (name of the metric, can have an or of multiple
names), startTime, endTime, and timeGrain. The supported operator is eq. Required.
:type filter: str
:return: An iterator like instance of either PartitionMetric or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
| 7 | 2 | 32 | 3 | 24 | 5 | 2 | 0.4 | 0 | 5 | 0 | 0 | 2 | 4 | 2 | 2 | 123 | 16 | 78 | 36 | 62 | 31 | 42 | 26 | 36 | 5 | 0 | 1 | 12 |
10,542 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_collection_region_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._collection_region_operations.CollectionRegionOperations
|
class CollectionRegionOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`collection_region` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_metrics(
self,
resource_group_name: str,
account_name: str,
region: str,
database_rid: str,
collection_rid: str,
filter: str,
**kwargs: Any
) -> Iterable["_models.Metric"]:
"""Retrieves the metrics determined by the given filter for the given database account, collection
and region.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region: Cosmos DB region, with spaces between words and each word capitalized. Required.
:type region: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param collection_rid: Cosmos DB collection rid. Required.
:type collection_rid: str
:param filter: An OData filter expression that describes a subset of metrics to return. The
parameters that can be filtered are name.value (name of the metric, can have an or of multiple
names), startTime, endTime, and timeGrain. The supported operator is eq. Required.
:type filter: str
:return: An iterator like instance of either Metric or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_metrics_request(
resource_group_name=resource_group_name,
account_name=account_name,
region=region,
database_rid=database_rid,
collection_rid=collection_rid,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("MetricListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
|
class CollectionRegionOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`collection_region` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list_metrics(
self,
resource_group_name: str,
account_name: str,
region: str,
database_rid: str,
collection_rid: str,
filter: str,
**kwargs: Any
) -> Iterable["_models.Metric"]:
'''Retrieves the metrics determined by the given filter for the given database account, collection
and region.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region: Cosmos DB region, with spaces between words and each word capitalized. Required.
:type region: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param collection_rid: Cosmos DB collection rid. Required.
:type collection_rid: str
:param filter: An OData filter expression that describes a subset of metrics to return. The
parameters that can be filtered are name.value (name of the metric, can have an or of multiple
names), startTime, endTime, and timeGrain. The supported operator is eq. Required.
:type filter: str
:return: An iterator like instance of either Metric or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
| 7 | 2 | 32 | 3 | 24 | 5 | 2 | 0.4 | 0 | 5 | 0 | 0 | 2 | 4 | 2 | 2 | 123 | 16 | 78 | 36 | 62 | 31 | 42 | 26 | 36 | 5 | 0 | 1 | 12 |
10,543 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_data_transfer_jobs_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._data_transfer_jobs_operations.DataTransferJobsOperations
|
class DataTransferJobsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`data_transfer_jobs` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@overload
def create(
self,
resource_group_name: str,
account_name: str,
job_name: str,
job_create_parameters: _models.CreateJobRequest,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.DataTransferJobGetResults:
"""Creates a Data Transfer Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:param job_create_parameters: Required.
:type job_create_parameters: ~azure.mgmt.cosmosdb.models.CreateJobRequest
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def create(
self,
resource_group_name: str,
account_name: str,
job_name: str,
job_create_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.DataTransferJobGetResults:
"""Creates a Data Transfer Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:param job_create_parameters: Required.
:type job_create_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def create(
self,
resource_group_name: str,
account_name: str,
job_name: str,
job_create_parameters: Union[_models.CreateJobRequest, IO[bytes]],
**kwargs: Any
) -> _models.DataTransferJobGetResults:
"""Creates a Data Transfer Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:param job_create_parameters: Is either a CreateJobRequest type or a IO[bytes] type. Required.
:type job_create_parameters: ~azure.mgmt.cosmosdb.models.CreateJobRequest or IO[bytes]
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(job_create_parameters, (IOBase, bytes)):
_content = job_create_parameters
else:
_json = self._serialize.body(job_create_parameters, "CreateJobRequest")
_request = build_create_request(
resource_group_name=resource_group_name,
account_name=account_name,
job_name=job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def get(
self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any
) -> _models.DataTransferJobGetResults:
"""Get a Data Transfer Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
job_name=job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def pause(
self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any
) -> _models.DataTransferJobGetResults:
"""Pause a Data Transfer Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None)
_request = build_pause_request(
resource_group_name=resource_group_name,
account_name=account_name,
job_name=job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def resume(
self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any
) -> _models.DataTransferJobGetResults:
"""Resumes a Data Transfer Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None)
_request = build_resume_request(
resource_group_name=resource_group_name,
account_name=account_name,
job_name=job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def cancel(
self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any
) -> _models.DataTransferJobGetResults:
"""Cancels a Data Transfer Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None)
_request = build_cancel_request(
resource_group_name=resource_group_name,
account_name=account_name,
job_name=job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def complete(
self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any
) -> _models.DataTransferJobGetResults:
"""Completes a Data Transfer Online Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None)
_request = build_complete_request(
resource_group_name=resource_group_name,
account_name=account_name,
job_name=job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def list_by_database_account(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.DataTransferJobGetResults"]:
"""Get a list of Data Transfer jobs.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either DataTransferJobGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DataTransferJobGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DataTransferJobFeedResults] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_by_database_account_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("DataTransferJobFeedResults", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
|
class DataTransferJobsOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`data_transfer_jobs` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@overload
def create(
self,
resource_group_name: str,
account_name: str,
job_name: str,
job_create_parameters: _models.CreateJobRequest,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.DataTransferJobGetResults:
'''Creates a Data Transfer Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:param job_create_parameters: Required.
:type job_create_parameters: ~azure.mgmt.cosmosdb.models.CreateJobRequest
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def create(
self,
resource_group_name: str,
account_name: str,
job_name: str,
job_create_parameters: _models.CreateJobRequest,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.DataTransferJobGetResults:
'''Creates a Data Transfer Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:param job_create_parameters: Required.
:type job_create_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def create(
self,
resource_group_name: str,
account_name: str,
job_name: str,
job_create_parameters: _models.CreateJobRequest,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.DataTransferJobGetResults:
'''Creates a Data Transfer Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:param job_create_parameters: Is either a CreateJobRequest type or a IO[bytes] type. Required.
:type job_create_parameters: ~azure.mgmt.cosmosdb.models.CreateJobRequest or IO[bytes]
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def get(
self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any
) -> _models.DataTransferJobGetResults:
'''Get a Data Transfer Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def pause(
self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any
) -> _models.DataTransferJobGetResults:
'''Pause a Data Transfer Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def resume(
self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any
) -> _models.DataTransferJobGetResults:
'''Resumes a Data Transfer Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def cancel(
self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any
) -> _models.DataTransferJobGetResults:
'''Cancels a Data Transfer Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def complete(
self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any
) -> _models.DataTransferJobGetResults:
'''Completes a Data Transfer Online Job.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param job_name: Name of the Data Transfer Job. Required.
:type job_name: str
:return: DataTransferJobGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def list_by_database_account(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.DataTransferJobGetResults"]:
'''Get a list of Data Transfer jobs.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either DataTransferJobGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DataTransferJobGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
| 23 | 10 | 43 | 6 | 28 | 11 | 3 | 0.45 | 0 | 7 | 0 | 0 | 10 | 4 | 10 | 10 | 541 | 87 | 327 | 143 | 267 | 147 | 165 | 97 | 151 | 5 | 0 | 1 | 33 |
10,544 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_database_account_region_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._database_account_region_operations.DatabaseAccountRegionOperations
|
class DatabaseAccountRegionOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`database_account_region` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_metrics(
self, resource_group_name: str, account_name: str, region: str, filter: str, **kwargs: Any
) -> Iterable["_models.Metric"]:
"""Retrieves the metrics determined by the given filter for the given database account and region.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region: Cosmos DB region, with spaces between words and each word capitalized. Required.
:type region: str
:param filter: An OData filter expression that describes a subset of metrics to return. The
parameters that can be filtered are name.value (name of the metric, can have an or of multiple
names), startTime, endTime, and timeGrain. The supported operator is eq. Required.
:type filter: str
:return: An iterator like instance of either Metric or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_metrics_request(
resource_group_name=resource_group_name,
account_name=account_name,
region=region,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("MetricListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
|
class DatabaseAccountRegionOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`database_account_region` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list_metrics(
self, resource_group_name: str, account_name: str, region: str, filter: str, **kwargs: Any
) -> Iterable["_models.Metric"]:
'''Retrieves the metrics determined by the given filter for the given database account and region.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region: Cosmos DB region, with spaces between words and each word capitalized. Required.
:type region: str
:param filter: An OData filter expression that describes a subset of metrics to return. The
parameters that can be filtered are name.value (name of the metric, can have an or of multiple
names), startTime, endTime, and timeGrain. The supported operator is eq. Required.
:type filter: str
:return: An iterator like instance of either Metric or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
| 7 | 2 | 29 | 3 | 22 | 4 | 2 | 0.38 | 0 | 5 | 0 | 0 | 2 | 4 | 2 | 2 | 109 | 16 | 69 | 29 | 60 | 26 | 42 | 26 | 36 | 5 | 0 | 1 | 12 |
10,545 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_database_accounts_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._database_accounts_operations.DatabaseAccountsOperations
|
class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`database_accounts` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.DatabaseAccountGetResults:
"""Retrieves the properties of an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: DatabaseAccountGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DatabaseAccountGetResults] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _update_initial(
self,
resource_group_name: str,
account_name: str,
update_parameters: Union[_models.DatabaseAccountUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(update_parameters, (IOBase, bytes)):
_content = update_parameters
else:
_json = self._serialize.body(update_parameters, "DatabaseAccountUpdateParameters")
_request = build_update_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
def begin_update(
self,
resource_group_name: str,
account_name: str,
update_parameters: _models.DatabaseAccountUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DatabaseAccountGetResults]:
"""Updates the properties of an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param update_parameters: The parameters to provide for the current database account. Required.
:type update_parameters: ~azure.mgmt.cosmosdb.models.DatabaseAccountUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DatabaseAccountGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update(
self,
resource_group_name: str,
account_name: str,
update_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DatabaseAccountGetResults]:
"""Updates the properties of an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param update_parameters: The parameters to provide for the current database account. Required.
:type update_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DatabaseAccountGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update(
self,
resource_group_name: str,
account_name: str,
update_parameters: Union[_models.DatabaseAccountUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.DatabaseAccountGetResults]:
"""Updates the properties of an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param update_parameters: The parameters to provide for the current database account. Is either
a DatabaseAccountUpdateParameters type or a IO[bytes] type. Required.
:type update_parameters: ~azure.mgmt.cosmosdb.models.DatabaseAccountUpdateParameters or
IO[bytes]
:return: An instance of LROPoller that returns either DatabaseAccountGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.DatabaseAccountGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_initial(
resource_group_name=resource_group_name,
account_name=account_name,
update_parameters=update_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.DatabaseAccountGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.DatabaseAccountGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _create_or_update_initial(
self,
resource_group_name: str,
account_name: str,
create_update_parameters: Union[_models.DatabaseAccountCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(create_update_parameters, (IOBase, bytes)):
_content = create_update_parameters
else:
_json = self._serialize.body(create_update_parameters, "DatabaseAccountCreateUpdateParameters")
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_or_update(
self,
resource_group_name: str,
account_name: str,
create_update_parameters: _models.DatabaseAccountCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DatabaseAccountGetResults]:
"""Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when
performing updates on an account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_parameters: The parameters to provide for the current database account.
Required.
:type create_update_parameters:
~azure.mgmt.cosmosdb.models.DatabaseAccountCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DatabaseAccountGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
account_name: str,
create_update_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DatabaseAccountGetResults]:
"""Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when
performing updates on an account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_parameters: The parameters to provide for the current database account.
Required.
:type create_update_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DatabaseAccountGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
account_name: str,
create_update_parameters: Union[_models.DatabaseAccountCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.DatabaseAccountGetResults]:
"""Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when
performing updates on an account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_parameters: The parameters to provide for the current database account. Is
either a DatabaseAccountCreateUpdateParameters type or a IO[bytes] type. Required.
:type create_update_parameters:
~azure.mgmt.cosmosdb.models.DatabaseAccountCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either DatabaseAccountGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.DatabaseAccountGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
account_name=account_name,
create_update_parameters=create_update_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.DatabaseAccountGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.DatabaseAccountGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]:
"""Deletes an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
account_name=account_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _failover_priority_change_initial(
self,
resource_group_name: str,
account_name: str,
failover_parameters: Union[_models.FailoverPolicies, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(failover_parameters, (IOBase, bytes)):
_content = failover_parameters
else:
_json = self._serialize.body(failover_parameters, "FailoverPolicies")
_request = build_failover_priority_change_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_failover_priority_change(
self,
resource_group_name: str,
account_name: str,
failover_parameters: _models.FailoverPolicies,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
"""Changes the failover priority for the Azure Cosmos DB database account. A failover priority of
0 indicates a write region. The maximum value for a failover priority = (total number of
regions - 1). Failover priority values must be unique for each of the regions in which the
database account exists.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param failover_parameters: The new failover policies for the database account. Required.
:type failover_parameters: ~azure.mgmt.cosmosdb.models.FailoverPolicies
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_failover_priority_change(
self,
resource_group_name: str,
account_name: str,
failover_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
"""Changes the failover priority for the Azure Cosmos DB database account. A failover priority of
0 indicates a write region. The maximum value for a failover priority = (total number of
regions - 1). Failover priority values must be unique for each of the regions in which the
database account exists.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param failover_parameters: The new failover policies for the database account. Required.
:type failover_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_failover_priority_change(
self,
resource_group_name: str,
account_name: str,
failover_parameters: Union[_models.FailoverPolicies, IO[bytes]],
**kwargs: Any
) -> LROPoller[None]:
"""Changes the failover priority for the Azure Cosmos DB database account. A failover priority of
0 indicates a write region. The maximum value for a failover priority = (total number of
regions - 1). Failover priority values must be unique for each of the regions in which the
database account exists.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param failover_parameters: The new failover policies for the database account. Is either a
FailoverPolicies type or a IO[bytes] type. Required.
:type failover_parameters: ~azure.mgmt.cosmosdb.models.FailoverPolicies or IO[bytes]
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._failover_priority_change_initial(
resource_group_name=resource_group_name,
account_name=account_name,
failover_parameters=failover_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.DatabaseAccountGetResults"]:
"""Lists all the Azure Cosmos DB database accounts available under the subscription.
:return: An iterator like instance of either DatabaseAccountGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DatabaseAccountsListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("DatabaseAccountsListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def list_by_resource_group(
self, resource_group_name: str, **kwargs: Any
) -> Iterable["_models.DatabaseAccountGetResults"]:
"""Lists all the Azure Cosmos DB database accounts available under the given resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:return: An iterator like instance of either DatabaseAccountGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DatabaseAccountsListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("DatabaseAccountsListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def list_keys(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> _models.DatabaseAccountListKeysResult:
"""Lists the access keys for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: DatabaseAccountListKeysResult or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListKeysResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DatabaseAccountListKeysResult] = kwargs.pop("cls", None)
_request = build_list_keys_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountListKeysResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def list_connection_strings(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> _models.DatabaseAccountListConnectionStringsResult:
"""Lists the connection strings for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: DatabaseAccountListConnectionStringsResult or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListConnectionStringsResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DatabaseAccountListConnectionStringsResult] = kwargs.pop("cls", None)
_request = build_list_connection_strings_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountListConnectionStringsResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _offline_region_initial(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_offline: Union[_models.RegionForOnlineOffline, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(region_parameter_for_offline, (IOBase, bytes)):
_content = region_parameter_for_offline
else:
_json = self._serialize.body(region_parameter_for_offline, "RegionForOnlineOffline")
_request = build_offline_region_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_offline_region(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_offline: _models.RegionForOnlineOffline,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
"""Offline the specified region for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region_parameter_for_offline: Cosmos DB region to offline for the database account.
Required.
:type region_parameter_for_offline: ~azure.mgmt.cosmosdb.models.RegionForOnlineOffline
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_offline_region(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_offline: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
"""Offline the specified region for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region_parameter_for_offline: Cosmos DB region to offline for the database account.
Required.
:type region_parameter_for_offline: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_offline_region(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_offline: Union[_models.RegionForOnlineOffline, IO[bytes]],
**kwargs: Any
) -> LROPoller[None]:
"""Offline the specified region for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region_parameter_for_offline: Cosmos DB region to offline for the database account. Is
either a RegionForOnlineOffline type or a IO[bytes] type. Required.
:type region_parameter_for_offline: ~azure.mgmt.cosmosdb.models.RegionForOnlineOffline or
IO[bytes]
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._offline_region_initial(
resource_group_name=resource_group_name,
account_name=account_name,
region_parameter_for_offline=region_parameter_for_offline,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _online_region_initial(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_online: Union[_models.RegionForOnlineOffline, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(region_parameter_for_online, (IOBase, bytes)):
_content = region_parameter_for_online
else:
_json = self._serialize.body(region_parameter_for_online, "RegionForOnlineOffline")
_request = build_online_region_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_online_region(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_online: _models.RegionForOnlineOffline,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
"""Online the specified region for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region_parameter_for_online: Cosmos DB region to online for the database account.
Required.
:type region_parameter_for_online: ~azure.mgmt.cosmosdb.models.RegionForOnlineOffline
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_online_region(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_online: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
"""Online the specified region for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region_parameter_for_online: Cosmos DB region to online for the database account.
Required.
:type region_parameter_for_online: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_online_region(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_online: Union[_models.RegionForOnlineOffline, IO[bytes]],
**kwargs: Any
) -> LROPoller[None]:
"""Online the specified region for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region_parameter_for_online: Cosmos DB region to online for the database account. Is
either a RegionForOnlineOffline type or a IO[bytes] type. Required.
:type region_parameter_for_online: ~azure.mgmt.cosmosdb.models.RegionForOnlineOffline or
IO[bytes]
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._online_region_initial(
resource_group_name=resource_group_name,
account_name=account_name,
region_parameter_for_online=region_parameter_for_online,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def get_read_only_keys(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> _models.DatabaseAccountListReadOnlyKeysResult:
"""Lists the read-only access keys for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: DatabaseAccountListReadOnlyKeysResult or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListReadOnlyKeysResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DatabaseAccountListReadOnlyKeysResult] = kwargs.pop("cls", None)
_request = build_get_read_only_keys_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountListReadOnlyKeysResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def list_read_only_keys(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> _models.DatabaseAccountListReadOnlyKeysResult:
"""Lists the read-only access keys for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: DatabaseAccountListReadOnlyKeysResult or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListReadOnlyKeysResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DatabaseAccountListReadOnlyKeysResult] = kwargs.pop("cls", None)
_request = build_list_read_only_keys_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountListReadOnlyKeysResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _regenerate_key_initial(
self,
resource_group_name: str,
account_name: str,
key_to_regenerate: Union[_models.DatabaseAccountRegenerateKeyParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(key_to_regenerate, (IOBase, bytes)):
_content = key_to_regenerate
else:
_json = self._serialize.body(key_to_regenerate, "DatabaseAccountRegenerateKeyParameters")
_request = build_regenerate_key_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_regenerate_key(
self,
resource_group_name: str,
account_name: str,
key_to_regenerate: _models.DatabaseAccountRegenerateKeyParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
"""Regenerates an access key for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param key_to_regenerate: The name of the key to regenerate. Required.
:type key_to_regenerate: ~azure.mgmt.cosmosdb.models.DatabaseAccountRegenerateKeyParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_regenerate_key(
self,
resource_group_name: str,
account_name: str,
key_to_regenerate: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
"""Regenerates an access key for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param key_to_regenerate: The name of the key to regenerate. Required.
:type key_to_regenerate: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_regenerate_key(
self,
resource_group_name: str,
account_name: str,
key_to_regenerate: Union[_models.DatabaseAccountRegenerateKeyParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[None]:
"""Regenerates an access key for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param key_to_regenerate: The name of the key to regenerate. Is either a
DatabaseAccountRegenerateKeyParameters type or a IO[bytes] type. Required.
:type key_to_regenerate: ~azure.mgmt.cosmosdb.models.DatabaseAccountRegenerateKeyParameters or
IO[bytes]
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._regenerate_key_initial(
resource_group_name=resource_group_name,
account_name=account_name,
key_to_regenerate=key_to_regenerate,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def check_name_exists(self, account_name: str, **kwargs: Any) -> bool:
"""Checks that the Azure Cosmos DB account name already exists. A valid account name may contain
only lowercase letters, numbers, and the '-' character, and must be between 3 and 50
characters.
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: bool or the result of cls(response)
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
_request = build_check_name_exists_request(
account_name=account_name,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 404]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {}) # type: ignore
return 200 <= response.status_code <= 299
@distributed_trace
def list_metrics(
self, resource_group_name: str, account_name: str, filter: str, **kwargs: Any
) -> Iterable["_models.Metric"]:
"""Retrieves the metrics determined by the given filter for the given database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param filter: An OData filter expression that describes a subset of metrics to return. The
parameters that can be filtered are name.value (name of the metric, can have an or of multiple
names), startTime, endTime, and timeGrain. The supported operator is eq. Required.
:type filter: str
:return: An iterator like instance of either Metric or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_metrics_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("MetricListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def list_usages(
self, resource_group_name: str, account_name: str, filter: Optional[str] = None, **kwargs: Any
) -> Iterable["_models.Usage"]:
"""Retrieves the usages (most recent data) for the given database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param filter: An OData filter expression that describes a subset of usages to return. The
supported parameter is name.value (name of the metric, can have an or of multiple names).
Default value is None.
:type filter: str
:return: An iterator like instance of either Usage or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Usage]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_usages_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("UsagesResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def list_metric_definitions(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.MetricDefinition"]:
"""Retrieves metric definitions for the given database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either MetricDefinition or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinition]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_metric_definitions_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("MetricDefinitionsListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
|
class DatabaseAccountsOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`database_accounts` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.DatabaseAccountGetResults:
'''Retrieves the properties of an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: DatabaseAccountGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _update_initial(
self,
resource_group_name: str,
account_name: str,
update_parameters: Union[_models.DatabaseAccountUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_update(
self,
resource_group_name: str,
account_name: str,
update_parameters: _models.DatabaseAccountUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DatabaseAccountGetResults]:
'''Updates the properties of an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param update_parameters: The parameters to provide for the current database account. Required.
:type update_parameters: ~azure.mgmt.cosmosdb.models.DatabaseAccountUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DatabaseAccountGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_update(
self,
resource_group_name: str,
account_name: str,
update_parameters: _models.DatabaseAccountUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DatabaseAccountGetResults]:
'''Updates the properties of an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param update_parameters: The parameters to provide for the current database account. Required.
:type update_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DatabaseAccountGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_update(
self,
resource_group_name: str,
account_name: str,
update_parameters: _models.DatabaseAccountUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DatabaseAccountGetResults]:
'''Updates the properties of an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param update_parameters: The parameters to provide for the current database account. Is either
a DatabaseAccountUpdateParameters type or a IO[bytes] type. Required.
:type update_parameters: ~azure.mgmt.cosmosdb.models.DatabaseAccountUpdateParameters or
IO[bytes]
:return: An instance of LROPoller that returns either DatabaseAccountGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _create_or_update_initial(
self,
resource_group_name: str,
account_name: str,
create_update_parameters: Union[_models.DatabaseAccountCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_create_or_update(
self,
resource_group_name: str,
account_name: str,
create_update_parameters: _models.DatabaseAccountCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DatabaseAccountGetResults]:
'''Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when
performing updates on an account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_parameters: The parameters to provide for the current database account.
Required.
:type create_update_parameters:
~azure.mgmt.cosmosdb.models.DatabaseAccountCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DatabaseAccountGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_create_or_update(
self,
resource_group_name: str,
account_name: str,
create_update_parameters: _models.DatabaseAccountCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DatabaseAccountGetResults]:
'''Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when
performing updates on an account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_parameters: The parameters to provide for the current database account.
Required.
:type create_update_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DatabaseAccountGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
account_name: str,
create_update_parameters: _models.DatabaseAccountCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DatabaseAccountGetResults]:
'''Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when
performing updates on an account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_parameters: The parameters to provide for the current database account. Is
either a DatabaseAccountCreateUpdateParameters type or a IO[bytes] type. Required.
:type create_update_parameters:
~azure.mgmt.cosmosdb.models.DatabaseAccountCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either DatabaseAccountGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]:
pass
@distributed_trace
def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]:
'''Deletes an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _failover_priority_change_initial(
self,
resource_group_name: str,
account_name: str,
failover_parameters: Union[_models.FailoverPolicies, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_failover_priority_change(
self,
resource_group_name: str,
account_name: str,
failover_parameters: _models.FailoverPolicies,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
'''Changes the failover priority for the Azure Cosmos DB database account. A failover priority of
0 indicates a write region. The maximum value for a failover priority = (total number of
regions - 1). Failover priority values must be unique for each of the regions in which the
database account exists.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param failover_parameters: The new failover policies for the database account. Required.
:type failover_parameters: ~azure.mgmt.cosmosdb.models.FailoverPolicies
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_failover_priority_change(
self,
resource_group_name: str,
account_name: str,
failover_parameters: _models.FailoverPolicies,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
'''Changes the failover priority for the Azure Cosmos DB database account. A failover priority of
0 indicates a write region. The maximum value for a failover priority = (total number of
regions - 1). Failover priority values must be unique for each of the regions in which the
database account exists.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param failover_parameters: The new failover policies for the database account. Required.
:type failover_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_failover_priority_change(
self,
resource_group_name: str,
account_name: str,
failover_parameters: _models.FailoverPolicies,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
'''Changes the failover priority for the Azure Cosmos DB database account. A failover priority of
0 indicates a write region. The maximum value for a failover priority = (total number of
regions - 1). Failover priority values must be unique for each of the regions in which the
database account exists.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param failover_parameters: The new failover policies for the database account. Is either a
FailoverPolicies type or a IO[bytes] type. Required.
:type failover_parameters: ~azure.mgmt.cosmosdb.models.FailoverPolicies or IO[bytes]
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.DatabaseAccountGetResults"]:
'''Lists all the Azure Cosmos DB database accounts available under the subscription.
:return: An iterator like instance of either DatabaseAccountGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def list_by_resource_group(
self, resource_group_name: str, **kwargs: Any
) -> Iterable["_models.DatabaseAccountGetResults"]:
'''Lists all the Azure Cosmos DB database accounts available under the given resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:return: An iterator like instance of either DatabaseAccountGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def list_keys(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> _models.DatabaseAccountListKeysResult:
'''Lists the access keys for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: DatabaseAccountListKeysResult or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListKeysResult
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def list_connection_strings(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> _models.DatabaseAccountListConnectionStringsResult:
'''Lists the connection strings for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: DatabaseAccountListConnectionStringsResult or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListConnectionStringsResult
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _offline_region_initial(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_offline: Union[_models.RegionForOnlineOffline, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_offline_region(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_offline: _models.RegionForOnlineOffline,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
'''Offline the specified region for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region_parameter_for_offline: Cosmos DB region to offline for the database account.
Required.
:type region_parameter_for_offline: ~azure.mgmt.cosmosdb.models.RegionForOnlineOffline
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_offline_region(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_offline: _models.RegionForOnlineOffline,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
'''Offline the specified region for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region_parameter_for_offline: Cosmos DB region to offline for the database account.
Required.
:type region_parameter_for_offline: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_offline_region(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_offline: _models.RegionForOnlineOffline,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
'''Offline the specified region for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region_parameter_for_offline: Cosmos DB region to offline for the database account. Is
either a RegionForOnlineOffline type or a IO[bytes] type. Required.
:type region_parameter_for_offline: ~azure.mgmt.cosmosdb.models.RegionForOnlineOffline or
IO[bytes]
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _online_region_initial(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_online: Union[_models.RegionForOnlineOffline, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_online_region(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_online: _models.RegionForOnlineOffline,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
'''Online the specified region for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region_parameter_for_online: Cosmos DB region to online for the database account.
Required.
:type region_parameter_for_online: ~azure.mgmt.cosmosdb.models.RegionForOnlineOffline
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_online_region(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_online: _models.RegionForOnlineOffline,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
'''Online the specified region for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region_parameter_for_online: Cosmos DB region to online for the database account.
Required.
:type region_parameter_for_online: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_online_region(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_online: _models.RegionForOnlineOffline,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
'''Online the specified region for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param region_parameter_for_online: Cosmos DB region to online for the database account. Is
either a RegionForOnlineOffline type or a IO[bytes] type. Required.
:type region_parameter_for_online: ~azure.mgmt.cosmosdb.models.RegionForOnlineOffline or
IO[bytes]
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def get_read_only_keys(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> _models.DatabaseAccountListReadOnlyKeysResult:
'''Lists the read-only access keys for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: DatabaseAccountListReadOnlyKeysResult or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListReadOnlyKeysResult
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def list_read_only_keys(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> _models.DatabaseAccountListReadOnlyKeysResult:
'''Lists the read-only access keys for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: DatabaseAccountListReadOnlyKeysResult or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListReadOnlyKeysResult
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _regenerate_key_initial(
self,
resource_group_name: str,
account_name: str,
key_to_regenerate: Union[_models.DatabaseAccountRegenerateKeyParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_regenerate_key(
self,
resource_group_name: str,
account_name: str,
key_to_regenerate: _models.DatabaseAccountRegenerateKeyParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
'''Regenerates an access key for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param key_to_regenerate: The name of the key to regenerate. Required.
:type key_to_regenerate: ~azure.mgmt.cosmosdb.models.DatabaseAccountRegenerateKeyParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_regenerate_key(
self,
resource_group_name: str,
account_name: str,
key_to_regenerate: _models.DatabaseAccountRegenerateKeyParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
'''Regenerates an access key for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param key_to_regenerate: The name of the key to regenerate. Required.
:type key_to_regenerate: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_regenerate_key(
self,
resource_group_name: str,
account_name: str,
key_to_regenerate: _models.DatabaseAccountRegenerateKeyParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
'''Regenerates an access key for the specified Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param key_to_regenerate: The name of the key to regenerate. Is either a
DatabaseAccountRegenerateKeyParameters type or a IO[bytes] type. Required.
:type key_to_regenerate: ~azure.mgmt.cosmosdb.models.DatabaseAccountRegenerateKeyParameters or
IO[bytes]
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def check_name_exists(self, account_name: str, **kwargs: Any) -> bool:
'''Checks that the Azure Cosmos DB account name already exists. A valid account name may contain
only lowercase letters, numbers, and the '-' character, and must be between 3 and 50
characters.
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: bool or the result of cls(response)
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def list_metrics(
self, resource_group_name: str, account_name: str, filter: str, **kwargs: Any
) -> Iterable["_models.Metric"]:
'''Retrieves the metrics determined by the given filter for the given database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param filter: An OData filter expression that describes a subset of metrics to return. The
parameters that can be filtered are name.value (name of the metric, can have an or of multiple
names), startTime, endTime, and timeGrain. The supported operator is eq. Required.
:type filter: str
:return: An iterator like instance of either Metric or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def list_usages(
self, resource_group_name: str, account_name: str, filter: Optional[str] = None, **kwargs: Any
) -> Iterable["_models.Usage"]:
'''Retrieves the usages (most recent data) for the given database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param filter: An OData filter expression that describes a subset of usages to return. The
supported parameter is name.value (name of the metric, can have an or of multiple names).
Default value is None.
:type filter: str
:return: An iterator like instance of either Usage or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Usage]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def list_metric_definitions(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.MetricDefinition"]:
'''Retrieves metric definitions for the given database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either MetricDefinition or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinition]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
| 91 | 31 | 37 | 4 | 26 | 9 | 3 | 0.37 | 0 | 9 | 0 | 0 | 38 | 4 | 38 | 38 | 2,051 | 272 | 1,357 | 583 | 1,082 | 504 | 699 | 369 | 638 | 6 | 0 | 2 | 158 |
10,546 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_database_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._database_operations.DatabaseOperations
|
class DatabaseOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`database` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_metrics(
self, resource_group_name: str, account_name: str, database_rid: str, filter: str, **kwargs: Any
) -> Iterable["_models.Metric"]:
"""Retrieves the metrics determined by the given filter for the given database account and
database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param filter: An OData filter expression that describes a subset of metrics to return. The
parameters that can be filtered are name.value (name of the metric, can have an or of multiple
names), startTime, endTime, and timeGrain. The supported operator is eq. Required.
:type filter: str
:return: An iterator like instance of either Metric or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_metrics_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_rid=database_rid,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("MetricListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def list_usages(
self,
resource_group_name: str,
account_name: str,
database_rid: str,
filter: Optional[str] = None,
**kwargs: Any
) -> Iterable["_models.Usage"]:
"""Retrieves the usages (most recent data) for the given database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param filter: An OData filter expression that describes a subset of usages to return. The
supported parameter is name.value (name of the metric, can have an or of multiple names).
Default value is None.
:type filter: str
:return: An iterator like instance of either Usage or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Usage]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_usages_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_rid=database_rid,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("UsagesResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def list_metric_definitions(
self, resource_group_name: str, account_name: str, database_rid: str, **kwargs: Any
) -> Iterable["_models.MetricDefinition"]:
"""Retrieves metric definitions for the given database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:return: An iterator like instance of either MetricDefinition or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinition]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_metric_definitions_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_rid=database_rid,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("MetricDefinitionsListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
|
class DatabaseOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`database` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list_metrics(
self, resource_group_name: str, account_name: str, database_rid: str, filter: str, **kwargs: Any
) -> Iterable["_models.Metric"]:
'''Retrieves the metrics determined by the given filter for the given database account and
database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param filter: An OData filter expression that describes a subset of metrics to return. The
parameters that can be filtered are name.value (name of the metric, can have an or of multiple
names), startTime, endTime, and timeGrain. The supported operator is eq. Required.
:type filter: str
:return: An iterator like instance of either Metric or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def list_usages(
self,
resource_group_name: str,
account_name: str,
database_rid: str,
filter: Optional[str] = None,
**kwargs: Any
) -> Iterable["_models.Usage"]:
'''Retrieves the usages (most recent data) for the given database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param filter: An OData filter expression that describes a subset of usages to return. The
supported parameter is name.value (name of the metric, can have an or of multiple names).
Default value is None.
:type filter: str
:return: An iterator like instance of either Usage or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Usage]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def list_metric_definitions(
self, resource_group_name: str, account_name: str, database_rid: str, **kwargs: Any
) -> Iterable["_models.MetricDefinition"]:
'''Retrieves metric definitions for the given database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:return: An iterator like instance of either MetricDefinition or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinition]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
| 17 | 4 | 33 | 4 | 25 | 5 | 2 | 0.31 | 0 | 5 | 0 | 0 | 4 | 4 | 4 | 4 | 292 | 42 | 195 | 76 | 167 | 61 | 110 | 62 | 96 | 5 | 0 | 1 | 26 |
10,547 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_graph_resources_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._graph_resources_operations.GraphResourcesOperations
|
class GraphResourcesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`graph_resources` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_graphs(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.GraphResourceGetResults"]:
"""Lists the graphs under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either GraphResourceGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GraphResourceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GraphResourcesListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_graphs_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("GraphResourcesListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get_graph(
self, resource_group_name: str, account_name: str, graph_name: str, **kwargs: Any
) -> _models.GraphResourceGetResults:
"""Gets the Graph resource under an existing Azure Cosmos DB database account with the provided
name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param graph_name: Cosmos DB graph resource name. Required.
:type graph_name: str
:return: GraphResourceGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.GraphResourceGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GraphResourceGetResults] = kwargs.pop("cls", None)
_request = build_get_graph_request(
resource_group_name=resource_group_name,
account_name=account_name,
graph_name=graph_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("GraphResourceGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _create_update_graph_initial(
self,
resource_group_name: str,
account_name: str,
graph_name: str,
create_update_graph_parameters: Union[_models.GraphResourceCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(create_update_graph_parameters, (IOBase, bytes)):
_content = create_update_graph_parameters
else:
_json = self._serialize.body(create_update_graph_parameters, "GraphResourceCreateUpdateParameters")
_request = build_create_update_graph_request(
resource_group_name=resource_group_name,
account_name=account_name,
graph_name=graph_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_update_graph(
self,
resource_group_name: str,
account_name: str,
graph_name: str,
create_update_graph_parameters: _models.GraphResourceCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GraphResourceGetResults]:
"""Create or update an Azure Cosmos DB Graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param graph_name: Cosmos DB graph resource name. Required.
:type graph_name: str
:param create_update_graph_parameters: The parameters to provide for the current graph.
Required.
:type create_update_graph_parameters:
~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either GraphResourceGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_update_graph(
self,
resource_group_name: str,
account_name: str,
graph_name: str,
create_update_graph_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GraphResourceGetResults]:
"""Create or update an Azure Cosmos DB Graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param graph_name: Cosmos DB graph resource name. Required.
:type graph_name: str
:param create_update_graph_parameters: The parameters to provide for the current graph.
Required.
:type create_update_graph_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either GraphResourceGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_update_graph(
self,
resource_group_name: str,
account_name: str,
graph_name: str,
create_update_graph_parameters: Union[_models.GraphResourceCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.GraphResourceGetResults]:
"""Create or update an Azure Cosmos DB Graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param graph_name: Cosmos DB graph resource name. Required.
:type graph_name: str
:param create_update_graph_parameters: The parameters to provide for the current graph. Is
either a GraphResourceCreateUpdateParameters type or a IO[bytes] type. Required.
:type create_update_graph_parameters:
~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either GraphResourceGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.GraphResourceGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_update_graph_initial(
resource_group_name=resource_group_name,
account_name=account_name,
graph_name=graph_name,
create_update_graph_parameters=create_update_graph_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("GraphResourceGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.GraphResourceGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.GraphResourceGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_graph_resource_initial(
self, resource_group_name: str, account_name: str, graph_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_graph_resource_request(
resource_group_name=resource_group_name,
account_name=account_name,
graph_name=graph_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete_graph_resource(
self, resource_group_name: str, account_name: str, graph_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Deletes an existing Azure Cosmos DB Graph Resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param graph_name: Cosmos DB graph resource name. Required.
:type graph_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_graph_resource_initial(
resource_group_name=resource_group_name,
account_name=account_name,
graph_name=graph_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method)
|
class GraphResourcesOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`graph_resources` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list_graphs(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.GraphResourceGetResults"]:
'''Lists the graphs under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either GraphResourceGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GraphResourceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_graph(
self, resource_group_name: str, account_name: str, graph_name: str, **kwargs: Any
) -> _models.GraphResourceGetResults:
'''Gets the Graph resource under an existing Azure Cosmos DB database account with the provided
name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param graph_name: Cosmos DB graph resource name. Required.
:type graph_name: str
:return: GraphResourceGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.GraphResourceGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _create_update_graph_initial(
self,
resource_group_name: str,
account_name: str,
graph_name: str,
create_update_graph_parameters: Union[_models.GraphResourceCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_create_update_graph(
self,
resource_group_name: str,
account_name: str,
graph_name: str,
create_update_graph_parameters: _models.GraphResourceCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GraphResourceGetResults]:
'''Create or update an Azure Cosmos DB Graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param graph_name: Cosmos DB graph resource name. Required.
:type graph_name: str
:param create_update_graph_parameters: The parameters to provide for the current graph.
Required.
:type create_update_graph_parameters:
~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either GraphResourceGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_create_update_graph(
self,
resource_group_name: str,
account_name: str,
graph_name: str,
create_update_graph_parameters: _models.GraphResourceCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GraphResourceGetResults]:
'''Create or update an Azure Cosmos DB Graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param graph_name: Cosmos DB graph resource name. Required.
:type graph_name: str
:param create_update_graph_parameters: The parameters to provide for the current graph.
Required.
:type create_update_graph_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either GraphResourceGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_create_update_graph(
self,
resource_group_name: str,
account_name: str,
graph_name: str,
create_update_graph_parameters: _models.GraphResourceCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GraphResourceGetResults]:
'''Create or update an Azure Cosmos DB Graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param graph_name: Cosmos DB graph resource name. Required.
:type graph_name: str
:param create_update_graph_parameters: The parameters to provide for the current graph. Is
either a GraphResourceCreateUpdateParameters type or a IO[bytes] type. Required.
:type create_update_graph_parameters:
~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either GraphResourceGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _delete_graph_resource_initial(
self, resource_group_name: str, account_name: str, graph_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_delete_graph_resource(
self, resource_group_name: str, account_name: str, graph_name: str, **kwargs: Any
) -> LROPoller[None]:
'''Deletes an existing Azure Cosmos DB Graph Resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param graph_name: Cosmos DB graph resource name. Required.
:type graph_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
| 21 | 7 | 38 | 4 | 27 | 9 | 3 | 0.36 | 0 | 8 | 0 | 0 | 9 | 4 | 9 | 9 | 494 | 64 | 330 | 138 | 269 | 120 | 173 | 92 | 158 | 6 | 0 | 2 | 42 |
10,548 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_gremlin_resources_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._gremlin_resources_operations.GremlinResourcesOperations
|
class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`gremlin_resources` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_gremlin_databases(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.GremlinDatabaseGetResults"]:
"""Lists the Gremlin databases under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either GremlinDatabaseGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GremlinDatabaseListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_gremlin_databases_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("GremlinDatabaseListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get_gremlin_database(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> _models.GremlinDatabaseGetResults:
"""Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided
name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: GremlinDatabaseGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GremlinDatabaseGetResults] = kwargs.pop("cls", None)
_request = build_get_gremlin_database_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("GremlinDatabaseGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _create_update_gremlin_database_initial(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_gremlin_database_parameters: Union[_models.GremlinDatabaseCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(create_update_gremlin_database_parameters, (IOBase, bytes)):
_content = create_update_gremlin_database_parameters
else:
_json = self._serialize.body(
create_update_gremlin_database_parameters, "GremlinDatabaseCreateUpdateParameters"
)
_request = build_create_update_gremlin_database_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_update_gremlin_database(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_gremlin_database_parameters: _models.GremlinDatabaseCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GremlinDatabaseGetResults]:
"""Create or update an Azure Cosmos DB Gremlin database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param create_update_gremlin_database_parameters: The parameters to provide for the current
Gremlin database. Required.
:type create_update_gremlin_database_parameters:
~azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either GremlinDatabaseGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_update_gremlin_database(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_gremlin_database_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GremlinDatabaseGetResults]:
"""Create or update an Azure Cosmos DB Gremlin database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param create_update_gremlin_database_parameters: The parameters to provide for the current
Gremlin database. Required.
:type create_update_gremlin_database_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either GremlinDatabaseGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_update_gremlin_database(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_gremlin_database_parameters: Union[_models.GremlinDatabaseCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.GremlinDatabaseGetResults]:
"""Create or update an Azure Cosmos DB Gremlin database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param create_update_gremlin_database_parameters: The parameters to provide for the current
Gremlin database. Is either a GremlinDatabaseCreateUpdateParameters type or a IO[bytes] type.
Required.
:type create_update_gremlin_database_parameters:
~azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either GremlinDatabaseGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.GremlinDatabaseGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_update_gremlin_database_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
create_update_gremlin_database_parameters=create_update_gremlin_database_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("GremlinDatabaseGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.GremlinDatabaseGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.GremlinDatabaseGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_gremlin_database_initial(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_gremlin_database_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete_gremlin_database(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Deletes an existing Azure Cosmos DB Gremlin database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_gremlin_database_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def get_gremlin_database_throughput(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> _models.ThroughputSettingsGetResults:
"""Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database
account with the provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: ThroughputSettingsGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
_request = build_get_gremlin_database_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _update_gremlin_database_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(update_throughput_parameters, (IOBase, bytes)):
_content = update_throughput_parameters
else:
_json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters")
_request = build_update_gremlin_database_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_update_gremlin_database_throughput(
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Gremlin database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Gremlin database. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_gremlin_database_throughput(
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Gremlin database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Gremlin database. Required.
:type update_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_gremlin_database_throughput(
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Gremlin database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Gremlin database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes]
type. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_gremlin_database_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
update_throughput_parameters=update_throughput_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _migrate_gremlin_database_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_gremlin_database_to_autoscale_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_migrate_gremlin_database_to_autoscale( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._migrate_gremlin_database_to_autoscale_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _migrate_gremlin_database_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_gremlin_database_to_manual_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_migrate_gremlin_database_to_manual_throughput( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._migrate_gremlin_database_to_manual_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace
def list_gremlin_graphs(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterable["_models.GremlinGraphGetResults"]:
"""Lists the Gremlin graph under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An iterator like instance of either GremlinGraphGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GremlinGraphListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_gremlin_graphs_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("GremlinGraphListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get_gremlin_graph(
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> _models.GremlinGraphGetResults:
"""Gets the Gremlin graph under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:return: GremlinGraphGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.GremlinGraphGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GremlinGraphGetResults] = kwargs.pop("cls", None)
_request = build_get_gremlin_graph_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
graph_name=graph_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("GremlinGraphGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _create_update_gremlin_graph_initial(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
create_update_gremlin_graph_parameters: Union[_models.GremlinGraphCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(create_update_gremlin_graph_parameters, (IOBase, bytes)):
_content = create_update_gremlin_graph_parameters
else:
_json = self._serialize.body(create_update_gremlin_graph_parameters, "GremlinGraphCreateUpdateParameters")
_request = build_create_update_gremlin_graph_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
graph_name=graph_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_update_gremlin_graph(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
create_update_gremlin_graph_parameters: _models.GremlinGraphCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GremlinGraphGetResults]:
"""Create or update an Azure Cosmos DB Gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param create_update_gremlin_graph_parameters: The parameters to provide for the current
Gremlin graph. Required.
:type create_update_gremlin_graph_parameters:
~azure.mgmt.cosmosdb.models.GremlinGraphCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either GremlinGraphGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_update_gremlin_graph(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
create_update_gremlin_graph_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GremlinGraphGetResults]:
"""Create or update an Azure Cosmos DB Gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param create_update_gremlin_graph_parameters: The parameters to provide for the current
Gremlin graph. Required.
:type create_update_gremlin_graph_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either GremlinGraphGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_update_gremlin_graph(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
create_update_gremlin_graph_parameters: Union[_models.GremlinGraphCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.GremlinGraphGetResults]:
"""Create or update an Azure Cosmos DB Gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param create_update_gremlin_graph_parameters: The parameters to provide for the current
Gremlin graph. Is either a GremlinGraphCreateUpdateParameters type or a IO[bytes] type.
Required.
:type create_update_gremlin_graph_parameters:
~azure.mgmt.cosmosdb.models.GremlinGraphCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either GremlinGraphGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.GremlinGraphGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_update_gremlin_graph_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
graph_name=graph_name,
create_update_gremlin_graph_parameters=create_update_gremlin_graph_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("GremlinGraphGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.GremlinGraphGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.GremlinGraphGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_gremlin_graph_initial(
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_gremlin_graph_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
graph_name=graph_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete_gremlin_graph(
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Deletes an existing Azure Cosmos DB Gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_gremlin_graph_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
graph_name=graph_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def get_gremlin_graph_throughput(
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> _models.ThroughputSettingsGetResults:
"""Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the
provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:return: ThroughputSettingsGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
_request = build_get_gremlin_graph_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
graph_name=graph_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _update_gremlin_graph_throughput_initial(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(update_throughput_parameters, (IOBase, bytes)):
_content = update_throughput_parameters
else:
_json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters")
_request = build_update_gremlin_graph_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
graph_name=graph_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_update_gremlin_graph_throughput(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Gremlin graph. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_gremlin_graph_throughput(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
update_throughput_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Gremlin graph. Required.
:type update_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_gremlin_graph_throughput(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Gremlin graph. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type.
Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_gremlin_graph_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
graph_name=graph_name,
update_throughput_parameters=update_throughput_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _migrate_gremlin_graph_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_gremlin_graph_to_autoscale_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
graph_name=graph_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_migrate_gremlin_graph_to_autoscale(
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._migrate_gremlin_graph_to_autoscale_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
graph_name=graph_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _migrate_gremlin_graph_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_gremlin_graph_to_manual_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
graph_name=graph_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_migrate_gremlin_graph_to_manual_throughput( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._migrate_gremlin_graph_to_manual_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
graph_name=graph_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(location, (IOBase, bytes)):
_content = location
else:
_json = self._serialize.body(location, "ContinuousBackupRestoreLocation")
_request = build_retrieve_continuous_backup_information_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
graph_name=graph_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
location: _models.ContinuousBackupRestoreLocation,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.BackupInformation]:
"""Retrieves continuous backup information for a gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param location: The name of the continuous backup restore location. Required.
:type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either BackupInformation or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
location: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.BackupInformation]:
"""Retrieves continuous backup information for a gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param location: The name of the continuous backup restore location. Required.
:type location: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either BackupInformation or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.BackupInformation]:
"""Retrieves continuous backup information for a gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param location: The name of the continuous backup restore location. Is either a
ContinuousBackupRestoreLocation type or a IO[bytes] type. Required.
:type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or IO[bytes]
:return: An instance of LROPoller that returns either BackupInformation or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BackupInformation] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._retrieve_continuous_backup_information_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
graph_name=graph_name,
location=location,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("BackupInformation", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.BackupInformation].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.BackupInformation](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
|
class GremlinResourcesOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`gremlin_resources` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list_gremlin_databases(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.GremlinDatabaseGetResults"]:
'''Lists the Gremlin databases under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either GremlinDatabaseGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_gremlin_database(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> _models.GremlinDatabaseGetResults:
'''Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided
name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: GremlinDatabaseGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _create_update_gremlin_database_initial(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_gremlin_database_parameters: Union[_models.GremlinDatabaseCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_create_update_gremlin_database(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_gremlin_database_parameters: _models.GremlinDatabaseCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GremlinDatabaseGetResults]:
'''Create or update an Azure Cosmos DB Gremlin database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param create_update_gremlin_database_parameters: The parameters to provide for the current
Gremlin database. Required.
:type create_update_gremlin_database_parameters:
~azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either GremlinDatabaseGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_create_update_gremlin_database(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_gremlin_database_parameters: _models.GremlinDatabaseCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GremlinDatabaseGetResults]:
'''Create or update an Azure Cosmos DB Gremlin database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param create_update_gremlin_database_parameters: The parameters to provide for the current
Gremlin database. Required.
:type create_update_gremlin_database_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either GremlinDatabaseGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_create_update_gremlin_database(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_gremlin_database_parameters: _models.GremlinDatabaseCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GremlinDatabaseGetResults]:
'''Create or update an Azure Cosmos DB Gremlin database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param create_update_gremlin_database_parameters: The parameters to provide for the current
Gremlin database. Is either a GremlinDatabaseCreateUpdateParameters type or a IO[bytes] type.
Required.
:type create_update_gremlin_database_parameters:
~azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either GremlinDatabaseGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _delete_gremlin_database_initial(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_delete_gremlin_database(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> LROPoller[None]:
'''Deletes an existing Azure Cosmos DB Gremlin database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def get_gremlin_database_throughput(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> _models.ThroughputSettingsGetResults:
'''Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database
account with the provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: ThroughputSettingsGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _update_gremlin_database_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_update_gremlin_database_throughput(
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Gremlin database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Gremlin database. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_update_gremlin_database_throughput(
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Gremlin database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Gremlin database. Required.
:type update_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_update_gremlin_database_throughput(
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Gremlin database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Gremlin database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes]
type. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _migrate_gremlin_database_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_migrate_gremlin_database_to_autoscale( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _migrate_gremlin_database_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_migrate_gremlin_database_to_manual_throughput( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list_gremlin_graphs(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterable["_models.GremlinGraphGetResults"]:
'''Lists the Gremlin graph under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An iterator like instance of either GremlinGraphGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_gremlin_graph(
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> _models.GremlinGraphGetResults:
'''Gets the Gremlin graph under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:return: GremlinGraphGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.GremlinGraphGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _create_update_gremlin_graph_initial(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
create_update_gremlin_graph_parameters: Union[_models.GremlinGraphCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_create_update_gremlin_graph(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
create_update_gremlin_graph_parameters: _models.GremlinGraphCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GremlinGraphGetResults]:
'''Create or update an Azure Cosmos DB Gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param create_update_gremlin_graph_parameters: The parameters to provide for the current
Gremlin graph. Required.
:type create_update_gremlin_graph_parameters:
~azure.mgmt.cosmosdb.models.GremlinGraphCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either GremlinGraphGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_create_update_gremlin_graph(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
create_update_gremlin_graph_parameters: _models.GremlinGraphCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GremlinGraphGetResults]:
'''Create or update an Azure Cosmos DB Gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param create_update_gremlin_graph_parameters: The parameters to provide for the current
Gremlin graph. Required.
:type create_update_gremlin_graph_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either GremlinGraphGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_create_update_gremlin_graph(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
create_update_gremlin_graph_parameters: _models.GremlinGraphCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GremlinGraphGetResults]:
'''Create or update an Azure Cosmos DB Gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param create_update_gremlin_graph_parameters: The parameters to provide for the current
Gremlin graph. Is either a GremlinGraphCreateUpdateParameters type or a IO[bytes] type.
Required.
:type create_update_gremlin_graph_parameters:
~azure.mgmt.cosmosdb.models.GremlinGraphCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either GremlinGraphGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _delete_gremlin_graph_initial(
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_delete_gremlin_graph(
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> LROPoller[None]:
'''Deletes an existing Azure Cosmos DB Gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def get_gremlin_graph_throughput(
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> _models.ThroughputSettingsGetResults:
'''Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the
provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:return: ThroughputSettingsGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _update_gremlin_graph_throughput_initial(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_update_gremlin_graph_throughput(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Gremlin graph. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_update_gremlin_graph_throughput(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Gremlin graph. Required.
:type update_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_update_gremlin_graph_throughput(
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Gremlin graph. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type.
Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _migrate_gremlin_graph_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_migrate_gremlin_graph_to_autoscale(
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _migrate_gremlin_graph_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_migrate_gremlin_graph_to_manual_throughput( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
location: _models.ContinuousBackupRestoreLocation,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.BackupInformation]:
'''Retrieves continuous backup information for a gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param location: The name of the continuous backup restore location. Required.
:type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either BackupInformation or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
location: _models.ContinuousBackupRestoreLocation,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.BackupInformation]:
'''Retrieves continuous backup information for a gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param location: The name of the continuous backup restore location. Required.
:type location: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either BackupInformation or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
graph_name: str,
location: _models.ContinuousBackupRestoreLocation,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.BackupInformation]:
'''Retrieves continuous backup information for a gremlin graph.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param graph_name: Cosmos DB graph name. Required.
:type graph_name: str
:param location: The name of the continuous backup restore location. Is either a
ContinuousBackupRestoreLocation type or a IO[bytes] type. Required.
:type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or IO[bytes]
:return: An instance of LROPoller that returns either BackupInformation or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
| 84 | 28 | 42 | 4 | 29 | 10 | 3 | 0.38 | 0 | 8 | 0 | 0 | 39 | 4 | 39 | 39 | 2,274 | 273 | 1,533 | 625 | 1,241 | 576 | 766 | 390 | 709 | 6 | 0 | 2 | 177 |
10,549 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_locations_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._locations_operations.LocationsOperations
|
class LocationsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`locations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.LocationGetResult"]:
"""List Cosmos DB locations and their properties.
:return: An iterator like instance of either LocationGetResult or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.LocationGetResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.LocationListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("LocationListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult:
"""Get the properties of an existing Cosmos DB location.
:param location: Cosmos DB region, with spaces between words and each word capitalized.
Required.
:type location: str
:return: LocationGetResult or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.LocationGetResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.LocationGetResult] = kwargs.pop("cls", None)
_request = build_get_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("LocationGetResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
|
class LocationsOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`locations` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.LocationGetResult"]:
'''List Cosmos DB locations and their properties.
:return: An iterator like instance of either LocationGetResult or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.LocationGetResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_next(next_link=None):
'''Get the properties of an existing Cosmos DB location.
:param location: Cosmos DB region, with spaces between words and each word capitalized.
Required.
:type location: str
:return: LocationGetResult or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.LocationGetResult
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
| 9 | 3 | 29 | 5 | 22 | 4 | 3 | 0.27 | 0 | 4 | 0 | 0 | 3 | 4 | 3 | 3 | 144 | 27 | 96 | 39 | 87 | 26 | 61 | 37 | 54 | 5 | 0 | 1 | 15 |
10,550 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_mongo_db_resources_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._mongo_db_resources_operations.MongoDBResourcesOperations
|
class MongoDBResourcesOperations: # pylint: disable=too-many-public-methods
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`mongo_db_resources` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_mongo_db_databases(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.MongoDBDatabaseGetResults"]:
"""Lists the MongoDB databases under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either MongoDBDatabaseGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MongoDBDatabaseListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_mongo_db_databases_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("MongoDBDatabaseListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get_mongo_db_database(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> _models.MongoDBDatabaseGetResults:
"""Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided
name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: MongoDBDatabaseGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MongoDBDatabaseGetResults] = kwargs.pop("cls", None)
_request = build_get_mongo_db_database_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("MongoDBDatabaseGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _create_update_mongo_db_database_initial(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_mongo_db_database_parameters: Union[_models.MongoDBDatabaseCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(create_update_mongo_db_database_parameters, (IOBase, bytes)):
_content = create_update_mongo_db_database_parameters
else:
_json = self._serialize.body(
create_update_mongo_db_database_parameters, "MongoDBDatabaseCreateUpdateParameters"
)
_request = build_create_update_mongo_db_database_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_update_mongo_db_database(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_mongo_db_database_parameters: _models.MongoDBDatabaseCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoDBDatabaseGetResults]:
"""Create or updates Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param create_update_mongo_db_database_parameters: The parameters to provide for the current
MongoDB database. Required.
:type create_update_mongo_db_database_parameters:
~azure.mgmt.cosmosdb.models.MongoDBDatabaseCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoDBDatabaseGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_update_mongo_db_database(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_mongo_db_database_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoDBDatabaseGetResults]:
"""Create or updates Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param create_update_mongo_db_database_parameters: The parameters to provide for the current
MongoDB database. Required.
:type create_update_mongo_db_database_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoDBDatabaseGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_update_mongo_db_database(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_mongo_db_database_parameters: Union[_models.MongoDBDatabaseCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.MongoDBDatabaseGetResults]:
"""Create or updates Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param create_update_mongo_db_database_parameters: The parameters to provide for the current
MongoDB database. Is either a MongoDBDatabaseCreateUpdateParameters type or a IO[bytes] type.
Required.
:type create_update_mongo_db_database_parameters:
~azure.mgmt.cosmosdb.models.MongoDBDatabaseCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either MongoDBDatabaseGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.MongoDBDatabaseGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_update_mongo_db_database_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
create_update_mongo_db_database_parameters=create_update_mongo_db_database_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("MongoDBDatabaseGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.MongoDBDatabaseGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.MongoDBDatabaseGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_mongo_db_database_initial(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_mongo_db_database_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete_mongo_db_database(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Deletes an existing Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_mongo_db_database_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def get_mongo_db_database_throughput(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> _models.ThroughputSettingsGetResults:
"""Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database
account with the provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: ThroughputSettingsGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
_request = build_get_mongo_db_database_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _update_mongo_db_database_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(update_throughput_parameters, (IOBase, bytes)):
_content = update_throughput_parameters
else:
_json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters")
_request = build_update_mongo_db_database_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of the an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current MongoDB database. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of the an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current MongoDB database. Required.
:type update_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of the an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current MongoDB database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes]
type. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_mongo_db_database_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
update_throughput_parameters=update_throughput_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _migrate_mongo_db_database_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_mongo_db_database_to_autoscale_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_migrate_mongo_db_database_to_autoscale( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._migrate_mongo_db_database_to_autoscale_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _migrate_mongo_db_database_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_mongo_db_database_to_manual_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_migrate_mongo_db_database_to_manual_throughput( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._migrate_mongo_db_database_to_manual_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _mongo_db_database_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(retrieve_throughput_parameters, (IOBase, bytes)):
_content = retrieve_throughput_parameters
else:
_json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters")
_request = build_mongo_db_database_retrieve_throughput_distribution_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
retrieve_throughput_parameters: _models.RetrieveThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
"""Retrieve throughput distribution for an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param retrieve_throughput_parameters: The parameters to provide for retrieving throughput
distribution for the current MongoDB database. Required.
:type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
retrieve_throughput_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
"""Retrieve throughput distribution for an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param retrieve_throughput_parameters: The parameters to provide for retrieving throughput
distribution for the current MongoDB database. Required.
:type retrieve_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
"""Retrieve throughput distribution for an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param retrieve_throughput_parameters: The parameters to provide for retrieving throughput
distribution for the current MongoDB database. Is either a RetrieveThroughputParameters type or
a IO[bytes] type. Required.
:type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters
or IO[bytes]
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._mongo_db_database_retrieve_throughput_distribution_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
retrieve_throughput_parameters=retrieve_throughput_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.PhysicalPartitionThroughputInfoResult](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _mongo_db_database_redistribute_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(redistribute_throughput_parameters, (IOBase, bytes)):
_content = redistribute_throughput_parameters
else:
_json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters")
_request = build_mongo_db_database_redistribute_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_mongo_db_database_redistribute_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
redistribute_throughput_parameters: _models.RedistributeThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
"""Redistribute throughput for an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param redistribute_throughput_parameters: The parameters to provide for redistributing
throughput for the current MongoDB database. Required.
:type redistribute_throughput_parameters:
~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_mongo_db_database_redistribute_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
redistribute_throughput_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
"""Redistribute throughput for an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param redistribute_throughput_parameters: The parameters to provide for redistributing
throughput for the current MongoDB database. Required.
:type redistribute_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_mongo_db_database_redistribute_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
"""Redistribute throughput for an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param redistribute_throughput_parameters: The parameters to provide for redistributing
throughput for the current MongoDB database. Is either a RedistributeThroughputParameters type
or a IO[bytes] type. Required.
:type redistribute_throughput_parameters:
~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO[bytes]
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._mongo_db_database_redistribute_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
redistribute_throughput_parameters=redistribute_throughput_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.PhysicalPartitionThroughputInfoResult](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _mongo_db_container_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(retrieve_throughput_parameters, (IOBase, bytes)):
_content = retrieve_throughput_parameters
else:
_json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters")
_request = build_mongo_db_container_retrieve_throughput_distribution_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_mongo_db_container_retrieve_throughput_distribution( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
retrieve_throughput_parameters: _models.RetrieveThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
"""Retrieve throughput distribution for an Azure Cosmos DB MongoDB container.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param retrieve_throughput_parameters: The parameters to provide for retrieving throughput
distribution for the current MongoDB container. Required.
:type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_mongo_db_container_retrieve_throughput_distribution( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
retrieve_throughput_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
"""Retrieve throughput distribution for an Azure Cosmos DB MongoDB container.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param retrieve_throughput_parameters: The parameters to provide for retrieving throughput
distribution for the current MongoDB container. Required.
:type retrieve_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_mongo_db_container_retrieve_throughput_distribution( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
"""Retrieve throughput distribution for an Azure Cosmos DB MongoDB container.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param retrieve_throughput_parameters: The parameters to provide for retrieving throughput
distribution for the current MongoDB container. Is either a RetrieveThroughputParameters type
or a IO[bytes] type. Required.
:type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters
or IO[bytes]
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._mongo_db_container_retrieve_throughput_distribution_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
retrieve_throughput_parameters=retrieve_throughput_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.PhysicalPartitionThroughputInfoResult](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _mongo_db_container_redistribute_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(redistribute_throughput_parameters, (IOBase, bytes)):
_content = redistribute_throughput_parameters
else:
_json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters")
_request = build_mongo_db_container_redistribute_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
redistribute_throughput_parameters: _models.RedistributeThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
"""Redistribute throughput for an Azure Cosmos DB MongoDB container.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param redistribute_throughput_parameters: The parameters to provide for redistributing
throughput for the current MongoDB container. Required.
:type redistribute_throughput_parameters:
~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
redistribute_throughput_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
"""Redistribute throughput for an Azure Cosmos DB MongoDB container.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param redistribute_throughput_parameters: The parameters to provide for redistributing
throughput for the current MongoDB container. Required.
:type redistribute_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
"""Redistribute throughput for an Azure Cosmos DB MongoDB container.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param redistribute_throughput_parameters: The parameters to provide for redistributing
throughput for the current MongoDB container. Is either a RedistributeThroughputParameters type
or a IO[bytes] type. Required.
:type redistribute_throughput_parameters:
~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO[bytes]
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._mongo_db_container_redistribute_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
redistribute_throughput_parameters=redistribute_throughput_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.PhysicalPartitionThroughputInfoResult](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace
def list_mongo_db_collections(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterable["_models.MongoDBCollectionGetResults"]:
"""Lists the MongoDB collection under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An iterator like instance of either MongoDBCollectionGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MongoDBCollectionListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_mongo_db_collections_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("MongoDBCollectionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get_mongo_db_collection(
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> _models.MongoDBCollectionGetResults:
"""Gets the MongoDB collection under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:return: MongoDBCollectionGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None)
_request = build_get_mongo_db_collection_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("MongoDBCollectionGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _create_update_mongo_db_collection_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
create_update_mongo_db_collection_parameters: Union[_models.MongoDBCollectionCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(create_update_mongo_db_collection_parameters, (IOBase, bytes)):
_content = create_update_mongo_db_collection_parameters
else:
_json = self._serialize.body(
create_update_mongo_db_collection_parameters, "MongoDBCollectionCreateUpdateParameters"
)
_request = build_create_update_mongo_db_collection_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_update_mongo_db_collection(
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
create_update_mongo_db_collection_parameters: _models.MongoDBCollectionCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoDBCollectionGetResults]:
"""Create or update an Azure Cosmos DB MongoDB Collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param create_update_mongo_db_collection_parameters: The parameters to provide for the current
MongoDB Collection. Required.
:type create_update_mongo_db_collection_parameters:
~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoDBCollectionGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_update_mongo_db_collection(
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
create_update_mongo_db_collection_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoDBCollectionGetResults]:
"""Create or update an Azure Cosmos DB MongoDB Collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param create_update_mongo_db_collection_parameters: The parameters to provide for the current
MongoDB Collection. Required.
:type create_update_mongo_db_collection_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoDBCollectionGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_update_mongo_db_collection(
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
create_update_mongo_db_collection_parameters: Union[_models.MongoDBCollectionCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.MongoDBCollectionGetResults]:
"""Create or update an Azure Cosmos DB MongoDB Collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param create_update_mongo_db_collection_parameters: The parameters to provide for the current
MongoDB Collection. Is either a MongoDBCollectionCreateUpdateParameters type or a IO[bytes]
type. Required.
:type create_update_mongo_db_collection_parameters:
~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either MongoDBCollectionGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_update_mongo_db_collection_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
create_update_mongo_db_collection_parameters=create_update_mongo_db_collection_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("MongoDBCollectionGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.MongoDBCollectionGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.MongoDBCollectionGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_mongo_db_collection_initial(
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_mongo_db_collection_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete_mongo_db_collection(
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Deletes an existing Azure Cosmos DB MongoDB Collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_mongo_db_collection_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _mongo_db_database_partition_merge_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
merge_parameters: Union[_models.MergeParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(merge_parameters, (IOBase, bytes)):
_content = merge_parameters
else:
_json = self._serialize.body(merge_parameters, "MergeParameters")
_request = build_mongo_db_database_partition_merge_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_mongo_db_database_partition_merge(
self,
resource_group_name: str,
account_name: str,
database_name: str,
merge_parameters: _models.MergeParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]:
"""Merges the partitions of a MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param merge_parameters: The parameters for the merge operation. Required.
:type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_mongo_db_database_partition_merge(
self,
resource_group_name: str,
account_name: str,
database_name: str,
merge_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]:
"""Merges the partitions of a MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param merge_parameters: The parameters for the merge operation. Required.
:type merge_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_mongo_db_database_partition_merge(
self,
resource_group_name: str,
account_name: str,
database_name: str,
merge_parameters: Union[_models.MergeParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]:
"""Merges the partitions of a MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param merge_parameters: The parameters for the merge operation. Is either a MergeParameters
type or a IO[bytes] type. Required.
:type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO[bytes]
:return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PhysicalPartitionStorageInfoCollection] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._mongo_db_database_partition_merge_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
merge_parameters=merge_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.PhysicalPartitionStorageInfoCollection].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.PhysicalPartitionStorageInfoCollection](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _list_mongo_db_collection_partition_merge_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
merge_parameters: Union[_models.MergeParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(merge_parameters, (IOBase, bytes)):
_content = merge_parameters
else:
_json = self._serialize.body(merge_parameters, "MergeParameters")
_request = build_list_mongo_db_collection_partition_merge_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
merge_parameters: _models.MergeParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]:
"""Merges the partitions of a MongoDB Collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param merge_parameters: The parameters for the merge operation. Required.
:type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
merge_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]:
"""Merges the partitions of a MongoDB Collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param merge_parameters: The parameters for the merge operation. Required.
:type merge_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
merge_parameters: Union[_models.MergeParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]:
"""Merges the partitions of a MongoDB Collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param merge_parameters: The parameters for the merge operation. Is either a MergeParameters
type or a IO[bytes] type. Required.
:type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO[bytes]
:return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PhysicalPartitionStorageInfoCollection] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._list_mongo_db_collection_partition_merge_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
merge_parameters=merge_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.PhysicalPartitionStorageInfoCollection].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.PhysicalPartitionStorageInfoCollection](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace
def get_mongo_db_collection_throughput(
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> _models.ThroughputSettingsGetResults:
"""Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database
account with the provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:return: ThroughputSettingsGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
_request = build_get_mongo_db_collection_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _update_mongo_db_collection_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(update_throughput_parameters, (IOBase, bytes)):
_content = update_throughput_parameters
else:
_json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters")
_request = build_update_mongo_db_collection_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update the RUs per second of an Azure Cosmos DB MongoDB collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current MongoDB collection. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
update_throughput_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update the RUs per second of an Azure Cosmos DB MongoDB collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current MongoDB collection. Required.
:type update_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update the RUs per second of an Azure Cosmos DB MongoDB collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current MongoDB collection. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes]
type. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_mongo_db_collection_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
update_throughput_parameters=update_throughput_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _migrate_mongo_db_collection_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_mongo_db_collection_to_autoscale_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_migrate_mongo_db_collection_to_autoscale( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._migrate_mongo_db_collection_to_autoscale_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _migrate_mongo_db_collection_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_mongo_db_collection_to_manual_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_migrate_mongo_db_collection_to_manual_throughput( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._migrate_mongo_db_collection_to_manual_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace
def get_mongo_role_definition(
self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any
) -> _models.MongoRoleDefinitionGetResults:
"""Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given
Id.
:param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required.
:type mongo_role_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: MongoRoleDefinitionGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MongoRoleDefinitionGetResults] = kwargs.pop("cls", None)
_request = build_get_mongo_role_definition_request(
mongo_role_definition_id=mongo_role_definition_id,
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("MongoRoleDefinitionGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _create_update_mongo_role_definition_initial( # pylint: disable=name-too-long
self,
mongo_role_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_role_definition_parameters: Union[
_models.MongoRoleDefinitionCreateUpdateParameters, IO[bytes]
],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(create_update_mongo_role_definition_parameters, (IOBase, bytes)):
_content = create_update_mongo_role_definition_parameters
else:
_json = self._serialize.body(
create_update_mongo_role_definition_parameters, "MongoRoleDefinitionCreateUpdateParameters"
)
_request = build_create_update_mongo_role_definition_request(
mongo_role_definition_id=mongo_role_definition_id,
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long
self,
mongo_role_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_role_definition_parameters: _models.MongoRoleDefinitionCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoRoleDefinitionGetResults]:
"""Creates or updates an Azure Cosmos DB Mongo Role Definition.
:param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required.
:type mongo_role_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_mongo_role_definition_parameters: The properties required to create or
update a Role Definition. Required.
:type create_update_mongo_role_definition_parameters:
~azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoRoleDefinitionGetResults or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long
self,
mongo_role_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_role_definition_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoRoleDefinitionGetResults]:
"""Creates or updates an Azure Cosmos DB Mongo Role Definition.
:param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required.
:type mongo_role_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_mongo_role_definition_parameters: The properties required to create or
update a Role Definition. Required.
:type create_update_mongo_role_definition_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoRoleDefinitionGetResults or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long
self,
mongo_role_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_role_definition_parameters: Union[
_models.MongoRoleDefinitionCreateUpdateParameters, IO[bytes]
],
**kwargs: Any
) -> LROPoller[_models.MongoRoleDefinitionGetResults]:
"""Creates or updates an Azure Cosmos DB Mongo Role Definition.
:param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required.
:type mongo_role_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_mongo_role_definition_parameters: The properties required to create or
update a Role Definition. Is either a MongoRoleDefinitionCreateUpdateParameters type or a
IO[bytes] type. Required.
:type create_update_mongo_role_definition_parameters:
~azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either MongoRoleDefinitionGetResults or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.MongoRoleDefinitionGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_update_mongo_role_definition_initial(
mongo_role_definition_id=mongo_role_definition_id,
resource_group_name=resource_group_name,
account_name=account_name,
create_update_mongo_role_definition_parameters=create_update_mongo_role_definition_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("MongoRoleDefinitionGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.MongoRoleDefinitionGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.MongoRoleDefinitionGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_mongo_role_definition_initial(
self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_mongo_role_definition_request(
mongo_role_definition_id=mongo_role_definition_id,
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete_mongo_role_definition(
self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Deletes an existing Azure Cosmos DB Mongo Role Definition.
:param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required.
:type mongo_role_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_mongo_role_definition_initial(
mongo_role_definition_id=mongo_role_definition_id,
resource_group_name=resource_group_name,
account_name=account_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list_mongo_role_definitions(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.MongoRoleDefinitionGetResults"]:
"""Retrieves the list of all Azure Cosmos DB Mongo Role Definitions.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either MongoRoleDefinitionGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MongoRoleDefinitionListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_mongo_role_definitions_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("MongoRoleDefinitionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get_mongo_user_definition(
self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any
) -> _models.MongoUserDefinitionGetResults:
"""Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given
Id.
:param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required.
:type mongo_user_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: MongoUserDefinitionGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MongoUserDefinitionGetResults] = kwargs.pop("cls", None)
_request = build_get_mongo_user_definition_request(
mongo_user_definition_id=mongo_user_definition_id,
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("MongoUserDefinitionGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _create_update_mongo_user_definition_initial( # pylint: disable=name-too-long
self,
mongo_user_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_user_definition_parameters: Union[
_models.MongoUserDefinitionCreateUpdateParameters, IO[bytes]
],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(create_update_mongo_user_definition_parameters, (IOBase, bytes)):
_content = create_update_mongo_user_definition_parameters
else:
_json = self._serialize.body(
create_update_mongo_user_definition_parameters, "MongoUserDefinitionCreateUpdateParameters"
)
_request = build_create_update_mongo_user_definition_request(
mongo_user_definition_id=mongo_user_definition_id,
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long
self,
mongo_user_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_user_definition_parameters: _models.MongoUserDefinitionCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoUserDefinitionGetResults]:
"""Creates or updates an Azure Cosmos DB Mongo User Definition.
:param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required.
:type mongo_user_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_mongo_user_definition_parameters: The properties required to create or
update a User Definition. Required.
:type create_update_mongo_user_definition_parameters:
~azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoUserDefinitionGetResults or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long
self,
mongo_user_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_user_definition_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoUserDefinitionGetResults]:
"""Creates or updates an Azure Cosmos DB Mongo User Definition.
:param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required.
:type mongo_user_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_mongo_user_definition_parameters: The properties required to create or
update a User Definition. Required.
:type create_update_mongo_user_definition_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoUserDefinitionGetResults or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long
self,
mongo_user_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_user_definition_parameters: Union[
_models.MongoUserDefinitionCreateUpdateParameters, IO[bytes]
],
**kwargs: Any
) -> LROPoller[_models.MongoUserDefinitionGetResults]:
"""Creates or updates an Azure Cosmos DB Mongo User Definition.
:param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required.
:type mongo_user_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_mongo_user_definition_parameters: The properties required to create or
update a User Definition. Is either a MongoUserDefinitionCreateUpdateParameters type or a
IO[bytes] type. Required.
:type create_update_mongo_user_definition_parameters:
~azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either MongoUserDefinitionGetResults or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.MongoUserDefinitionGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_update_mongo_user_definition_initial(
mongo_user_definition_id=mongo_user_definition_id,
resource_group_name=resource_group_name,
account_name=account_name,
create_update_mongo_user_definition_parameters=create_update_mongo_user_definition_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("MongoUserDefinitionGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.MongoUserDefinitionGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.MongoUserDefinitionGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_mongo_user_definition_initial(
self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_mongo_user_definition_request(
mongo_user_definition_id=mongo_user_definition_id,
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete_mongo_user_definition(
self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Deletes an existing Azure Cosmos DB Mongo User Definition.
:param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required.
:type mongo_user_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_mongo_user_definition_initial(
mongo_user_definition_id=mongo_user_definition_id,
resource_group_name=resource_group_name,
account_name=account_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list_mongo_user_definitions(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.MongoUserDefinitionGetResults"]:
"""Retrieves the list of all Azure Cosmos DB Mongo User Definition.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either MongoUserDefinitionGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MongoUserDefinitionListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_mongo_user_definitions_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("MongoUserDefinitionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(location, (IOBase, bytes)):
_content = location
else:
_json = self._serialize.body(location, "ContinuousBackupRestoreLocation")
_request = build_retrieve_continuous_backup_information_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
location: _models.ContinuousBackupRestoreLocation,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.BackupInformation]:
"""Retrieves continuous backup information for a Mongodb collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param location: The name of the continuous backup restore location. Required.
:type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either BackupInformation or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
location: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.BackupInformation]:
"""Retrieves continuous backup information for a Mongodb collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param location: The name of the continuous backup restore location. Required.
:type location: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either BackupInformation or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.BackupInformation]:
"""Retrieves continuous backup information for a Mongodb collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param location: The name of the continuous backup restore location. Is either a
ContinuousBackupRestoreLocation type or a IO[bytes] type. Required.
:type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or IO[bytes]
:return: An instance of LROPoller that returns either BackupInformation or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BackupInformation] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._retrieve_continuous_backup_information_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
collection_name=collection_name,
location=location,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("BackupInformation", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.BackupInformation].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.BackupInformation](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
|
class MongoDBResourcesOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`mongo_db_resources` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list_mongo_db_databases(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.MongoDBDatabaseGetResults"]:
'''Lists the MongoDB databases under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either MongoDBDatabaseGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_mongo_db_database(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> _models.MongoDBDatabaseGetResults:
'''Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided
name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: MongoDBDatabaseGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _create_update_mongo_db_database_initial(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_mongo_db_database_parameters: Union[_models.MongoDBDatabaseCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_create_update_mongo_db_database(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_mongo_db_database_parameters: _models.MongoDBDatabaseCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoDBDatabaseGetResults]:
'''Create or updates Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param create_update_mongo_db_database_parameters: The parameters to provide for the current
MongoDB database. Required.
:type create_update_mongo_db_database_parameters:
~azure.mgmt.cosmosdb.models.MongoDBDatabaseCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoDBDatabaseGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_create_update_mongo_db_database(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_mongo_db_database_parameters: _models.MongoDBDatabaseCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoDBDatabaseGetResults]:
'''Create or updates Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param create_update_mongo_db_database_parameters: The parameters to provide for the current
MongoDB database. Required.
:type create_update_mongo_db_database_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoDBDatabaseGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_create_update_mongo_db_database(
self,
resource_group_name: str,
account_name: str,
database_name: str,
create_update_mongo_db_database_parameters: _models.MongoDBDatabaseCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoDBDatabaseGetResults]:
'''Create or updates Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param create_update_mongo_db_database_parameters: The parameters to provide for the current
MongoDB database. Is either a MongoDBDatabaseCreateUpdateParameters type or a IO[bytes] type.
Required.
:type create_update_mongo_db_database_parameters:
~azure.mgmt.cosmosdb.models.MongoDBDatabaseCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either MongoDBDatabaseGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _delete_mongo_db_database_initial(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_delete_mongo_db_database(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> LROPoller[None]:
'''Deletes an existing Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def get_mongo_db_database_throughput(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> _models.ThroughputSettingsGetResults:
'''Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database
account with the provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: ThroughputSettingsGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _update_mongo_db_database_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of the an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current MongoDB database. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of the an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current MongoDB database. Required.
:type update_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of the an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current MongoDB database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes]
type. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _migrate_mongo_db_database_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_migrate_mongo_db_database_to_autoscale( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _migrate_mongo_db_database_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_migrate_mongo_db_database_to_manual_throughput( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _mongo_db_database_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
retrieve_throughput_parameters: _models.RetrieveThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
'''Retrieve throughput distribution for an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param retrieve_throughput_parameters: The parameters to provide for retrieving throughput
distribution for the current MongoDB database. Required.
:type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
retrieve_throughput_parameters: _models.RetrieveThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
'''Retrieve throughput distribution for an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param retrieve_throughput_parameters: The parameters to provide for retrieving throughput
distribution for the current MongoDB database. Required.
:type retrieve_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
retrieve_throughput_parameters: _models.RetrieveThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
'''Retrieve throughput distribution for an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param retrieve_throughput_parameters: The parameters to provide for retrieving throughput
distribution for the current MongoDB database. Is either a RetrieveThroughputParameters type or
a IO[bytes] type. Required.
:type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters
or IO[bytes]
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _mongo_db_database_redistribute_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_mongo_db_database_redistribute_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
redistribute_throughput_parameters: _models.RedistributeThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
'''Redistribute throughput for an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param redistribute_throughput_parameters: The parameters to provide for redistributing
throughput for the current MongoDB database. Required.
:type redistribute_throughput_parameters:
~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_mongo_db_database_redistribute_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
redistribute_throughput_parameters: _models.RedistributeThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
'''Redistribute throughput for an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param redistribute_throughput_parameters: The parameters to provide for redistributing
throughput for the current MongoDB database. Required.
:type redistribute_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_mongo_db_database_redistribute_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
redistribute_throughput_parameters: _models.RedistributeThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
'''Redistribute throughput for an Azure Cosmos DB MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param redistribute_throughput_parameters: The parameters to provide for redistributing
throughput for the current MongoDB database. Is either a RedistributeThroughputParameters type
or a IO[bytes] type. Required.
:type redistribute_throughput_parameters:
~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO[bytes]
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _mongo_db_container_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_mongo_db_container_retrieve_throughput_distribution( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
retrieve_throughput_parameters: _models.RetrieveThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
'''Retrieve throughput distribution for an Azure Cosmos DB MongoDB container.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param retrieve_throughput_parameters: The parameters to provide for retrieving throughput
distribution for the current MongoDB container. Required.
:type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_mongo_db_container_retrieve_throughput_distribution( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
retrieve_throughput_parameters: _models.RetrieveThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
'''Retrieve throughput distribution for an Azure Cosmos DB MongoDB container.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param retrieve_throughput_parameters: The parameters to provide for retrieving throughput
distribution for the current MongoDB container. Required.
:type retrieve_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_mongo_db_container_retrieve_throughput_distribution( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
retrieve_throughput_parameters: _models.RetrieveThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
'''Retrieve throughput distribution for an Azure Cosmos DB MongoDB container.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param retrieve_throughput_parameters: The parameters to provide for retrieving throughput
distribution for the current MongoDB container. Is either a RetrieveThroughputParameters type
or a IO[bytes] type. Required.
:type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters
or IO[bytes]
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _mongo_db_container_redistribute_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
redistribute_throughput_parameters: _models.RedistributeThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
'''Redistribute throughput for an Azure Cosmos DB MongoDB container.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param redistribute_throughput_parameters: The parameters to provide for redistributing
throughput for the current MongoDB container. Required.
:type redistribute_throughput_parameters:
~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
redistribute_throughput_parameters: _models.RedistributeThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
'''Redistribute throughput for an Azure Cosmos DB MongoDB container.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param redistribute_throughput_parameters: The parameters to provide for redistributing
throughput for the current MongoDB container. Required.
:type redistribute_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
redistribute_throughput_parameters: _models.RedistributeThroughputParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]:
'''Redistribute throughput for an Azure Cosmos DB MongoDB container.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param redistribute_throughput_parameters: The parameters to provide for redistributing
throughput for the current MongoDB container. Is either a RedistributeThroughputParameters type
or a IO[bytes] type. Required.
:type redistribute_throughput_parameters:
~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO[bytes]
:return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list_mongo_db_collections(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Iterable["_models.MongoDBCollectionGetResults"]:
'''Lists the MongoDB collection under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:return: An iterator like instance of either MongoDBCollectionGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_mongo_db_collection(
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> _models.MongoDBCollectionGetResults:
'''Gets the MongoDB collection under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:return: MongoDBCollectionGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _create_update_mongo_db_collection_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
create_update_mongo_db_collection_parameters: Union[_models.MongoDBCollectionCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_create_update_mongo_db_collection(
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
create_update_mongo_db_collection_parameters: _models.MongoDBCollectionCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoDBCollectionGetResults]:
'''Create or update an Azure Cosmos DB MongoDB Collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param create_update_mongo_db_collection_parameters: The parameters to provide for the current
MongoDB Collection. Required.
:type create_update_mongo_db_collection_parameters:
~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoDBCollectionGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_create_update_mongo_db_collection(
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
create_update_mongo_db_collection_parameters: _models.MongoDBCollectionCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoDBCollectionGetResults]:
'''Create or update an Azure Cosmos DB MongoDB Collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param create_update_mongo_db_collection_parameters: The parameters to provide for the current
MongoDB Collection. Required.
:type create_update_mongo_db_collection_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoDBCollectionGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_create_update_mongo_db_collection(
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
create_update_mongo_db_collection_parameters: _models.MongoDBCollectionCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoDBCollectionGetResults]:
'''Create or update an Azure Cosmos DB MongoDB Collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param create_update_mongo_db_collection_parameters: The parameters to provide for the current
MongoDB Collection. Is either a MongoDBCollectionCreateUpdateParameters type or a IO[bytes]
type. Required.
:type create_update_mongo_db_collection_parameters:
~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either MongoDBCollectionGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _delete_mongo_db_collection_initial(
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_delete_mongo_db_collection(
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> LROPoller[None]:
'''Deletes an existing Azure Cosmos DB MongoDB Collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _mongo_db_database_partition_merge_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
merge_parameters: Union[_models.MergeParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_mongo_db_database_partition_merge(
self,
resource_group_name: str,
account_name: str,
database_name: str,
merge_parameters: _models.MergeParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]:
'''Merges the partitions of a MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param merge_parameters: The parameters for the merge operation. Required.
:type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_mongo_db_database_partition_merge(
self,
resource_group_name: str,
account_name: str,
database_name: str,
merge_parameters: _models.MergeParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]:
'''Merges the partitions of a MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param merge_parameters: The parameters for the merge operation. Required.
:type merge_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_mongo_db_database_partition_merge(
self,
resource_group_name: str,
account_name: str,
database_name: str,
merge_parameters: _models.MergeParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]:
'''Merges the partitions of a MongoDB database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param merge_parameters: The parameters for the merge operation. Is either a MergeParameters
type or a IO[bytes] type. Required.
:type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO[bytes]
:return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _list_mongo_db_collection_partition_merge_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
merge_parameters: Union[_models.MergeParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
merge_parameters: _models.MergeParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]:
'''Merges the partitions of a MongoDB Collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param merge_parameters: The parameters for the merge operation. Required.
:type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
merge_parameters: _models.MergeParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]:
'''Merges the partitions of a MongoDB Collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param merge_parameters: The parameters for the merge operation. Required.
:type merge_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
merge_parameters: _models.MergeParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]:
'''Merges the partitions of a MongoDB Collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param merge_parameters: The parameters for the merge operation. Is either a MergeParameters
type or a IO[bytes] type. Required.
:type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO[bytes]
:return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or
the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def get_mongo_db_collection_throughput(
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> _models.ThroughputSettingsGetResults:
'''Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database
account with the provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:return: ThroughputSettingsGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _update_mongo_db_collection_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update the RUs per second of an Azure Cosmos DB MongoDB collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current MongoDB collection. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update the RUs per second of an Azure Cosmos DB MongoDB collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current MongoDB collection. Required.
:type update_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update the RUs per second of an Azure Cosmos DB MongoDB collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current MongoDB collection. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes]
type. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _migrate_mongo_db_collection_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_migrate_mongo_db_collection_to_autoscale( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _migrate_mongo_db_collection_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_migrate_mongo_db_collection_to_manual_throughput( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def get_mongo_role_definition(
self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any
) -> _models.MongoRoleDefinitionGetResults:
'''Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given
Id.
:param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required.
:type mongo_role_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: MongoRoleDefinitionGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _create_update_mongo_role_definition_initial( # pylint: disable=name-too-long
self,
mongo_role_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_role_definition_parameters: Union[
_models.MongoRoleDefinitionCreateUpdateParameters, IO[bytes]
],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long
self,
mongo_role_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_role_definition_parameters: _models.MongoRoleDefinitionCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoRoleDefinitionGetResults]:
'''Creates or updates an Azure Cosmos DB Mongo Role Definition.
:param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required.
:type mongo_role_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_mongo_role_definition_parameters: The properties required to create or
update a Role Definition. Required.
:type create_update_mongo_role_definition_parameters:
~azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoRoleDefinitionGetResults or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long
self,
mongo_role_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_role_definition_parameters: _models.MongoRoleDefinitionCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoRoleDefinitionGetResults]:
'''Creates or updates an Azure Cosmos DB Mongo Role Definition.
:param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required.
:type mongo_role_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_mongo_role_definition_parameters: The properties required to create or
update a Role Definition. Required.
:type create_update_mongo_role_definition_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoRoleDefinitionGetResults or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long
self,
mongo_role_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_role_definition_parameters: _models.MongoRoleDefinitionCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoRoleDefinitionGetResults]:
'''Creates or updates an Azure Cosmos DB Mongo Role Definition.
:param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required.
:type mongo_role_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_mongo_role_definition_parameters: The properties required to create or
update a Role Definition. Is either a MongoRoleDefinitionCreateUpdateParameters type or a
IO[bytes] type. Required.
:type create_update_mongo_role_definition_parameters:
~azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either MongoRoleDefinitionGetResults or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _delete_mongo_role_definition_initial(
self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_delete_mongo_role_definition(
self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any
) -> LROPoller[None]:
'''Deletes an existing Azure Cosmos DB Mongo Role Definition.
:param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required.
:type mongo_role_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list_mongo_role_definitions(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.MongoRoleDefinitionGetResults"]:
'''Retrieves the list of all Azure Cosmos DB Mongo Role Definitions.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either MongoRoleDefinitionGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_mongo_user_definition(
self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any
) -> _models.MongoUserDefinitionGetResults:
'''Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given
Id.
:param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required.
:type mongo_user_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: MongoUserDefinitionGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _create_update_mongo_user_definition_initial( # pylint: disable=name-too-long
self,
mongo_user_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_user_definition_parameters: Union[
_models.MongoUserDefinitionCreateUpdateParameters, IO[bytes]
],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long
self,
mongo_user_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_user_definition_parameters: _models.MongoUserDefinitionCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoUserDefinitionGetResults]:
'''Creates or updates an Azure Cosmos DB Mongo User Definition.
:param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required.
:type mongo_user_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_mongo_user_definition_parameters: The properties required to create or
update a User Definition. Required.
:type create_update_mongo_user_definition_parameters:
~azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoUserDefinitionGetResults or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long
self,
mongo_user_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_user_definition_parameters: _models.MongoUserDefinitionCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoUserDefinitionGetResults]:
'''Creates or updates an Azure Cosmos DB Mongo User Definition.
:param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required.
:type mongo_user_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_mongo_user_definition_parameters: The properties required to create or
update a User Definition. Required.
:type create_update_mongo_user_definition_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either MongoUserDefinitionGetResults or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long
self,
mongo_user_definition_id: str,
resource_group_name: str,
account_name: str,
create_update_mongo_user_definition_parameters: _models.MongoUserDefinitionCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.MongoUserDefinitionGetResults]:
'''Creates or updates an Azure Cosmos DB Mongo User Definition.
:param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required.
:type mongo_user_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param create_update_mongo_user_definition_parameters: The properties required to create or
update a User Definition. Is either a MongoUserDefinitionCreateUpdateParameters type or a
IO[bytes] type. Required.
:type create_update_mongo_user_definition_parameters:
~azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either MongoUserDefinitionGetResults or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _delete_mongo_user_definition_initial(
self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_delete_mongo_user_definition(
self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any
) -> LROPoller[None]:
'''Deletes an existing Azure Cosmos DB Mongo User Definition.
:param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required.
:type mongo_user_definition_id: str
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list_mongo_user_definitions(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.MongoUserDefinitionGetResults"]:
'''Retrieves the list of all Azure Cosmos DB Mongo User Definition.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either MongoUserDefinitionGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
location: _models.ContinuousBackupRestoreLocation,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.BackupInformation]:
'''Retrieves continuous backup information for a Mongodb collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param location: The name of the continuous backup restore location. Required.
:type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either BackupInformation or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
location: _models.ContinuousBackupRestoreLocation,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.BackupInformation]:
'''Retrieves continuous backup information for a Mongodb collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param location: The name of the continuous backup restore location. Required.
:type location: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either BackupInformation or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
database_name: str,
collection_name: str,
location: _models.ContinuousBackupRestoreLocation,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.BackupInformation]:
'''Retrieves continuous backup information for a Mongodb collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_name: Cosmos DB database name. Required.
:type database_name: str
:param collection_name: Cosmos DB collection name. Required.
:type collection_name: str
:param location: The name of the continuous backup restore location. Is either a
ContinuousBackupRestoreLocation type or a IO[bytes] type. Required.
:type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or IO[bytes]
:return: An instance of LROPoller that returns either BackupInformation or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
| 170 | 58 | 42 | 4 | 29 | 11 | 3 | 0.42 | 0 | 8 | 0 | 0 | 79 | 4 | 79 | 79 | 4,570 | 517 | 3,025 | 1,297 | 2,355 | 1,256 | 1,452 | 740 | 1,339 | 6 | 0 | 2 | 337 |
10,551 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_network_security_perimeter_configurations_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._network_security_perimeter_configurations_operations.NetworkSecurityPerimeterConfigurationsOperations
|
class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`network_security_perimeter_configurations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.NetworkSecurityPerimeterConfiguration"]:
"""Gets list of effective Network Security Perimeter Configuration for cosmos db account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either NetworkSecurityPerimeterConfiguration or the
result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfiguration]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.NetworkSecurityPerimeterConfigurationListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("NetworkSecurityPerimeterConfigurationListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get(
self,
resource_group_name: str,
account_name: str,
network_security_perimeter_configuration_name: str,
**kwargs: Any
) -> _models.NetworkSecurityPerimeterConfiguration:
"""Gets effective Network Security Perimeter Configuration for association.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param network_security_perimeter_configuration_name: The name for Network Security Perimeter
configuration. Required.
:type network_security_perimeter_configuration_name: str
:return: NetworkSecurityPerimeterConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
network_security_perimeter_configuration_name=network_security_perimeter_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _reconcile_initial(
self,
resource_group_name: str,
account_name: str,
network_security_perimeter_configuration_name: str,
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_reconcile_request(
resource_group_name=resource_group_name,
account_name=account_name,
network_security_perimeter_configuration_name=network_security_perimeter_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_reconcile(
self,
resource_group_name: str,
account_name: str,
network_security_perimeter_configuration_name: str,
**kwargs: Any
) -> LROPoller[None]:
"""Refreshes any information about the association.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param network_security_perimeter_configuration_name: The name for Network Security Perimeter
configuration. Required.
:type network_security_perimeter_configuration_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._reconcile_initial(
resource_group_name=resource_group_name,
account_name=account_name,
network_security_perimeter_configuration_name=network_security_perimeter_configuration_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method)
|
class NetworkSecurityPerimeterConfigurationsOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`network_security_perimeter_configurations` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.NetworkSecurityPerimeterConfiguration"]:
'''Gets list of effective Network Security Perimeter Configuration for cosmos db account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either NetworkSecurityPerimeterConfiguration or the
result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfiguration]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_next(next_link=None):
'''Gets effective Network Security Perimeter Configuration for association.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param network_security_perimeter_configuration_name: The name for Network Security Perimeter
configuration. Required.
:type network_security_perimeter_configuration_name: str
:return: NetworkSecurityPerimeterConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _reconcile_initial(
self,
resource_group_name: str,
account_name: str,
network_security_perimeter_configuration_name: str,
**kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_reconcile(
self,
resource_group_name: str,
account_name: str,
network_security_perimeter_configuration_name: str,
**kwargs: Any
) -> LROPoller[None]:
'''Refreshes any information about the association.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param network_security_perimeter_configuration_name: The name for Network Security Perimeter
configuration. Required.
:type network_security_perimeter_configuration_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
| 13 | 4 | 36 | 5 | 27 | 6 | 3 | 0.29 | 0 | 6 | 0 | 0 | 5 | 4 | 5 | 5 | 294 | 43 | 205 | 87 | 172 | 60 | 112 | 64 | 102 | 5 | 0 | 2 | 26 |
10,552 |
Azure/azure-cli-extensions
|
src/spring/azext_spring/vendored_sdks/appplatform/v2024_05_01_preview/aio/operations/_certificates_operations.py
|
azext_spring.vendored_sdks.appplatform.v2024_05_01_preview.aio.operations._certificates_operations.CertificatesOperations
|
class CertificatesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`certificates` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace_async
async def get(
self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any
) -> _models.CertificateResource:
"""Get the certificate resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param certificate_name: The name of the certificate resource. Required.
:type certificate_name: str
:return: CertificateResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
service_name=service_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CertificateResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
certificate_name: str,
certificate_resource: Union[_models.CertificateResource, IO[bytes]],
**kwargs: Any
) -> _models.CertificateResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(certificate_resource, (IOBase, bytes)):
_content = certificate_resource
else:
_json = self._serialize.body(certificate_resource, "CertificateResource")
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
service_name=service_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("CertificateResource", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("CertificateResource", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("CertificateResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
certificate_name: str,
certificate_resource: _models.CertificateResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.CertificateResource]:
"""Create or update certificate resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param certificate_name: The name of the certificate resource. Required.
:type certificate_name: str
:param certificate_resource: Parameters for the create or update operation. Required.
:type certificate_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either CertificateResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
certificate_name: str,
certificate_resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.CertificateResource]:
"""Create or update certificate resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param certificate_name: The name of the certificate resource. Required.
:type certificate_name: str
:param certificate_resource: Parameters for the create or update operation. Required.
:type certificate_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either CertificateResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
certificate_name: str,
certificate_resource: Union[_models.CertificateResource, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.CertificateResource]:
"""Create or update certificate resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param certificate_name: The name of the certificate resource. Required.
:type certificate_name: str
:param certificate_resource: Parameters for the create or update operation. Is either a
CertificateResource type or a IO[bytes] type. Required.
:type certificate_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either CertificateResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
service_name=service_name,
certificate_name=certificate_name,
certificate_resource=certificate_resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CertificateResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.CertificateResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.CertificateResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
service_name=service_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete the certificate resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param certificate_name: The name of the certificate resource. Required.
:type certificate_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
service_name=service_name,
certificate_name=certificate_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, service_name: str, **kwargs: Any
) -> AsyncIterable["_models.CertificateResource"]:
"""List all the certificates of one user.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: An iterator like instance of either CertificateResource or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("CertificateResourceCollection", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
|
class CertificatesOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`certificates` attribute.
'''
def __init__(self, *args, **kwargs) -> None:
pass
@distributed_trace_async
async def get(
self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any
) -> _models.CertificateResource:
'''Get the certificate resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param certificate_name: The name of the certificate resource. Required.
:type certificate_name: str
:return: CertificateResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
certificate_name: str,
certificate_resource: Union[_models.CertificateResource, IO[bytes]],
**kwargs: Any
) -> _models.CertificateResource:
pass
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
certificate_name: str,
certificate_resource: _models.CertificateResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.CertificateResource]:
'''Create or update certificate resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param certificate_name: The name of the certificate resource. Required.
:type certificate_name: str
:param certificate_resource: Parameters for the create or update operation. Required.
:type certificate_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either CertificateResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
certificate_name: str,
certificate_resource: _models.CertificateResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.CertificateResource]:
'''Create or update certificate resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param certificate_name: The name of the certificate resource. Required.
:type certificate_name: str
:param certificate_resource: Parameters for the create or update operation. Required.
:type certificate_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either CertificateResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
certificate_name: str,
certificate_resource: _models.CertificateResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.CertificateResource]:
'''Create or update certificate resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param certificate_name: The name of the certificate resource. Required.
:type certificate_name: str
:param certificate_resource: Parameters for the create or update operation. Is either a
CertificateResource type or a IO[bytes] type. Required.
:type certificate_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either CertificateResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any
) -> None:
pass
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
'''Delete the certificate resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param certificate_name: The name of the certificate resource. Required.
:type certificate_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list(
self, resource_group_name: str, service_name: str, **kwargs: Any
) -> AsyncIterable["_models.CertificateResource"]:
'''List all the certificates of one user.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: An iterator like instance of either CertificateResource or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
async def extract_data(pipeline_response):
pass
async def get_next(next_link=None):
pass
| 21 | 7 | 37 | 4 | 27 | 8 | 3 | 0.36 | 0 | 7 | 0 | 0 | 9 | 5 | 9 | 9 | 489 | 62 | 327 | 134 | 266 | 117 | 162 | 88 | 147 | 7 | 0 | 1 | 42 |
10,553 |
Azure/azure-cli-extensions
|
src/spring/azext_spring/vendored_sdks/appplatform/v2024_05_01_preview/aio/operations/_buildpack_binding_operations.py
|
azext_spring.vendored_sdks.appplatform.v2024_05_01_preview.aio.operations._buildpack_binding_operations.BuildpackBindingOperations
|
class BuildpackBindingOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`buildpack_binding` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_for_cluster(
self, resource_group_name: str, service_name: str, **kwargs: Any
) -> AsyncIterable["_models.BuildpackBindingResource"]:
"""Get collection of buildpack bindings under all builders.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: An iterator like instance of either BuildpackBindingResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_for_cluster_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("BuildpackBindingResourceCollection", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
@distributed_trace_async
async def get(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
buildpack_binding_name: str,
**kwargs: Any
) -> _models.BuildpackBindingResource:
"""Get a buildpack binding by name.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param buildpack_binding_name: The name of the Buildpack Binding Name. Required.
:type buildpack_binding_name: str
:return: BuildpackBindingResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
builder_name=builder_name,
buildpack_binding_name=buildpack_binding_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("BuildpackBindingResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
buildpack_binding_name: str,
buildpack_binding: Union[_models.BuildpackBindingResource, IO[bytes]],
**kwargs: Any
) -> _models.BuildpackBindingResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(buildpack_binding, (IOBase, bytes)):
_content = buildpack_binding
else:
_json = self._serialize.body(buildpack_binding, "BuildpackBindingResource")
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
builder_name=builder_name,
buildpack_binding_name=buildpack_binding_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("BuildpackBindingResource", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("BuildpackBindingResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
buildpack_binding_name: str,
buildpack_binding: _models.BuildpackBindingResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildpackBindingResource]:
"""Create or update a buildpack binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param buildpack_binding_name: The name of the Buildpack Binding Name. Required.
:type buildpack_binding_name: str
:param buildpack_binding: The target buildpack binding for the create or update operation.
Required.
:type buildpack_binding:
~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
buildpack_binding_name: str,
buildpack_binding: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildpackBindingResource]:
"""Create or update a buildpack binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param buildpack_binding_name: The name of the Buildpack Binding Name. Required.
:type buildpack_binding_name: str
:param buildpack_binding: The target buildpack binding for the create or update operation.
Required.
:type buildpack_binding: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
buildpack_binding_name: str,
buildpack_binding: Union[_models.BuildpackBindingResource, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.BuildpackBindingResource]:
"""Create or update a buildpack binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param buildpack_binding_name: The name of the Buildpack Binding Name. Required.
:type buildpack_binding_name: str
:param buildpack_binding: The target buildpack binding for the create or update operation. Is
either a BuildpackBindingResource type or a IO[bytes] type. Required.
:type buildpack_binding:
~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
builder_name=builder_name,
buildpack_binding_name=buildpack_binding_name,
buildpack_binding=buildpack_binding,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("BuildpackBindingResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.BuildpackBindingResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
buildpack_binding_name: str,
**kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
builder_name=builder_name,
buildpack_binding_name=buildpack_binding_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
async def begin_delete(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
buildpack_binding_name: str,
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Operation to delete a Buildpack Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param buildpack_binding_name: The name of the Buildpack Binding Name. Required.
:type buildpack_binding_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
builder_name=builder_name,
buildpack_binding_name=buildpack_binding_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any
) -> AsyncIterable["_models.BuildpackBindingResource"]:
"""Handles requests to list all buildpack bindings in a builder.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:return: An iterator like instance of either BuildpackBindingResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
builder_name=builder_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("BuildpackBindingResourceCollection", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
|
class BuildpackBindingOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`buildpack_binding` attribute.
'''
def __init__(self, *args, **kwargs) -> None:
pass
@distributed_trace
def list_for_cluster(
self, resource_group_name: str, service_name: str, **kwargs: Any
) -> AsyncIterable["_models.BuildpackBindingResource"]:
'''Get collection of buildpack bindings under all builders.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: An iterator like instance of either BuildpackBindingResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
async def extract_data(pipeline_response):
pass
async def get_next(next_link=None):
pass
@distributed_trace_async
async def get_next(next_link=None):
'''Get a buildpack binding by name.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param buildpack_binding_name: The name of the Buildpack Binding Name. Required.
:type buildpack_binding_name: str
:return: BuildpackBindingResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
buildpack_binding_name: str,
buildpack_binding: Union[_models.BuildpackBindingResource, IO[bytes]],
**kwargs: Any
) -> _models.BuildpackBindingResource:
pass
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
buildpack_binding_name: str,
buildpack_binding: _models.BuildpackBindingResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildpackBindingResource]:
'''Create or update a buildpack binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param buildpack_binding_name: The name of the Buildpack Binding Name. Required.
:type buildpack_binding_name: str
:param buildpack_binding: The target buildpack binding for the create or update operation.
Required.
:type buildpack_binding:
~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
buildpack_binding_name: str,
buildpack_binding: _models.BuildpackBindingResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildpackBindingResource]:
'''Create or update a buildpack binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param buildpack_binding_name: The name of the Buildpack Binding Name. Required.
:type buildpack_binding_name: str
:param buildpack_binding: The target buildpack binding for the create or update operation.
Required.
:type buildpack_binding: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
buildpack_binding_name: str,
buildpack_binding: _models.BuildpackBindingResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildpackBindingResource]:
'''Create or update a buildpack binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param buildpack_binding_name: The name of the Buildpack Binding Name. Required.
:type buildpack_binding_name: str
:param buildpack_binding: The target buildpack binding for the create or update operation. Is
either a BuildpackBindingResource type or a IO[bytes] type. Required.
:type buildpack_binding:
~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
buildpack_binding_name: str,
**kwargs: Any
) -> None:
pass
@distributed_trace_async
async def begin_delete(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
buildpack_binding_name: str,
**kwargs: Any
) -> AsyncLROPoller[None]:
'''Operation to delete a Buildpack Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param buildpack_binding_name: The name of the Buildpack Binding Name. Required.
:type buildpack_binding_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list_for_cluster(
self, resource_group_name: str, service_name: str, **kwargs: Any
) -> AsyncIterable["_models.BuildpackBindingResource"]:
'''Handles requests to list all buildpack bindings in a builder.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:return: An iterator like instance of either BuildpackBindingResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
async def extract_data(pipeline_response):
pass
async def get_next(next_link=None):
pass
| 26 | 8 | 40 | 4 | 29 | 9 | 3 | 0.37 | 0 | 7 | 0 | 0 | 10 | 5 | 10 | 10 | 640 | 74 | 426 | 181 | 332 | 159 | 196 | 106 | 177 | 6 | 0 | 1 | 48 |
10,554 |
Azure/azure-cli-extensions
|
src/spring/azext_spring/vendored_sdks/appplatform/v2024_05_01_preview/aio/operations/_build_service_operations.py
|
azext_spring.vendored_sdks.appplatform.v2024_05_01_preview.aio.operations._build_service_operations.BuildServiceOperations
|
class BuildServiceOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`build_service` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_build_services(
self, resource_group_name: str, service_name: str, **kwargs: Any
) -> AsyncIterable["_models.BuildService"]:
"""List build services resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: An iterator like instance of either BuildService or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_build_services_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("BuildServiceCollection", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
@distributed_trace_async
async def get_build_service(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> _models.BuildService:
"""Get a build service resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:return: BuildService or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BuildService] = kwargs.pop("cls", None)
_request = build_get_build_service_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("BuildService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_service: Union[_models.BuildService, IO[bytes]],
**kwargs: Any
) -> _models.BuildService:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BuildService] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(build_service, (IOBase, bytes)):
_content = build_service
else:
_json = self._serialize.body(build_service, "BuildService")
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("BuildService", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("BuildService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_service: _models.BuildService,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildService]:
"""Create a build service resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_service: Parameters for the create operation. Required.
:type build_service: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuildService or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_service: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildService]:
"""Create a build service resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_service: Parameters for the create operation. Required.
:type build_service: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuildService or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_service: Union[_models.BuildService, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.BuildService]:
"""Create a build service resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_service: Parameters for the create operation. Is either a BuildService type or a
IO[bytes] type. Required.
:type build_service: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService or
IO[bytes]
:return: An instance of AsyncLROPoller that returns either BuildService or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BuildService] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
build_service=build_service,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("BuildService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(
AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.BuildService].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.BuildService](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace
def list_builds(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> AsyncIterable["_models.Build"]:
"""List KPack builds.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:return: An iterator like instance of either Build or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.Build]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_builds_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("BuildCollection", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
@distributed_trace_async
async def get_build(
self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any
) -> _models.Build:
"""Get a KPack build.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:return: Build or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.Build] = kwargs.pop("cls", None)
_request = build_get_build_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
build_name=build_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("Build", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def create_or_update_build(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_name: str,
build: _models.Build,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.Build:
"""Create or update a KPack build.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:param build: Parameters for the create or update operation. Required.
:type build: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: Build or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def create_or_update_build(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_name: str,
build: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.Build:
"""Create or update a KPack build.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:param build: Parameters for the create or update operation. Required.
:type build: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: Build or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def create_or_update_build(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_name: str,
build: Union[_models.Build, IO[bytes]],
**kwargs: Any
) -> _models.Build:
"""Create or update a KPack build.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:param build: Parameters for the create or update operation. Is either a Build type or a
IO[bytes] type. Required.
:type build: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build or IO[bytes]
:return: Build or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Build] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(build, (IOBase, bytes)):
_content = build
else:
_json = self._serialize.body(build, "Build")
_request = build_create_or_update_build_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
build_name=build_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Build", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Build", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _delete_build_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
_request = build_delete_build_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
build_name=build_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
if cls:
return cls(pipeline_response, None, response_headers) # type: ignore
@distributed_trace_async
async def begin_delete_build(
self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""delete a KPack build.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_build_initial( # type: ignore
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
build_name=build_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list_build_results(
self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any
) -> AsyncIterable["_models.BuildResult"]:
"""List KPack build results.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:return: An iterator like instance of either BuildResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_build_results_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
build_name=build_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("BuildResultCollection", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
@distributed_trace_async
async def get_build_result(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_name: str,
build_result_name: str,
**kwargs: Any
) -> _models.BuildResult:
"""Get a KPack build result.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:param build_result_name: The name of the build result resource. Required.
:type build_result_name: str
:return: BuildResult or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None)
_request = build_get_build_result_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
build_name=build_name,
build_result_name=build_result_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("BuildResult", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace_async
async def get_build_result_log(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_name: str,
build_result_name: str,
**kwargs: Any
) -> _models.BuildResultLog:
"""Get a KPack build result log download URL.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:param build_result_name: The name of the build result resource. Required.
:type build_result_name: str
:return: BuildResultLog or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResultLog
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None)
_request = build_get_build_result_log_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
build_name=build_name,
build_result_name=build_result_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("BuildResultLog", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace_async
async def get_resource_upload_url(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> _models.ResourceUploadDefinition:
"""Get an resource upload URL for build service, which may be artifacts or source archive.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:return: ResourceUploadDefinition or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ResourceUploadDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None)
_request = build_get_resource_upload_url_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ResourceUploadDefinition", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace_async
async def list_supported_buildpacks(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> _models.SupportedBuildpacksCollection:
"""Get all supported buildpacks.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:return: SupportedBuildpacksCollection or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedBuildpacksCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None)
_request = build_list_supported_buildpacks_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("SupportedBuildpacksCollection", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace_async
async def get_supported_buildpack(
self, resource_group_name: str, service_name: str, build_service_name: str, buildpack_name: str, **kwargs: Any
) -> _models.SupportedBuildpackResource:
"""Get the supported buildpack resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param buildpack_name: The name of the buildpack resource. Required.
:type buildpack_name: str
:return: SupportedBuildpackResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedBuildpackResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None)
_request = build_get_supported_buildpack_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
buildpack_name=buildpack_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("SupportedBuildpackResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace_async
async def list_supported_stacks(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> _models.SupportedStacksCollection:
"""Get all supported stacks.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:return: SupportedStacksCollection or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedStacksCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None)
_request = build_list_supported_stacks_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("SupportedStacksCollection", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace_async
async def get_supported_stack(
self, resource_group_name: str, service_name: str, build_service_name: str, stack_name: str, **kwargs: Any
) -> _models.SupportedStackResource:
"""Get the supported stack resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param stack_name: The name of the stack resource. Required.
:type stack_name: str
:return: SupportedStackResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedStackResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None)
_request = build_get_supported_stack_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
stack_name=stack_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("SupportedStackResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
|
class BuildServiceOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`build_service` attribute.
'''
def __init__(self, *args, **kwargs) -> None:
pass
@distributed_trace
def list_build_services(
self, resource_group_name: str, service_name: str, **kwargs: Any
) -> AsyncIterable["_models.BuildService"]:
'''List build services resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: An iterator like instance of either BuildService or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
async def extract_data(pipeline_response):
pass
async def get_next(next_link=None):
pass
@distributed_trace_async
async def get_build_service(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> _models.BuildService:
'''Get a build service resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:return: BuildService or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_service: Union[_models.BuildService, IO[bytes]],
**kwargs: Any
) -> _models.BuildService:
pass
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_service: _models.BuildService,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildService]:
'''Create a build service resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_service: Parameters for the create operation. Required.
:type build_service: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuildService or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_service: _models.BuildService,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildService]:
'''Create a build service resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_service: Parameters for the create operation. Required.
:type build_service: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuildService or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_service: _models.BuildService,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildService]:
'''Create a build service resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_service: Parameters for the create operation. Is either a BuildService type or a
IO[bytes] type. Required.
:type build_service: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService or
IO[bytes]
:return: An instance of AsyncLROPoller that returns either BuildService or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list_builds(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> AsyncIterable["_models.Build"]:
'''List KPack builds.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:return: An iterator like instance of either Build or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.Build]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
async def extract_data(pipeline_response):
pass
async def get_next(next_link=None):
pass
@distributed_trace_async
async def get_build_service(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> _models.BuildService:
'''Get a KPack build.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:return: Build or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def create_or_update_build(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_name: str,
build: _models.Build,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.Build:
'''Create or update a KPack build.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:param build: Parameters for the create or update operation. Required.
:type build: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: Build or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def create_or_update_build(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_name: str,
build: _models.Build,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.Build:
'''Create or update a KPack build.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:param build: Parameters for the create or update operation. Required.
:type build: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: Build or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def create_or_update_build(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_name: str,
build: _models.Build,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.Build:
'''Create or update a KPack build.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:param build: Parameters for the create or update operation. Is either a Build type or a
IO[bytes] type. Required.
:type build: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build or IO[bytes]
:return: Build or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
async def _delete_build_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any
) -> None:
pass
@distributed_trace_async
async def begin_delete_build(
self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
'''delete a KPack build.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list_build_results(
self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any
) -> AsyncIterable["_models.BuildResult"]:
'''List KPack build results.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:return: An iterator like instance of either BuildResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
async def extract_data(pipeline_response):
pass
async def get_next(next_link=None):
pass
@distributed_trace_async
async def get_build_result(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_name: str,
build_result_name: str,
**kwargs: Any
) -> _models.BuildResult:
'''Get a KPack build result.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:param build_result_name: The name of the build result resource. Required.
:type build_result_name: str
:return: BuildResult or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResult
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def get_build_result_log(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
build_name: str,
build_result_name: str,
**kwargs: Any
) -> _models.BuildResultLog:
'''Get a KPack build result log download URL.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param build_name: The name of the build resource. Required.
:type build_name: str
:param build_result_name: The name of the build result resource. Required.
:type build_result_name: str
:return: BuildResultLog or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResultLog
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def get_resource_upload_url(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> _models.ResourceUploadDefinition:
'''Get an resource upload URL for build service, which may be artifacts or source archive.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:return: ResourceUploadDefinition or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ResourceUploadDefinition
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def list_supported_buildpacks(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> _models.SupportedBuildpacksCollection:
'''Get all supported buildpacks.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:return: SupportedBuildpacksCollection or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedBuildpacksCollection
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def get_supported_buildpack(
self, resource_group_name: str, service_name: str, build_service_name: str, buildpack_name: str, **kwargs: Any
) -> _models.SupportedBuildpackResource:
'''Get the supported buildpack resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param buildpack_name: The name of the buildpack resource. Required.
:type buildpack_name: str
:return: SupportedBuildpackResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedBuildpackResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def list_supported_stacks(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> _models.SupportedStacksCollection:
'''Get all supported stacks.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:return: SupportedStacksCollection or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedStacksCollection
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def get_supported_stack(
self, resource_group_name: str, service_name: str, build_service_name: str, stack_name: str, **kwargs: Any
) -> _models.SupportedStackResource:
'''Get the supported stack resource.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param stack_name: The name of the stack resource. Required.
:type stack_name: str
:return: SupportedStackResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedStackResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
| 53 | 20 | 45 | 6 | 31 | 11 | 3 | 0.39 | 0 | 7 | 0 | 0 | 22 | 5 | 22 | 22 | 1,376 | 193 | 887 | 348 | 734 | 344 | 427 | 229 | 393 | 6 | 0 | 1 | 88 |
10,555 |
Azure/azure-cli-extensions
|
src/spring/azext_spring/vendored_sdks/appplatform/v2024_05_01_preview/aio/operations/_build_service_builder_operations.py
|
azext_spring.vendored_sdks.appplatform.v2024_05_01_preview.aio.operations._build_service_builder_operations.BuildServiceBuilderOperations
|
class BuildServiceBuilderOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`build_service_builder` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace_async
async def get(
self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any
) -> _models.BuilderResource:
"""Get a KPack builder.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:return: BuilderResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
builder_name=builder_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("BuilderResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
builder_resource: Union[_models.BuilderResource, IO[bytes]],
**kwargs: Any
) -> _models.BuilderResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(builder_resource, (IOBase, bytes)):
_content = builder_resource
else:
_json = self._serialize.body(builder_resource, "BuilderResource")
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
builder_name=builder_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("BuilderResource", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("BuilderResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
builder_resource: _models.BuilderResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuilderResource]:
"""Create or update a KPack builder.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param builder_resource: The target builder for the create or update operation. Required.
:type builder_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuilderResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
builder_resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuilderResource]:
"""Create or update a KPack builder.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param builder_resource: The target builder for the create or update operation. Required.
:type builder_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuilderResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
builder_resource: Union[_models.BuilderResource, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.BuilderResource]:
"""Create or update a KPack builder.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param builder_resource: The target builder for the create or update operation. Is either a
BuilderResource type or a IO[bytes] type. Required.
:type builder_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource or
IO[bytes]
:return: An instance of AsyncLROPoller that returns either BuilderResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
builder_name=builder_name,
builder_resource=builder_resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("BuilderResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.BuilderResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.BuilderResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
builder_name=builder_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a KPack builder.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
builder_name=builder_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> AsyncIterable["_models.BuilderResource"]:
"""List KPack builders result.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:return: An iterator like instance of either BuilderResource or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("BuilderResourceCollection", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
@distributed_trace_async
async def list_deployments(
self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any
) -> _models.DeploymentList:
"""List deployments that are using the builder.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:return: DeploymentList or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentList
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None)
_request = build_list_deployments_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
builder_name=builder_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DeploymentList", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
|
class BuildServiceBuilderOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`build_service_builder` attribute.
'''
def __init__(self, *args, **kwargs) -> None:
pass
@distributed_trace_async
async def get(
self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any
) -> _models.BuilderResource:
'''Get a KPack builder.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:return: BuilderResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
builder_resource: Union[_models.BuilderResource, IO[bytes]],
**kwargs: Any
) -> _models.BuilderResource:
pass
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
builder_resource: _models.BuilderResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuilderResource]:
'''Create or update a KPack builder.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param builder_resource: The target builder for the create or update operation. Required.
:type builder_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuilderResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
builder_resource: _models.BuilderResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuilderResource]:
'''Create or update a KPack builder.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param builder_resource: The target builder for the create or update operation. Required.
:type builder_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuilderResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
builder_name: str,
builder_resource: _models.BuilderResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuilderResource]:
'''Create or update a KPack builder.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:param builder_resource: The target builder for the create or update operation. Is either a
BuilderResource type or a IO[bytes] type. Required.
:type builder_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource or
IO[bytes]
:return: An instance of AsyncLROPoller that returns either BuilderResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any
) -> None:
pass
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
'''Delete a KPack builder.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> AsyncIterable["_models.BuilderResource"]:
'''List KPack builders result.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:return: An iterator like instance of either BuilderResource or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
async def extract_data(pipeline_response):
pass
async def get_next(next_link=None):
pass
@distributed_trace_async
async def list_deployments(
self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any
) -> _models.DeploymentList:
'''List deployments that are using the builder.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param builder_name: The name of the builder resource. Required.
:type builder_name: str
:return: DeploymentList or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentList
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
| 23 | 8 | 40 | 4 | 28 | 10 | 3 | 0.39 | 0 | 7 | 0 | 0 | 10 | 5 | 10 | 10 | 573 | 72 | 376 | 152 | 307 | 145 | 180 | 99 | 164 | 6 | 0 | 1 | 44 |
10,556 |
Azure/azure-cli-extensions
|
src/spring/azext_spring/vendored_sdks/appplatform/v2024_05_01_preview/aio/operations/_build_service_agent_pool_operations.py
|
azext_spring.vendored_sdks.appplatform.v2024_05_01_preview.aio.operations._build_service_agent_pool_operations.BuildServiceAgentPoolOperations
|
class BuildServiceAgentPoolOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`build_service_agent_pool` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]:
"""List build service agent pool.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:return: An iterator like instance of either BuildServiceAgentPoolResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("BuildServiceAgentPoolResourceCollection", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
@distributed_trace_async
async def get(
self, resource_group_name: str, service_name: str, build_service_name: str, agent_pool_name: str, **kwargs: Any
) -> _models.BuildServiceAgentPoolResource:
"""Get build service agent pool.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param agent_pool_name: The name of the build service agent pool resource. Required.
:type agent_pool_name: str
:return: BuildServiceAgentPoolResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
agent_pool_name=agent_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _update_put_initial(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
agent_pool_name: str,
agent_pool_resource: Union[_models.BuildServiceAgentPoolResource, IO[bytes]],
**kwargs: Any
) -> _models.BuildServiceAgentPoolResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(agent_pool_resource, (IOBase, bytes)):
_content = agent_pool_resource
else:
_json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource")
_request = build_update_put_request(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
agent_pool_name=agent_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_update_put(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
agent_pool_name: str,
agent_pool_resource: _models.BuildServiceAgentPoolResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildServiceAgentPoolResource]:
"""Create or update build service agent pool.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param agent_pool_name: The name of the build service agent pool resource. Required.
:type agent_pool_name: str
:param agent_pool_resource: Parameters for the update operation. Required.
:type agent_pool_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_put(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
agent_pool_name: str,
agent_pool_resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildServiceAgentPoolResource]:
"""Create or update build service agent pool.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param agent_pool_name: The name of the build service agent pool resource. Required.
:type agent_pool_name: str
:param agent_pool_resource: Parameters for the update operation. Required.
:type agent_pool_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_put(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
agent_pool_name: str,
agent_pool_resource: Union[_models.BuildServiceAgentPoolResource, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.BuildServiceAgentPoolResource]:
"""Create or update build service agent pool.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param agent_pool_name: The name of the build service agent pool resource. Required.
:type agent_pool_name: str
:param agent_pool_resource: Parameters for the update operation. Is either a
BuildServiceAgentPoolResource type or a IO[bytes] type. Required.
:type agent_pool_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_put_initial(
resource_group_name=resource_group_name,
service_name=service_name,
build_service_name=build_service_name,
agent_pool_name=agent_pool_name,
agent_pool_resource=agent_pool_resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.BuildServiceAgentPoolResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
|
class BuildServiceAgentPoolOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`build_service_agent_pool` attribute.
'''
def __init__(self, *args, **kwargs) -> None:
pass
@distributed_trace
def list(
self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any
) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]:
'''List build service agent pool.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:return: An iterator like instance of either BuildServiceAgentPoolResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
async def extract_data(pipeline_response):
pass
async def get_next(next_link=None):
pass
@distributed_trace_async
async def get_next(next_link=None):
'''Get build service agent pool.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param agent_pool_name: The name of the build service agent pool resource. Required.
:type agent_pool_name: str
:return: BuildServiceAgentPoolResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
async def _update_put_initial(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
agent_pool_name: str,
agent_pool_resource: Union[_models.BuildServiceAgentPoolResource, IO[bytes]],
**kwargs: Any
) -> _models.BuildServiceAgentPoolResource:
pass
@overload
async def begin_update_put(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
agent_pool_name: str,
agent_pool_resource: _models.BuildServiceAgentPoolResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildServiceAgentPoolResource]:
'''Create or update build service agent pool.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param agent_pool_name: The name of the build service agent pool resource. Required.
:type agent_pool_name: str
:param agent_pool_resource: Parameters for the update operation. Required.
:type agent_pool_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_update_put(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
agent_pool_name: str,
agent_pool_resource: _models.BuildServiceAgentPoolResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildServiceAgentPoolResource]:
'''Create or update build service agent pool.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param agent_pool_name: The name of the build service agent pool resource. Required.
:type agent_pool_name: str
:param agent_pool_resource: Parameters for the update operation. Required.
:type agent_pool_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_update_put(
self,
resource_group_name: str,
service_name: str,
build_service_name: str,
agent_pool_name: str,
agent_pool_resource: _models.BuildServiceAgentPoolResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BuildServiceAgentPoolResource]:
'''Create or update build service agent pool.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param build_service_name: The name of the build service resource. Required.
:type build_service_name: str
:param agent_pool_name: The name of the build service agent pool resource. Required.
:type agent_pool_name: str
:param agent_pool_resource: Parameters for the update operation. Is either a
BuildServiceAgentPoolResource type or a IO[bytes] type. Required.
:type agent_pool_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
| 17 | 6 | 40 | 4 | 27 | 10 | 3 | 0.43 | 0 | 7 | 0 | 0 | 7 | 5 | 7 | 7 | 401 | 48 | 254 | 112 | 197 | 109 | 121 | 67 | 109 | 6 | 0 | 1 | 31 |
10,557 |
Azure/azure-cli-extensions
|
src/spring/azext_spring/vendored_sdks/appplatform/v2024_05_01_preview/aio/operations/_bindings_operations.py
|
azext_spring.vendored_sdks.appplatform.v2024_05_01_preview.aio.operations._bindings_operations.BindingsOperations
|
class BindingsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`bindings` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace_async
async def get(
self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any
) -> _models.BindingResource:
"""Get a Binding and its properties.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:return: BindingResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
binding_name=binding_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("BindingResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: Union[_models.BindingResource, IO[bytes]],
**kwargs: Any
) -> _models.BindingResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(binding_resource, (IOBase, bytes)):
_content = binding_resource
else:
_json = self._serialize.body(binding_resource, "BindingResource")
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
binding_name=binding_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("BindingResource", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("BindingResource", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("BindingResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: _models.BindingResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BindingResource]:
"""Create a new Binding or update an exiting Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:param binding_resource: Parameters for the create or update operation. Required.
:type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BindingResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BindingResource]:
"""Create a new Binding or update an exiting Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:param binding_resource: Parameters for the create or update operation. Required.
:type binding_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BindingResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: Union[_models.BindingResource, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.BindingResource]:
"""Create a new Binding or update an exiting Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:param binding_resource: Parameters for the create or update operation. Is either a
BindingResource type or a IO[bytes] type. Required.
:type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource or
IO[bytes]
:return: An instance of AsyncLROPoller that returns either BindingResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
binding_name=binding_name,
binding_resource=binding_resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("BindingResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.BindingResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.BindingResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
binding_name=binding_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Operation to delete a Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
binding_name=binding_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _update_initial(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: Union[_models.BindingResource, IO[bytes]],
**kwargs: Any
) -> _models.BindingResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(binding_resource, (IOBase, bytes)):
_content = binding_resource
else:
_json = self._serialize.body(binding_resource, "BindingResource")
_request = build_update_request(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
binding_name=binding_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("BindingResource", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("BindingResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: _models.BindingResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BindingResource]:
"""Operation to update an exiting Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:param binding_resource: Parameters for the update operation. Required.
:type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BindingResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BindingResource]:
"""Operation to update an exiting Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:param binding_resource: Parameters for the update operation. Required.
:type binding_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BindingResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: Union[_models.BindingResource, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.BindingResource]:
"""Operation to update an exiting Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:param binding_resource: Parameters for the update operation. Is either a BindingResource type
or a IO[bytes] type. Required.
:type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource or
IO[bytes]
:return: An instance of AsyncLROPoller that returns either BindingResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_initial(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
binding_name=binding_name,
binding_resource=binding_resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("BindingResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.BindingResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.BindingResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace
def list(
self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any
) -> AsyncIterable["_models.BindingResource"]:
"""Handles requests to list all resources in an App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:return: An iterator like instance of either BindingResource or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("BindingResourceCollection", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
|
class BindingsOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`bindings` attribute.
'''
def __init__(self, *args, **kwargs) -> None:
pass
@distributed_trace_async
async def get(
self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any
) -> _models.BindingResource:
'''Get a Binding and its properties.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:return: BindingResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: Union[_models.BindingResource, IO[bytes]],
**kwargs: Any
) -> _models.BindingResource:
pass
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: _models.BindingResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BindingResource]:
'''Create a new Binding or update an exiting Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:param binding_resource: Parameters for the create or update operation. Required.
:type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BindingResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: _models.BindingResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BindingResource]:
'''Create a new Binding or update an exiting Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:param binding_resource: Parameters for the create or update operation. Required.
:type binding_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BindingResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: _models.BindingResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BindingResource]:
'''Create a new Binding or update an exiting Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:param binding_resource: Parameters for the create or update operation. Is either a
BindingResource type or a IO[bytes] type. Required.
:type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource or
IO[bytes]
:return: An instance of AsyncLROPoller that returns either BindingResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any
) -> None:
pass
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
'''Operation to delete a Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
async def _update_initial(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: Union[_models.BindingResource, IO[bytes]],
**kwargs: Any
) -> _models.BindingResource:
pass
@overload
async def begin_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: _models.BindingResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BindingResource]:
'''Operation to update an exiting Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:param binding_resource: Parameters for the update operation. Required.
:type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BindingResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: _models.BindingResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BindingResource]:
'''Operation to update an exiting Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:param binding_resource: Parameters for the update operation. Required.
:type binding_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either BindingResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
binding_name: str,
binding_resource: _models.BindingResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.BindingResource]:
'''Operation to update an exiting Binding.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param binding_name: The name of the Binding resource. Required.
:type binding_name: str
:param binding_resource: Parameters for the update operation. Is either a BindingResource type
or a IO[bytes] type. Required.
:type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource or
IO[bytes]
:return: An instance of AsyncLROPoller that returns either BindingResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list(
self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any
) -> AsyncIterable["_models.BindingResource"]:
'''Handles requests to list all resources in an App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:return: An iterator like instance of either BindingResource or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
async def extract_data(pipeline_response):
pass
async def get_next(next_link=None):
pass
| 29 | 10 | 40 | 4 | 28 | 10 | 3 | 0.41 | 0 | 7 | 0 | 0 | 13 | 5 | 13 | 13 | 733 | 83 | 477 | 206 | 368 | 195 | 218 | 117 | 198 | 7 | 0 | 1 | 57 |
10,558 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_collection_partition_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._collection_partition_operations.CollectionPartitionOperations
|
class CollectionPartitionOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`collection_partition` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_metrics(
self,
resource_group_name: str,
account_name: str,
database_rid: str,
collection_rid: str,
filter: str,
**kwargs: Any
) -> Iterable["_models.PartitionMetric"]:
"""Retrieves the metrics determined by the given filter for the given collection, split by
partition.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param collection_rid: Cosmos DB collection rid. Required.
:type collection_rid: str
:param filter: An OData filter expression that describes a subset of metrics to return. The
parameters that can be filtered are name.value (name of the metric, can have an or of multiple
names), startTime, endTime, and timeGrain. The supported operator is eq. Required.
:type filter: str
:return: An iterator like instance of either PartitionMetric or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_metrics_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_rid=database_rid,
collection_rid=collection_rid,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("PartitionMetricListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def list_usages(
self,
resource_group_name: str,
account_name: str,
database_rid: str,
collection_rid: str,
filter: Optional[str] = None,
**kwargs: Any
) -> Iterable["_models.PartitionUsage"]:
"""Retrieves the usages (most recent storage data) for the given collection, split by partition.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param collection_rid: Cosmos DB collection rid. Required.
:type collection_rid: str
:param filter: An OData filter expression that describes a subset of usages to return. The
supported parameter is name.value (name of the metric, can have an or of multiple names).
Default value is None.
:type filter: str
:return: An iterator like instance of either PartitionUsage or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionUsage]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartitionUsagesResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_usages_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_rid=database_rid,
collection_rid=collection_rid,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("PartitionUsagesResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
|
class CollectionPartitionOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`collection_partition` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list_metrics(
self,
resource_group_name: str,
account_name: str,
database_rid: str,
collection_rid: str,
filter: str,
**kwargs: Any
) -> Iterable["_models.PartitionMetric"]:
'''Retrieves the metrics determined by the given filter for the given collection, split by
partition.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param collection_rid: Cosmos DB collection rid. Required.
:type collection_rid: str
:param filter: An OData filter expression that describes a subset of metrics to return. The
parameters that can be filtered are name.value (name of the metric, can have an or of multiple
names), startTime, endTime, and timeGrain. The supported operator is eq. Required.
:type filter: str
:return: An iterator like instance of either PartitionMetric or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def list_usages(
self,
resource_group_name: str,
account_name: str,
database_rid: str,
collection_rid: str,
filter: Optional[str] = None,
**kwargs: Any
) -> Iterable["_models.PartitionUsage"]:
'''Retrieves the usages (most recent storage data) for the given collection, split by partition.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param collection_rid: Cosmos DB collection rid. Required.
:type collection_rid: str
:param filter: An OData filter expression that describes a subset of usages to return. The
supported parameter is name.value (name of the metric, can have an or of multiple names).
Default value is None.
:type filter: str
:return: An iterator like instance of either PartitionUsage or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionUsage]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
| 12 | 3 | 34 | 4 | 26 | 5 | 2 | 0.35 | 0 | 5 | 0 | 0 | 3 | 4 | 3 | 3 | 219 | 29 | 144 | 62 | 116 | 50 | 76 | 44 | 66 | 5 | 0 | 1 | 19 |
10,559 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_collection_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._collection_operations.CollectionOperations
|
class CollectionOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`collection` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_metrics(
self,
resource_group_name: str,
account_name: str,
database_rid: str,
collection_rid: str,
filter: str,
**kwargs: Any
) -> Iterable["_models.Metric"]:
"""Retrieves the metrics determined by the given filter for the given database account and
collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param collection_rid: Cosmos DB collection rid. Required.
:type collection_rid: str
:param filter: An OData filter expression that describes a subset of metrics to return. The
parameters that can be filtered are name.value (name of the metric, can have an or of multiple
names), startTime, endTime, and timeGrain. The supported operator is eq. Required.
:type filter: str
:return: An iterator like instance of either Metric or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_metrics_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_rid=database_rid,
collection_rid=collection_rid,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("MetricListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def list_usages(
self,
resource_group_name: str,
account_name: str,
database_rid: str,
collection_rid: str,
filter: Optional[str] = None,
**kwargs: Any
) -> Iterable["_models.Usage"]:
"""Retrieves the usages (most recent storage data) for the given collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param collection_rid: Cosmos DB collection rid. Required.
:type collection_rid: str
:param filter: An OData filter expression that describes a subset of usages to return. The
supported parameter is name.value (name of the metric, can have an or of multiple names).
Default value is None.
:type filter: str
:return: An iterator like instance of either Usage or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Usage]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_usages_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_rid=database_rid,
collection_rid=collection_rid,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("UsagesResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def list_metric_definitions(
self, resource_group_name: str, account_name: str, database_rid: str, collection_rid: str, **kwargs: Any
) -> Iterable["_models.MetricDefinition"]:
"""Retrieves metric definitions for the given collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param collection_rid: Cosmos DB collection rid. Required.
:type collection_rid: str
:return: An iterator like instance of either MetricDefinition or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinition]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_metric_definitions_request(
resource_group_name=resource_group_name,
account_name=account_name,
database_rid=database_rid,
collection_rid=collection_rid,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("MetricDefinitionsListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
|
class CollectionOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`collection` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list_metrics(
self,
resource_group_name: str,
account_name: str,
database_rid: str,
collection_rid: str,
filter: str,
**kwargs: Any
) -> Iterable["_models.Metric"]:
'''Retrieves the metrics determined by the given filter for the given database account and
collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param collection_rid: Cosmos DB collection rid. Required.
:type collection_rid: str
:param filter: An OData filter expression that describes a subset of metrics to return. The
parameters that can be filtered are name.value (name of the metric, can have an or of multiple
names), startTime, endTime, and timeGrain. The supported operator is eq. Required.
:type filter: str
:return: An iterator like instance of either Metric or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def list_usages(
self,
resource_group_name: str,
account_name: str,
database_rid: str,
collection_rid: str,
filter: Optional[str] = None,
**kwargs: Any
) -> Iterable["_models.Usage"]:
'''Retrieves the usages (most recent storage data) for the given collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param collection_rid: Cosmos DB collection rid. Required.
:type collection_rid: str
:param filter: An OData filter expression that describes a subset of usages to return. The
supported parameter is name.value (name of the metric, can have an or of multiple names).
Default value is None.
:type filter: str
:return: An iterator like instance of either Usage or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Usage]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def list_metric_definitions(
self, resource_group_name: str, account_name: str, database_rid: str, collection_rid: str, **kwargs: Any
) -> Iterable["_models.MetricDefinition"]:
'''Retrieves metric definitions for the given collection.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param database_rid: Cosmos DB database rid. Required.
:type database_rid: str
:param collection_rid: Cosmos DB collection rid. Required.
:type collection_rid: str
:return: An iterator like instance of either MetricDefinition or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinition]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
| 17 | 4 | 34 | 4 | 26 | 5 | 2 | 0.33 | 0 | 5 | 0 | 0 | 4 | 4 | 4 | 4 | 308 | 42 | 205 | 83 | 170 | 67 | 110 | 62 | 96 | 5 | 0 | 1 | 26 |
10,560 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_chaos_fault_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._chaos_fault_operations.ChaosFaultOperations
|
class ChaosFaultOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`chaos_fault` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.ChaosFaultResource"]:
"""List Chaos Faults for CosmosDB account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either ChaosFaultResource or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ChaosFaultResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ChaosFaultListResponse] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ChaosFaultListResponse", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
def _enable_disable_initial(
self,
resource_group_name: str,
account_name: str,
chaos_fault: str,
chaos_fault_request: Union[_models.ChaosFaultResource, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(chaos_fault_request, (IOBase, bytes)):
_content = chaos_fault_request
else:
_json = self._serialize.body(chaos_fault_request, "ChaosFaultResource")
_request = build_enable_disable_request(
resource_group_name=resource_group_name,
account_name=account_name,
chaos_fault=chaos_fault,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
def begin_enable_disable(
self,
resource_group_name: str,
account_name: str,
chaos_fault: str,
chaos_fault_request: _models.ChaosFaultResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ChaosFaultResource]:
"""Enable, disable Chaos Fault in a CosmosDB account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param chaos_fault: The name of the ChaosFault. Required.
:type chaos_fault: str
:param chaos_fault_request: A request object to enable/disable the chaos fault. Required.
:type chaos_fault_request: ~azure.mgmt.cosmosdb.models.ChaosFaultResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ChaosFaultResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ChaosFaultResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_enable_disable(
self,
resource_group_name: str,
account_name: str,
chaos_fault: str,
chaos_fault_request: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ChaosFaultResource]:
"""Enable, disable Chaos Fault in a CosmosDB account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param chaos_fault: The name of the ChaosFault. Required.
:type chaos_fault: str
:param chaos_fault_request: A request object to enable/disable the chaos fault. Required.
:type chaos_fault_request: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ChaosFaultResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ChaosFaultResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_enable_disable(
self,
resource_group_name: str,
account_name: str,
chaos_fault: str,
chaos_fault_request: Union[_models.ChaosFaultResource, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ChaosFaultResource]:
"""Enable, disable Chaos Fault in a CosmosDB account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param chaos_fault: The name of the ChaosFault. Required.
:type chaos_fault: str
:param chaos_fault_request: A request object to enable/disable the chaos fault. Is either a
ChaosFaultResource type or a IO[bytes] type. Required.
:type chaos_fault_request: ~azure.mgmt.cosmosdb.models.ChaosFaultResource or IO[bytes]
:return: An instance of LROPoller that returns either ChaosFaultResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ChaosFaultResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ChaosFaultResource] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._enable_disable_initial(
resource_group_name=resource_group_name,
account_name=account_name,
chaos_fault=chaos_fault,
chaos_fault_request=chaos_fault_request,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ChaosFaultResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ChaosFaultResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ChaosFaultResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace
def get(
self, resource_group_name: str, account_name: str, chaos_fault: str, **kwargs: Any
) -> _models.ChaosFaultResource:
"""Get Chaos Fault for a CosmosdB account for a particular Chaos Fault.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param chaos_fault: The name of the ChaosFault. Required.
:type chaos_fault: str
:return: ChaosFaultResource or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ChaosFaultResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ChaosFaultResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
chaos_fault=chaos_fault,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ChaosFaultResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
|
class ChaosFaultOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`chaos_fault` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.ChaosFaultResource"]:
'''List Chaos Faults for CosmosDB account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either ChaosFaultResource or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ChaosFaultResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
def _enable_disable_initial(
self,
resource_group_name: str,
account_name: str,
chaos_fault: str,
chaos_fault_request: Union[_models.ChaosFaultResource, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_enable_disable(
self,
resource_group_name: str,
account_name: str,
chaos_fault: str,
chaos_fault_request: _models.ChaosFaultResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ChaosFaultResource]:
'''Enable, disable Chaos Fault in a CosmosDB account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param chaos_fault: The name of the ChaosFault. Required.
:type chaos_fault: str
:param chaos_fault_request: A request object to enable/disable the chaos fault. Required.
:type chaos_fault_request: ~azure.mgmt.cosmosdb.models.ChaosFaultResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ChaosFaultResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ChaosFaultResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_enable_disable(
self,
resource_group_name: str,
account_name: str,
chaos_fault: str,
chaos_fault_request: _models.ChaosFaultResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ChaosFaultResource]:
'''Enable, disable Chaos Fault in a CosmosDB account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param chaos_fault: The name of the ChaosFault. Required.
:type chaos_fault: str
:param chaos_fault_request: A request object to enable/disable the chaos fault. Required.
:type chaos_fault_request: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ChaosFaultResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ChaosFaultResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_enable_disable(
self,
resource_group_name: str,
account_name: str,
chaos_fault: str,
chaos_fault_request: _models.ChaosFaultResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ChaosFaultResource]:
'''Enable, disable Chaos Fault in a CosmosDB account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param chaos_fault: The name of the ChaosFault. Required.
:type chaos_fault: str
:param chaos_fault_request: A request object to enable/disable the chaos fault. Is either a
ChaosFaultResource type or a IO[bytes] type. Required.
:type chaos_fault_request: ~azure.mgmt.cosmosdb.models.ChaosFaultResource or IO[bytes]
:return: An instance of LROPoller that returns either ChaosFaultResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ChaosFaultResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def get_next(next_link=None):
'''Get Chaos Fault for a CosmosdB account for a particular Chaos Fault.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param chaos_fault: The name of the ChaosFault. Required.
:type chaos_fault: str
:return: ChaosFaultResource or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ChaosFaultResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
| 17 | 6 | 37 | 4 | 26 | 8 | 3 | 0.39 | 0 | 8 | 0 | 0 | 7 | 4 | 7 | 7 | 370 | 47 | 241 | 111 | 188 | 94 | 122 | 70 | 110 | 5 | 0 | 2 | 29 |
10,561 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_cassandra_resources_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._cassandra_resources_operations.CassandraResourcesOperations
|
class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`cassandra_resources` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_cassandra_keyspaces(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.CassandraKeyspaceGetResults"]:
"""Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either CassandraKeyspaceGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CassandraKeyspaceListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_cassandra_keyspaces_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("CassandraKeyspaceListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get_cassandra_keyspace(
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> _models.CassandraKeyspaceGetResults:
"""Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the
provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:return: CassandraKeyspaceGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CassandraKeyspaceGetResults] = kwargs.pop("cls", None)
_request = build_get_cassandra_keyspace_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _create_update_cassandra_keyspace_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
create_update_cassandra_keyspace_parameters: Union[_models.CassandraKeyspaceCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(create_update_cassandra_keyspace_parameters, (IOBase, bytes)):
_content = create_update_cassandra_keyspace_parameters
else:
_json = self._serialize.body(
create_update_cassandra_keyspace_parameters, "CassandraKeyspaceCreateUpdateParameters"
)
_request = build_create_update_cassandra_keyspace_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_update_cassandra_keyspace(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
create_update_cassandra_keyspace_parameters: _models.CassandraKeyspaceCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraKeyspaceGetResults]:
"""Create or update an Azure Cosmos DB Cassandra keyspace.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param create_update_cassandra_keyspace_parameters: The parameters to provide for the current
Cassandra keyspace. Required.
:type create_update_cassandra_keyspace_parameters:
~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CassandraKeyspaceGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_update_cassandra_keyspace(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
create_update_cassandra_keyspace_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraKeyspaceGetResults]:
"""Create or update an Azure Cosmos DB Cassandra keyspace.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param create_update_cassandra_keyspace_parameters: The parameters to provide for the current
Cassandra keyspace. Required.
:type create_update_cassandra_keyspace_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CassandraKeyspaceGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_update_cassandra_keyspace(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
create_update_cassandra_keyspace_parameters: Union[_models.CassandraKeyspaceCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.CassandraKeyspaceGetResults]:
"""Create or update an Azure Cosmos DB Cassandra keyspace.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param create_update_cassandra_keyspace_parameters: The parameters to provide for the current
Cassandra keyspace. Is either a CassandraKeyspaceCreateUpdateParameters type or a IO[bytes]
type. Required.
:type create_update_cassandra_keyspace_parameters:
~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either CassandraKeyspaceGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CassandraKeyspaceGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_update_cassandra_keyspace_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
create_update_cassandra_keyspace_parameters=create_update_cassandra_keyspace_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.CassandraKeyspaceGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.CassandraKeyspaceGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_cassandra_keyspace_initial(
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_cassandra_keyspace_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete_cassandra_keyspace(
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Deletes an existing Azure Cosmos DB Cassandra keyspace.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_cassandra_keyspace_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def get_cassandra_keyspace_throughput(
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> _models.ThroughputSettingsGetResults:
"""Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database
account with the provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:return: ThroughputSettingsGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
_request = build_get_cassandra_keyspace_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _update_cassandra_keyspace_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(update_throughput_parameters, (IOBase, bytes)):
_content = update_throughput_parameters
else:
_json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters")
_request = build_update_cassandra_keyspace_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Cassandra Keyspace.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra Keyspace. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
update_throughput_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Cassandra Keyspace.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra Keyspace. Required.
:type update_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Cassandra Keyspace.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra Keyspace. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes]
type. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_cassandra_keyspace_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
update_throughput_parameters=update_throughput_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _migrate_cassandra_keyspace_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_cassandra_keyspace_to_autoscale_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_migrate_cassandra_keyspace_to_autoscale( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._migrate_cassandra_keyspace_to_autoscale_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _migrate_cassandra_keyspace_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_cassandra_keyspace_to_manual_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_migrate_cassandra_keyspace_to_manual_throughput( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._migrate_cassandra_keyspace_to_manual_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace
def list_cassandra_tables(
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> Iterable["_models.CassandraTableGetResults"]:
"""Lists the Cassandra table under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:return: An iterator like instance of either CassandraTableGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraTableGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CassandraTableListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_cassandra_tables_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("CassandraTableListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get_cassandra_table(
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> _models.CassandraTableGetResults:
"""Gets the Cassandra table under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:return: CassandraTableGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.CassandraTableGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CassandraTableGetResults] = kwargs.pop("cls", None)
_request = build_get_cassandra_table_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
table_name=table_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CassandraTableGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _create_update_cassandra_table_initial(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
create_update_cassandra_table_parameters: Union[_models.CassandraTableCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(create_update_cassandra_table_parameters, (IOBase, bytes)):
_content = create_update_cassandra_table_parameters
else:
_json = self._serialize.body(
create_update_cassandra_table_parameters, "CassandraTableCreateUpdateParameters"
)
_request = build_create_update_cassandra_table_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
table_name=table_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_update_cassandra_table(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
create_update_cassandra_table_parameters: _models.CassandraTableCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraTableGetResults]:
"""Create or update an Azure Cosmos DB Cassandra Table.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:param create_update_cassandra_table_parameters: The parameters to provide for the current
Cassandra Table. Required.
:type create_update_cassandra_table_parameters:
~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CassandraTableGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_update_cassandra_table(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
create_update_cassandra_table_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraTableGetResults]:
"""Create or update an Azure Cosmos DB Cassandra Table.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:param create_update_cassandra_table_parameters: The parameters to provide for the current
Cassandra Table. Required.
:type create_update_cassandra_table_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CassandraTableGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_update_cassandra_table(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
create_update_cassandra_table_parameters: Union[_models.CassandraTableCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.CassandraTableGetResults]:
"""Create or update an Azure Cosmos DB Cassandra Table.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:param create_update_cassandra_table_parameters: The parameters to provide for the current
Cassandra Table. Is either a CassandraTableCreateUpdateParameters type or a IO[bytes] type.
Required.
:type create_update_cassandra_table_parameters:
~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either CassandraTableGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CassandraTableGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_update_cassandra_table_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
table_name=table_name,
create_update_cassandra_table_parameters=create_update_cassandra_table_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CassandraTableGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.CassandraTableGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.CassandraTableGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_cassandra_table_initial(
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_cassandra_table_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
table_name=table_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete_cassandra_table(
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Deletes an existing Azure Cosmos DB Cassandra table.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_cassandra_table_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
table_name=table_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def get_cassandra_table_throughput(
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> _models.ThroughputSettingsGetResults:
"""Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database
account with the provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:return: ThroughputSettingsGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
_request = build_get_cassandra_table_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
table_name=table_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _update_cassandra_table_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(update_throughput_parameters, (IOBase, bytes)):
_content = update_throughput_parameters
else:
_json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters")
_request = build_update_cassandra_table_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
table_name=table_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_update_cassandra_table_throughput(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Cassandra table.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra table. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_cassandra_table_throughput(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
update_throughput_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Cassandra table.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra table. Required.
:type update_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_cassandra_table_throughput(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Cassandra table.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra table. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes]
type. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_cassandra_table_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
table_name=table_name,
update_throughput_parameters=update_throughput_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _migrate_cassandra_table_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_cassandra_table_to_autoscale_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
table_name=table_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_migrate_cassandra_table_to_autoscale( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._migrate_cassandra_table_to_autoscale_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
table_name=table_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _migrate_cassandra_table_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_cassandra_table_to_manual_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
table_name=table_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_migrate_cassandra_table_to_manual_throughput( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._migrate_cassandra_table_to_manual_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
table_name=table_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace
def list_cassandra_views(
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> Iterable["_models.CassandraViewGetResults"]:
"""Lists the Cassandra materialized views under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:return: An iterator like instance of either CassandraViewGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraViewGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CassandraViewListResult] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_cassandra_views_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("CassandraViewListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get_cassandra_view(
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> _models.CassandraViewGetResults:
"""Gets the Cassandra view under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:return: CassandraViewGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.CassandraViewGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CassandraViewGetResults] = kwargs.pop("cls", None)
_request = build_get_cassandra_view_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
view_name=view_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CassandraViewGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _create_update_cassandra_view_initial(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
create_update_cassandra_view_parameters: Union[_models.CassandraViewCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(create_update_cassandra_view_parameters, (IOBase, bytes)):
_content = create_update_cassandra_view_parameters
else:
_json = self._serialize.body(create_update_cassandra_view_parameters, "CassandraViewCreateUpdateParameters")
_request = build_create_update_cassandra_view_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
view_name=view_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_update_cassandra_view(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
create_update_cassandra_view_parameters: _models.CassandraViewCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraViewGetResults]:
"""Create or update an Azure Cosmos DB Cassandra View.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:param create_update_cassandra_view_parameters: The parameters to provide for the current
Cassandra View. Required.
:type create_update_cassandra_view_parameters:
~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CassandraViewGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_update_cassandra_view(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
create_update_cassandra_view_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraViewGetResults]:
"""Create or update an Azure Cosmos DB Cassandra View.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:param create_update_cassandra_view_parameters: The parameters to provide for the current
Cassandra View. Required.
:type create_update_cassandra_view_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CassandraViewGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_update_cassandra_view(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
create_update_cassandra_view_parameters: Union[_models.CassandraViewCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.CassandraViewGetResults]:
"""Create or update an Azure Cosmos DB Cassandra View.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:param create_update_cassandra_view_parameters: The parameters to provide for the current
Cassandra View. Is either a CassandraViewCreateUpdateParameters type or a IO[bytes] type.
Required.
:type create_update_cassandra_view_parameters:
~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either CassandraViewGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CassandraViewGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_update_cassandra_view_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
view_name=view_name,
create_update_cassandra_view_parameters=create_update_cassandra_view_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CassandraViewGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.CassandraViewGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.CassandraViewGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_cassandra_view_initial(
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_cassandra_view_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
view_name=view_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete_cassandra_view(
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Deletes an existing Azure Cosmos DB Cassandra view.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_cassandra_view_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
view_name=view_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def get_cassandra_view_throughput(
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> _models.ThroughputSettingsGetResults:
"""Gets the RUs per second of the Cassandra view under an existing Azure Cosmos DB database
account with the provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:return: ThroughputSettingsGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
_request = build_get_cassandra_view_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
view_name=view_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _update_cassandra_view_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(update_throughput_parameters, (IOBase, bytes)):
_content = update_throughput_parameters
else:
_json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters")
_request = build_update_cassandra_view_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
view_name=view_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_update_cassandra_view_throughput(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Cassandra view.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra view. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_cassandra_view_throughput(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
update_throughput_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Cassandra view.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra view. Required.
:type update_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_cassandra_view_throughput(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Update RUs per second of an Azure Cosmos DB Cassandra view.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra view. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes]
type. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_cassandra_view_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
view_name=view_name,
update_throughput_parameters=update_throughput_parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _migrate_cassandra_view_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_cassandra_view_to_autoscale_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
view_name=view_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_migrate_cassandra_view_to_autoscale( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._migrate_cassandra_view_to_autoscale_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
view_name=view_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _migrate_cassandra_view_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_cassandra_view_to_manual_throughput_request(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
view_name=view_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_migrate_cassandra_view_to_manual_throughput( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
"""Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._migrate_cassandra_view_to_manual_throughput_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
view_name=view_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ThroughputSettingsGetResults](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
|
class CassandraResourcesOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`cassandra_resources` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list_cassandra_keyspaces(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.CassandraKeyspaceGetResults"]:
'''Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:return: An iterator like instance of either CassandraKeyspaceGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_cassandra_keyspace(
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> _models.CassandraKeyspaceGetResults:
'''Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the
provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:return: CassandraKeyspaceGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _create_update_cassandra_keyspace_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
create_update_cassandra_keyspace_parameters: Union[_models.CassandraKeyspaceCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_create_update_cassandra_keyspace(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
create_update_cassandra_keyspace_parameters: _models.CassandraKeyspaceCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraKeyspaceGetResults]:
'''Create or update an Azure Cosmos DB Cassandra keyspace.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param create_update_cassandra_keyspace_parameters: The parameters to provide for the current
Cassandra keyspace. Required.
:type create_update_cassandra_keyspace_parameters:
~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CassandraKeyspaceGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_create_update_cassandra_keyspace(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
create_update_cassandra_keyspace_parameters: _models.CassandraKeyspaceCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraKeyspaceGetResults]:
'''Create or update an Azure Cosmos DB Cassandra keyspace.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param create_update_cassandra_keyspace_parameters: The parameters to provide for the current
Cassandra keyspace. Required.
:type create_update_cassandra_keyspace_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CassandraKeyspaceGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_create_update_cassandra_keyspace(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
create_update_cassandra_keyspace_parameters: _models.CassandraKeyspaceCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraKeyspaceGetResults]:
'''Create or update an Azure Cosmos DB Cassandra keyspace.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param create_update_cassandra_keyspace_parameters: The parameters to provide for the current
Cassandra keyspace. Is either a CassandraKeyspaceCreateUpdateParameters type or a IO[bytes]
type. Required.
:type create_update_cassandra_keyspace_parameters:
~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either CassandraKeyspaceGetResults or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _delete_cassandra_keyspace_initial(
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_delete_cassandra_keyspace(
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> LROPoller[None]:
'''Deletes an existing Azure Cosmos DB Cassandra keyspace.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def get_cassandra_keyspace_throughput(
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> _models.ThroughputSettingsGetResults:
'''Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database
account with the provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:return: ThroughputSettingsGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _update_cassandra_keyspace_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Cassandra Keyspace.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra Keyspace. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Cassandra Keyspace.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra Keyspace. Required.
:type update_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Cassandra Keyspace.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra Keyspace. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes]
type. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _migrate_cassandra_keyspace_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_migrate_cassandra_keyspace_to_autoscale( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _migrate_cassandra_keyspace_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_migrate_cassandra_keyspace_to_manual_throughput( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list_cassandra_tables(
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> Iterable["_models.CassandraTableGetResults"]:
'''Lists the Cassandra table under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:return: An iterator like instance of either CassandraTableGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraTableGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_cassandra_table(
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> _models.CassandraTableGetResults:
'''Gets the Cassandra table under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:return: CassandraTableGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.CassandraTableGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _create_update_cassandra_table_initial(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
create_update_cassandra_table_parameters: Union[_models.CassandraTableCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_create_update_cassandra_table(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
create_update_cassandra_table_parameters: _models.CassandraTableCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraTableGetResults]:
'''Create or update an Azure Cosmos DB Cassandra Table.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:param create_update_cassandra_table_parameters: The parameters to provide for the current
Cassandra Table. Required.
:type create_update_cassandra_table_parameters:
~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CassandraTableGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_create_update_cassandra_table(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
create_update_cassandra_table_parameters: _models.CassandraTableCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraTableGetResults]:
'''Create or update an Azure Cosmos DB Cassandra Table.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:param create_update_cassandra_table_parameters: The parameters to provide for the current
Cassandra Table. Required.
:type create_update_cassandra_table_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CassandraTableGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_create_update_cassandra_table(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
create_update_cassandra_table_parameters: _models.CassandraTableCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraTableGetResults]:
'''Create or update an Azure Cosmos DB Cassandra Table.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:param create_update_cassandra_table_parameters: The parameters to provide for the current
Cassandra Table. Is either a CassandraTableCreateUpdateParameters type or a IO[bytes] type.
Required.
:type create_update_cassandra_table_parameters:
~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either CassandraTableGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _delete_cassandra_table_initial(
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_delete_cassandra_table(
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> LROPoller[None]:
'''Deletes an existing Azure Cosmos DB Cassandra table.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def get_cassandra_table_throughput(
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> _models.ThroughputSettingsGetResults:
'''Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database
account with the provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:return: ThroughputSettingsGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _update_cassandra_table_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_update_cassandra_table_throughput(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Cassandra table.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra table. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_update_cassandra_table_throughput(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Cassandra table.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra table. Required.
:type update_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_update_cassandra_table_throughput(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
table_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Cassandra table.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra table. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes]
type. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _migrate_cassandra_table_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_migrate_cassandra_table_to_autoscale( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _migrate_cassandra_table_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_migrate_cassandra_table_to_manual_throughput( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param table_name: Cosmos DB table name. Required.
:type table_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list_cassandra_views(
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> Iterable["_models.CassandraViewGetResults"]:
'''Lists the Cassandra materialized views under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:return: An iterator like instance of either CassandraViewGetResults or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraViewGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_cassandra_view(
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> _models.CassandraViewGetResults:
'''Gets the Cassandra view under an existing Azure Cosmos DB database account.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:return: CassandraViewGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.CassandraViewGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _create_update_cassandra_view_initial(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
create_update_cassandra_view_parameters: Union[_models.CassandraViewCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_create_update_cassandra_view(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
create_update_cassandra_view_parameters: _models.CassandraViewCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraViewGetResults]:
'''Create or update an Azure Cosmos DB Cassandra View.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:param create_update_cassandra_view_parameters: The parameters to provide for the current
Cassandra View. Required.
:type create_update_cassandra_view_parameters:
~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CassandraViewGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_create_update_cassandra_view(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
create_update_cassandra_view_parameters: _models.CassandraViewCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraViewGetResults]:
'''Create or update an Azure Cosmos DB Cassandra View.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:param create_update_cassandra_view_parameters: The parameters to provide for the current
Cassandra View. Required.
:type create_update_cassandra_view_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CassandraViewGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_create_update_cassandra_view(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
create_update_cassandra_view_parameters: _models.CassandraViewCreateUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CassandraViewGetResults]:
'''Create or update an Azure Cosmos DB Cassandra View.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:param create_update_cassandra_view_parameters: The parameters to provide for the current
Cassandra View. Is either a CassandraViewCreateUpdateParameters type or a IO[bytes] type.
Required.
:type create_update_cassandra_view_parameters:
~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either CassandraViewGetResults or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _delete_cassandra_view_initial(
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_delete_cassandra_view(
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> LROPoller[None]:
'''Deletes an existing Azure Cosmos DB Cassandra view.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def get_cassandra_view_throughput(
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> _models.ThroughputSettingsGetResults:
'''Gets the RUs per second of the Cassandra view under an existing Azure Cosmos DB database
account with the provided name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:return: ThroughputSettingsGetResults or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _update_cassandra_view_throughput_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_update_cassandra_view_throughput(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Cassandra view.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra view. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_update_cassandra_view_throughput(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Cassandra view.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra view. Required.
:type update_throughput_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_update_cassandra_view_throughput(
self,
resource_group_name: str,
account_name: str,
keyspace_name: str,
view_name: str,
update_throughput_parameters: _models.ThroughputSettingsUpdateParameters,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Update RUs per second of an Azure Cosmos DB Cassandra view.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:param update_throughput_parameters: The RUs per second of the parameters to provide for the
current Cassandra view. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes]
type. Required.
:type update_throughput_parameters:
~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _migrate_cassandra_view_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_migrate_cassandra_view_to_autoscale( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _migrate_cassandra_view_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_migrate_cassandra_view_to_manual_throughput( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any
) -> LROPoller[_models.ThroughputSettingsGetResults]:
'''Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Cosmos DB database account name. Required.
:type account_name: str
:param keyspace_name: Cosmos DB keyspace name. Required.
:type keyspace_name: str
:param view_name: Cosmos DB view name. Required.
:type view_name: str
:return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
| 113 | 37 | 42 | 4 | 30 | 10 | 3 | 0.37 | 0 | 8 | 0 | 0 | 52 | 4 | 52 | 52 | 3,098 | 378 | 2,097 | 834 | 1,722 | 775 | 1,058 | 536 | 981 | 6 | 0 | 2 | 242 |
10,562 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.ThroughputPoolsListResult
|
class ThroughputPoolsListResult(_serialization.Model):
"""The List operation response, that contains the throughput pools and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of throughput pools and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.ThroughputPoolResource]
:ivar next_link: The link used to get the next page of results.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[ThroughputPoolResource]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
|
class ThroughputPoolsListResult(_serialization.Model):
'''The List operation response, that contains the throughput pools and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of throughput pools and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.ThroughputPoolResource]
:ivar next_link: The link used to get the next page of results.
:vartype next_link: str
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 5 | 0 | 4 | 1 | 1 | 0.62 | 1 | 2 | 0 | 0 | 1 | 2 | 1 | 16 | 26 | 5 | 13 | 6 | 11 | 8 | 7 | 6 | 5 | 1 | 2 | 0 | 1 |
10,563 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.ThroughputSettingsGetPropertiesResource
|
class ThroughputSettingsGetPropertiesResource(ThroughputSettingsResource, ExtendedResourceProperties):
"""ThroughputSettingsGetPropertiesResource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar rid: A system generated property. A unique identifier.
:vartype rid: str
:ivar ts: A system generated property that denotes the last updated timestamp of the resource.
:vartype ts: float
:ivar etag: A system generated property representing the resource etag required for optimistic
concurrency control.
:vartype etag: str
:ivar throughput: Value of the Cosmos DB resource throughput. Either throughput is required or
autoscaleSettings is required, but not both.
:vartype throughput: int
:ivar autoscale_settings: Cosmos DB resource for autoscale settings. Either throughput is
required or autoscaleSettings is required, but not both.
:vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettingsResource
:ivar minimum_throughput: The minimum throughput of the resource.
:vartype minimum_throughput: str
:ivar offer_replace_pending: The throughput replace is pending.
:vartype offer_replace_pending: str
:ivar instant_maximum_throughput: The offer throughput value to instantly scale up without
triggering splits.
:vartype instant_maximum_throughput: str
:ivar soft_allowed_maximum_throughput: The maximum throughput value or the maximum
maxThroughput value (for autoscale) that can be specified.
:vartype soft_allowed_maximum_throughput: str
:ivar throughput_buckets: Array of Throughput Bucket limits to be applied to the Cosmos DB
container.
:vartype throughput_buckets: list[~azure.mgmt.cosmosdb.models.ThroughputBucketResource]
"""
_validation = {
"rid": {"readonly": True},
"ts": {"readonly": True},
"etag": {"readonly": True},
"minimum_throughput": {"readonly": True},
"offer_replace_pending": {"readonly": True},
"instant_maximum_throughput": {"readonly": True},
"soft_allowed_maximum_throughput": {"readonly": True},
}
_attribute_map = {
"rid": {"key": "_rid", "type": "str"},
"ts": {"key": "_ts", "type": "float"},
"etag": {"key": "_etag", "type": "str"},
"throughput": {"key": "throughput", "type": "int"},
"autoscale_settings": {"key": "autoscaleSettings", "type": "AutoscaleSettingsResource"},
"minimum_throughput": {"key": "minimumThroughput", "type": "str"},
"offer_replace_pending": {"key": "offerReplacePending", "type": "str"},
"instant_maximum_throughput": {"key": "instantMaximumThroughput", "type": "str"},
"soft_allowed_maximum_throughput": {"key": "softAllowedMaximumThroughput", "type": "str"},
"throughput_buckets": {"key": "throughputBuckets", "type": "[ThroughputBucketResource]"},
}
def __init__(
self,
*,
throughput: Optional[int] = None,
autoscale_settings: Optional["_models.AutoscaleSettingsResource"] = None,
throughput_buckets: Optional[List["_models.ThroughputBucketResource"]] = None,
**kwargs: Any
) -> None:
"""
:keyword throughput: Value of the Cosmos DB resource throughput. Either throughput is required
or autoscaleSettings is required, but not both.
:paramtype throughput: int
:keyword autoscale_settings: Cosmos DB resource for autoscale settings. Either throughput is
required or autoscaleSettings is required, but not both.
:paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettingsResource
:keyword throughput_buckets: Array of Throughput Bucket limits to be applied to the Cosmos DB
container.
:paramtype throughput_buckets: list[~azure.mgmt.cosmosdb.models.ThroughputBucketResource]
"""
super().__init__(
throughput=throughput,
autoscale_settings=autoscale_settings,
throughput_buckets=throughput_buckets,
**kwargs
)
self.rid = None
self.ts = None
self.etag = None
self.throughput = throughput
self.autoscale_settings = autoscale_settings
self.minimum_throughput = None
self.offer_replace_pending = None
self.instant_maximum_throughput = None
self.soft_allowed_maximum_throughput = None
self.throughput_buckets = throughput_buckets
|
class ThroughputSettingsGetPropertiesResource(ThroughputSettingsResource, ExtendedResourceProperties):
'''ThroughputSettingsGetPropertiesResource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar rid: A system generated property. A unique identifier.
:vartype rid: str
:ivar ts: A system generated property that denotes the last updated timestamp of the resource.
:vartype ts: float
:ivar etag: A system generated property representing the resource etag required for optimistic
concurrency control.
:vartype etag: str
:ivar throughput: Value of the Cosmos DB resource throughput. Either throughput is required or
autoscaleSettings is required, but not both.
:vartype throughput: int
:ivar autoscale_settings: Cosmos DB resource for autoscale settings. Either throughput is
required or autoscaleSettings is required, but not both.
:vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettingsResource
:ivar minimum_throughput: The minimum throughput of the resource.
:vartype minimum_throughput: str
:ivar offer_replace_pending: The throughput replace is pending.
:vartype offer_replace_pending: str
:ivar instant_maximum_throughput: The offer throughput value to instantly scale up without
triggering splits.
:vartype instant_maximum_throughput: str
:ivar soft_allowed_maximum_throughput: The maximum throughput value or the maximum
maxThroughput value (for autoscale) that can be specified.
:vartype soft_allowed_maximum_throughput: str
:ivar throughput_buckets: Array of Throughput Bucket limits to be applied to the Cosmos DB
container.
:vartype throughput_buckets: list[~azure.mgmt.cosmosdb.models.ThroughputBucketResource]
'''
def __init__(
self,
*,
throughput: Optional[int] = None,
autoscale_settings: Optional["_models.AutoscaleSettingsResource"] = None,
throughput_buckets: Optional[List["_models.ThroughputBucketResource"]] = None,
**kwargs: Any
) -> None:
'''
:keyword throughput: Value of the Cosmos DB resource throughput. Either throughput is required
or autoscaleSettings is required, but not both.
:paramtype throughput: int
:keyword autoscale_settings: Cosmos DB resource for autoscale settings. Either throughput is
required or autoscaleSettings is required, but not both.
:paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettingsResource
:keyword throughput_buckets: Array of Throughput Bucket limits to be applied to the Cosmos DB
container.
:paramtype throughput_buckets: list[~azure.mgmt.cosmosdb.models.ThroughputBucketResource]
'''
pass
| 2 | 2 | 35 | 0 | 24 | 11 | 1 | 0.87 | 2 | 3 | 0 | 0 | 1 | 10 | 1 | 18 | 91 | 5 | 46 | 21 | 37 | 40 | 15 | 14 | 13 | 1 | 3 | 0 | 1 |
10,564 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.ThroughputSettingsGetResults
|
class ThroughputSettingsGetResults(ARMResourceProperties):
"""An Azure Cosmos DB resource throughput.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource:
:vartype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetPropertiesResource
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"location": {"key": "location", "type": "str"},
"tags": {"key": "tags", "type": "{str}"},
"identity": {"key": "identity", "type": "ManagedServiceIdentity"},
"resource": {"key": "properties.resource", "type": "ThroughputSettingsGetPropertiesResource"},
}
def __init__(
self,
*,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
resource: Optional["_models.ThroughputSettingsGetPropertiesResource"] = None,
**kwargs: Any
) -> None:
"""
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource:
:paramtype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetPropertiesResource
"""
super().__init__(location=location, tags=tags, identity=identity, **kwargs)
self.resource = resource
|
class ThroughputSettingsGetResults(ARMResourceProperties):
'''An Azure Cosmos DB resource throughput.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource:
:vartype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetPropertiesResource
'''
def __init__(
self,
*,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
resource: Optional["_models.ThroughputSettingsGetPropertiesResource"] = None,
**kwargs: Any
) -> None:
'''
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource:
:paramtype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetPropertiesResource
'''
pass
| 2 | 2 | 26 | 0 | 11 | 15 | 1 | 1.42 | 1 | 3 | 0 | 0 | 1 | 1 | 1 | 17 | 68 | 5 | 26 | 13 | 16 | 37 | 6 | 5 | 4 | 1 | 3 | 0 | 1 |
10,565 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.ThroughputSettingsResource
|
class ThroughputSettingsResource(_serialization.Model):
"""Cosmos DB resource throughput object. Either throughput is required or autoscaleSettings is
required, but not both.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar throughput: Value of the Cosmos DB resource throughput. Either throughput is required or
autoscaleSettings is required, but not both.
:vartype throughput: int
:ivar autoscale_settings: Cosmos DB resource for autoscale settings. Either throughput is
required or autoscaleSettings is required, but not both.
:vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettingsResource
:ivar minimum_throughput: The minimum throughput of the resource.
:vartype minimum_throughput: str
:ivar offer_replace_pending: The throughput replace is pending.
:vartype offer_replace_pending: str
:ivar instant_maximum_throughput: The offer throughput value to instantly scale up without
triggering splits.
:vartype instant_maximum_throughput: str
:ivar soft_allowed_maximum_throughput: The maximum throughput value or the maximum
maxThroughput value (for autoscale) that can be specified.
:vartype soft_allowed_maximum_throughput: str
:ivar throughput_buckets: Array of Throughput Bucket limits to be applied to the Cosmos DB
container.
:vartype throughput_buckets: list[~azure.mgmt.cosmosdb.models.ThroughputBucketResource]
"""
_validation = {
"minimum_throughput": {"readonly": True},
"offer_replace_pending": {"readonly": True},
"instant_maximum_throughput": {"readonly": True},
"soft_allowed_maximum_throughput": {"readonly": True},
}
_attribute_map = {
"throughput": {"key": "throughput", "type": "int"},
"autoscale_settings": {"key": "autoscaleSettings", "type": "AutoscaleSettingsResource"},
"minimum_throughput": {"key": "minimumThroughput", "type": "str"},
"offer_replace_pending": {"key": "offerReplacePending", "type": "str"},
"instant_maximum_throughput": {"key": "instantMaximumThroughput", "type": "str"},
"soft_allowed_maximum_throughput": {"key": "softAllowedMaximumThroughput", "type": "str"},
"throughput_buckets": {"key": "throughputBuckets", "type": "[ThroughputBucketResource]"},
}
def __init__(
self,
*,
throughput: Optional[int] = None,
autoscale_settings: Optional["_models.AutoscaleSettingsResource"] = None,
throughput_buckets: Optional[List["_models.ThroughputBucketResource"]] = None,
**kwargs: Any
) -> None:
"""
:keyword throughput: Value of the Cosmos DB resource throughput. Either throughput is required
or autoscaleSettings is required, but not both.
:paramtype throughput: int
:keyword autoscale_settings: Cosmos DB resource for autoscale settings. Either throughput is
required or autoscaleSettings is required, but not both.
:paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettingsResource
:keyword throughput_buckets: Array of Throughput Bucket limits to be applied to the Cosmos DB
container.
:paramtype throughput_buckets: list[~azure.mgmt.cosmosdb.models.ThroughputBucketResource]
"""
super().__init__(**kwargs)
self.throughput = throughput
self.autoscale_settings = autoscale_settings
self.minimum_throughput = None
self.offer_replace_pending = None
self.instant_maximum_throughput = None
self.soft_allowed_maximum_throughput = None
self.throughput_buckets = throughput_buckets
|
class ThroughputSettingsResource(_serialization.Model):
'''Cosmos DB resource throughput object. Either throughput is required or autoscaleSettings is
required, but not both.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar throughput: Value of the Cosmos DB resource throughput. Either throughput is required or
autoscaleSettings is required, but not both.
:vartype throughput: int
:ivar autoscale_settings: Cosmos DB resource for autoscale settings. Either throughput is
required or autoscaleSettings is required, but not both.
:vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettingsResource
:ivar minimum_throughput: The minimum throughput of the resource.
:vartype minimum_throughput: str
:ivar offer_replace_pending: The throughput replace is pending.
:vartype offer_replace_pending: str
:ivar instant_maximum_throughput: The offer throughput value to instantly scale up without
triggering splits.
:vartype instant_maximum_throughput: str
:ivar soft_allowed_maximum_throughput: The maximum throughput value or the maximum
maxThroughput value (for autoscale) that can be specified.
:vartype soft_allowed_maximum_throughput: str
:ivar throughput_buckets: Array of Throughput Bucket limits to be applied to the Cosmos DB
container.
:vartype throughput_buckets: list[~azure.mgmt.cosmosdb.models.ThroughputBucketResource]
'''
def __init__(
self,
*,
throughput: Optional[int] = None,
autoscale_settings: Optional["_models.AutoscaleSettingsResource"] = None,
throughput_buckets: Optional[List["_models.ThroughputBucketResource"]] = None,
**kwargs: Any
) -> None:
'''
:keyword throughput: Value of the Cosmos DB resource throughput. Either throughput is required
or autoscaleSettings is required, but not both.
:paramtype throughput: int
:keyword autoscale_settings: Cosmos DB resource for autoscale settings. Either throughput is
required or autoscaleSettings is required, but not both.
:paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettingsResource
:keyword throughput_buckets: Array of Throughput Bucket limits to be applied to the Cosmos DB
container.
:paramtype throughput_buckets: list[~azure.mgmt.cosmosdb.models.ThroughputBucketResource]
'''
pass
| 2 | 2 | 27 | 0 | 16 | 11 | 1 | 1.06 | 1 | 3 | 0 | 1 | 1 | 7 | 1 | 16 | 71 | 5 | 32 | 18 | 23 | 34 | 12 | 11 | 10 | 1 | 2 | 0 | 1 |
10,566 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.ThroughputSettingsUpdateParameters
|
class ThroughputSettingsUpdateParameters(ARMResourceProperties):
"""Parameters to update Cosmos DB resource throughput.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource: The standard JSON format of a resource throughput. Required.
:vartype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsResource
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"resource": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"location": {"key": "location", "type": "str"},
"tags": {"key": "tags", "type": "{str}"},
"identity": {"key": "identity", "type": "ManagedServiceIdentity"},
"resource": {"key": "properties.resource", "type": "ThroughputSettingsResource"},
}
def __init__(
self,
*,
resource: "_models.ThroughputSettingsResource",
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
**kwargs: Any
) -> None:
"""
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource: The standard JSON format of a resource throughput. Required.
:paramtype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsResource
"""
super().__init__(location=location, tags=tags, identity=identity, **kwargs)
self.resource = resource
|
class ThroughputSettingsUpdateParameters(ARMResourceProperties):
'''Parameters to update Cosmos DB resource throughput.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource: The standard JSON format of a resource throughput. Required.
:vartype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsResource
'''
def __init__(
self,
*,
resource: "_models.ThroughputSettingsResource",
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
**kwargs: Any
) -> None:
'''
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource: The standard JSON format of a resource throughput. Required.
:paramtype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsResource
'''
pass
| 2 | 2 | 26 | 0 | 11 | 15 | 1 | 1.41 | 1 | 3 | 0 | 0 | 1 | 1 | 1 | 17 | 71 | 6 | 27 | 13 | 17 | 38 | 6 | 5 | 4 | 1 | 3 | 0 | 1 |
10,567 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.TrackedResource
|
class TrackedResource(Resource):
"""The resource model definition for an Azure Resource Manager tracked top level resource which
has 'tags' and a 'location'.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. E.g.
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData
:ivar tags: Resource tags.
:vartype tags: dict[str, str]
:ivar location: The geo-location where the resource lives. Required.
:vartype location: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"system_data": {"readonly": True},
"location": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"system_data": {"key": "systemData", "type": "SystemData"},
"tags": {"key": "tags", "type": "{str}"},
"location": {"key": "location", "type": "str"},
}
def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None:
"""
:keyword tags: Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The geo-location where the resource lives. Required.
:paramtype location: str
"""
super().__init__(**kwargs)
self.tags = tags
self.location = location
|
class TrackedResource(Resource):
'''The resource model definition for an Azure Resource Manager tracked top level resource which
has 'tags' and a 'location'.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. E.g.
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData
:ivar tags: Resource tags.
:vartype tags: dict[str, str]
:ivar location: The geo-location where the resource lives. Required.
:vartype location: str
'''
def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None:
'''
:keyword tags: Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The geo-location where the resource lives. Required.
:paramtype location: str
'''
pass
| 2 | 2 | 10 | 0 | 4 | 6 | 1 | 1.3 | 1 | 3 | 0 | 1 | 1 | 2 | 1 | 17 | 52 | 6 | 20 | 6 | 18 | 26 | 7 | 6 | 5 | 1 | 3 | 0 | 1 |
10,568 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.UniqueKey
|
class UniqueKey(_serialization.Model):
"""The unique key on that enforces uniqueness constraint on documents in the collection in the
Azure Cosmos DB service.
:ivar paths: List of paths must be unique for each document in the Azure Cosmos DB service.
:vartype paths: list[str]
"""
_attribute_map = {
"paths": {"key": "paths", "type": "[str]"},
}
def __init__(self, *, paths: Optional[List[str]] = None, **kwargs: Any) -> None:
"""
:keyword paths: List of paths must be unique for each document in the Azure Cosmos DB service.
:paramtype paths: list[str]
"""
super().__init__(**kwargs)
self.paths = paths
|
class UniqueKey(_serialization.Model):
'''The unique key on that enforces uniqueness constraint on documents in the collection in the
Azure Cosmos DB service.
:ivar paths: List of paths must be unique for each document in the Azure Cosmos DB service.
:vartype paths: list[str]
'''
def __init__(self, *, paths: Optional[List[str]] = None, **kwargs: Any) -> None:
'''
:keyword paths: List of paths must be unique for each document in the Azure Cosmos DB service.
:paramtype paths: list[str]
'''
pass
| 2 | 2 | 7 | 0 | 3 | 4 | 1 | 1.29 | 1 | 3 | 0 | 0 | 1 | 1 | 1 | 16 | 19 | 3 | 7 | 4 | 5 | 9 | 5 | 4 | 3 | 1 | 2 | 0 | 1 |
10,569 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.UniqueKeyPolicy
|
class UniqueKeyPolicy(_serialization.Model):
"""The unique key policy configuration for specifying uniqueness constraints on documents in the
collection in the Azure Cosmos DB service.
:ivar unique_keys: List of unique keys on that enforces uniqueness constraint on documents in
the collection in the Azure Cosmos DB service.
:vartype unique_keys: list[~azure.mgmt.cosmosdb.models.UniqueKey]
"""
_attribute_map = {
"unique_keys": {"key": "uniqueKeys", "type": "[UniqueKey]"},
}
def __init__(self, *, unique_keys: Optional[List["_models.UniqueKey"]] = None, **kwargs: Any) -> None:
"""
:keyword unique_keys: List of unique keys on that enforces uniqueness constraint on documents
in the collection in the Azure Cosmos DB service.
:paramtype unique_keys: list[~azure.mgmt.cosmosdb.models.UniqueKey]
"""
super().__init__(**kwargs)
self.unique_keys = unique_keys
|
class UniqueKeyPolicy(_serialization.Model):
'''The unique key policy configuration for specifying uniqueness constraints on documents in the
collection in the Azure Cosmos DB service.
:ivar unique_keys: List of unique keys on that enforces uniqueness constraint on documents in
the collection in the Azure Cosmos DB service.
:vartype unique_keys: list[~azure.mgmt.cosmosdb.models.UniqueKey]
'''
def __init__(self, *, unique_keys: Optional[List["_models.UniqueKey"]] = None, **kwargs: Any) -> None:
'''
:keyword unique_keys: List of unique keys on that enforces uniqueness constraint on documents
in the collection in the Azure Cosmos DB service.
:paramtype unique_keys: list[~azure.mgmt.cosmosdb.models.UniqueKey]
'''
pass
| 2 | 2 | 8 | 0 | 3 | 5 | 1 | 1.57 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 16 | 21 | 3 | 7 | 4 | 5 | 11 | 5 | 4 | 3 | 1 | 2 | 0 | 1 |
10,570 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlDedicatedGatewayRegionalServiceResource
|
class SqlDedicatedGatewayRegionalServiceResource(RegionalServiceResource): # pylint: disable=name-too-long
"""Resource for a regional service location.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: The regional service name.
:vartype name: str
:ivar location: The location name.
:vartype location: str
:ivar status: Describes the status of a service. Known values are: "Creating", "Running",
"Updating", "Deleting", "Error", and "Stopped".
:vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus
:ivar sql_dedicated_gateway_endpoint: The regional endpoint for SqlDedicatedGateway.
:vartype sql_dedicated_gateway_endpoint: str
"""
_validation = {
"name": {"readonly": True},
"location": {"readonly": True},
"status": {"readonly": True},
"sql_dedicated_gateway_endpoint": {"readonly": True},
}
_attribute_map = {
"name": {"key": "name", "type": "str"},
"location": {"key": "location", "type": "str"},
"status": {"key": "status", "type": "str"},
"sql_dedicated_gateway_endpoint": {"key": "sqlDedicatedGatewayEndpoint", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.sql_dedicated_gateway_endpoint = None
|
class SqlDedicatedGatewayRegionalServiceResource(RegionalServiceResource):
'''Resource for a regional service location.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: The regional service name.
:vartype name: str
:ivar location: The location name.
:vartype location: str
:ivar status: Describes the status of a service. Known values are: "Creating", "Running",
"Updating", "Deleting", "Error", and "Stopped".
:vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus
:ivar sql_dedicated_gateway_endpoint: The regional endpoint for SqlDedicatedGateway.
:vartype sql_dedicated_gateway_endpoint: str
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 4 | 0 | 3 | 1 | 1 | 0.88 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 17 | 34 | 5 | 16 | 5 | 14 | 14 | 6 | 5 | 4 | 1 | 3 | 0 | 1 |
10,571 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.Usage
|
class Usage(_serialization.Model):
"""The usage data for a usage request.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent",
"CountPerSecond", "BytesPerSecond", and "Milliseconds".
:vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType
:ivar name: The name information for the metric.
:vartype name: ~azure.mgmt.cosmosdb.models.MetricName
:ivar quota_period: The quota period used to summarize the usage values.
:vartype quota_period: str
:ivar limit: Maximum value for this metric.
:vartype limit: int
:ivar current_value: Current value for this metric.
:vartype current_value: int
"""
_validation = {
"unit": {"readonly": True},
"name": {"readonly": True},
"quota_period": {"readonly": True},
"limit": {"readonly": True},
"current_value": {"readonly": True},
}
_attribute_map = {
"unit": {"key": "unit", "type": "str"},
"name": {"key": "name", "type": "MetricName"},
"quota_period": {"key": "quotaPeriod", "type": "str"},
"limit": {"key": "limit", "type": "int"},
"current_value": {"key": "currentValue", "type": "int"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.unit = None
self.name = None
self.quota_period = None
self.limit = None
self.current_value = None
|
class Usage(_serialization.Model):
'''The usage data for a usage request.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent",
"CountPerSecond", "BytesPerSecond", and "Milliseconds".
:vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType
:ivar name: The name information for the metric.
:vartype name: ~azure.mgmt.cosmosdb.models.MetricName
:ivar quota_period: The quota period used to summarize the usage values.
:vartype quota_period: str
:ivar limit: Maximum value for this metric.
:vartype limit: int
:ivar current_value: Current value for this metric.
:vartype current_value: int
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 8 | 0 | 7 | 1 | 1 | 0.68 | 1 | 2 | 0 | 1 | 1 | 5 | 1 | 16 | 42 | 5 | 22 | 9 | 20 | 15 | 10 | 9 | 8 | 1 | 2 | 0 | 1 |
10,572 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.VectorEmbedding
|
class VectorEmbedding(_serialization.Model):
"""Represents a vector embedding. A vector embedding is used to define a vector field in the
documents.
All required parameters must be populated in order to send to server.
:ivar path: The path to the vector field in the document. Required.
:vartype path: str
:ivar data_type: Indicates the data type of vector. Required. Known values are: "float32",
"uint8", and "int8".
:vartype data_type: str or ~azure.mgmt.cosmosdb.models.VectorDataType
:ivar distance_function: The distance function to use for distance calculation in between
vectors. Required. Known values are: "euclidean", "cosine", and "dotproduct".
:vartype distance_function: str or ~azure.mgmt.cosmosdb.models.DistanceFunction
:ivar dimensions: The number of dimensions in the vector. Required.
:vartype dimensions: int
"""
_validation = {
"path": {"required": True},
"data_type": {"required": True},
"distance_function": {"required": True},
"dimensions": {"required": True},
}
_attribute_map = {
"path": {"key": "path", "type": "str"},
"data_type": {"key": "dataType", "type": "str"},
"distance_function": {"key": "distanceFunction", "type": "str"},
"dimensions": {"key": "dimensions", "type": "int"},
}
def __init__(
self,
*,
path: str,
data_type: Union[str, "_models.VectorDataType"],
distance_function: Union[str, "_models.DistanceFunction"],
dimensions: int,
**kwargs: Any
) -> None:
"""
:keyword path: The path to the vector field in the document. Required.
:paramtype path: str
:keyword data_type: Indicates the data type of vector. Required. Known values are: "float32",
"uint8", and "int8".
:paramtype data_type: str or ~azure.mgmt.cosmosdb.models.VectorDataType
:keyword distance_function: The distance function to use for distance calculation in between
vectors. Required. Known values are: "euclidean", "cosine", and "dotproduct".
:paramtype distance_function: str or ~azure.mgmt.cosmosdb.models.DistanceFunction
:keyword dimensions: The number of dimensions in the vector. Required.
:paramtype dimensions: int
"""
super().__init__(**kwargs)
self.path = path
self.data_type = data_type
self.distance_function = distance_function
self.dimensions = dimensions
|
class VectorEmbedding(_serialization.Model):
'''Represents a vector embedding. A vector embedding is used to define a vector field in the
documents.
All required parameters must be populated in order to send to server.
:ivar path: The path to the vector field in the document. Required.
:vartype path: str
:ivar data_type: Indicates the data type of vector. Required. Known values are: "float32",
"uint8", and "int8".
:vartype data_type: str or ~azure.mgmt.cosmosdb.models.VectorDataType
:ivar distance_function: The distance function to use for distance calculation in between
vectors. Required. Known values are: "euclidean", "cosine", and "dotproduct".
:vartype distance_function: str or ~azure.mgmt.cosmosdb.models.DistanceFunction
:ivar dimensions: The number of dimensions in the vector. Required.
:vartype dimensions: int
'''
def __init__(
self,
*,
path: str,
data_type: Union[str, "_models.VectorDataType"],
distance_function: Union[str, "_models.DistanceFunction"],
dimensions: int,
**kwargs: Any
) -> None:
'''
:keyword path: The path to the vector field in the document. Required.
:paramtype path: str
:keyword data_type: Indicates the data type of vector. Required. Known values are: "float32",
"uint8", and "int8".
:paramtype data_type: str or ~azure.mgmt.cosmosdb.models.VectorDataType
:keyword distance_function: The distance function to use for distance calculation in between
vectors. Required. Known values are: "euclidean", "cosine", and "dotproduct".
:paramtype distance_function: str or ~azure.mgmt.cosmosdb.models.DistanceFunction
:keyword dimensions: The number of dimensions in the vector. Required.
:paramtype dimensions: int
'''
pass
| 2 | 2 | 26 | 0 | 14 | 12 | 1 | 0.96 | 1 | 4 | 0 | 0 | 1 | 4 | 1 | 16 | 58 | 5 | 27 | 16 | 17 | 26 | 9 | 8 | 7 | 1 | 2 | 0 | 1 |
10,573 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.VectorEmbeddingPolicy
|
class VectorEmbeddingPolicy(_serialization.Model):
"""Cosmos DB Vector Embedding Policy.
:ivar vector_embeddings: List of vector embeddings.
:vartype vector_embeddings: list[~azure.mgmt.cosmosdb.models.VectorEmbedding]
"""
_attribute_map = {
"vector_embeddings": {"key": "vectorEmbeddings", "type": "[VectorEmbedding]"},
}
def __init__(self, *, vector_embeddings: Optional[List["_models.VectorEmbedding"]] = None, **kwargs: Any) -> None:
"""
:keyword vector_embeddings: List of vector embeddings.
:paramtype vector_embeddings: list[~azure.mgmt.cosmosdb.models.VectorEmbedding]
"""
super().__init__(**kwargs)
self.vector_embeddings = vector_embeddings
|
class VectorEmbeddingPolicy(_serialization.Model):
'''Cosmos DB Vector Embedding Policy.
:ivar vector_embeddings: List of vector embeddings.
:vartype vector_embeddings: list[~azure.mgmt.cosmosdb.models.VectorEmbedding]
'''
def __init__(self, *, vector_embeddings: Optional[List["_models.VectorEmbedding"]] = None, **kwargs: Any) -> None:
'''
:keyword vector_embeddings: List of vector embeddings.
:paramtype vector_embeddings: list[~azure.mgmt.cosmosdb.models.VectorEmbedding]
'''
pass
| 2 | 2 | 7 | 0 | 3 | 4 | 1 | 1.14 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 16 | 18 | 3 | 7 | 4 | 5 | 8 | 5 | 4 | 3 | 1 | 2 | 0 | 1 |
10,574 |
Azure/azure-cli-extensions
|
src/spring/azext_spring/vendored_sdks/appplatform/v2024_05_01_preview/aio/operations/_configuration_services_operations.py
|
azext_spring.vendored_sdks.appplatform.v2024_05_01_preview.aio.operations._configuration_services_operations.ConfigurationServicesOperations
|
class ConfigurationServicesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`configuration_services` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace_async
async def get(
self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any
) -> _models.ConfigurationServiceResource:
"""Get the Application Configuration Service and its properties.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:return: ConfigurationServiceResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
service_name=service_name,
configuration_service_name=configuration_service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]],
**kwargs: Any
) -> _models.ConfigurationServiceResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(configuration_service_resource, (IOBase, bytes)):
_content = configuration_service_resource
else:
_json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource")
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
service_name=service_name,
configuration_service_name=configuration_service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: _models.ConfigurationServiceResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceResource]:
"""Create the default Application Configuration Service or update the existing Application
Configuration Service.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param configuration_service_resource: Parameters for the update operation. Required.
:type configuration_service_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceResource]:
"""Create the default Application Configuration Service or update the existing Application
Configuration Service.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param configuration_service_resource: Parameters for the update operation. Required.
:type configuration_service_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceResource]:
"""Create the default Application Configuration Service or update the existing Application
Configuration Service.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param configuration_service_resource: Parameters for the update operation. Is either a
ConfigurationServiceResource type or a IO[bytes] type. Required.
:type configuration_service_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
service_name=service_name,
configuration_service_name=configuration_service_name,
configuration_service_resource=configuration_service_resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.ConfigurationServiceResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
service_name=service_name,
configuration_service_name=configuration_service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Disable the default Application Configuration Service.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
service_name=service_name,
configuration_service_name=configuration_service_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, service_name: str, **kwargs: Any
) -> AsyncIterable["_models.ConfigurationServiceResource"]:
"""Handles requests to list all resources in a Service.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: An iterator like instance of either ConfigurationServiceResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ConfigurationServiceResourceCollection", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
async def _validate_initial(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
settings: Union[_models.ConfigurationServiceSettings, IO[bytes]],
**kwargs: Any
) -> _models.ConfigurationServiceSettingsValidateResult:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(settings, (IOBase, bytes)):
_content = settings
else:
_json = self._serialize.body(settings, "ConfigurationServiceSettings")
_request = build_validate_request(
resource_group_name=resource_group_name,
service_name=service_name,
configuration_service_name=configuration_service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_validate(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
settings: _models.ConfigurationServiceSettings,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]:
"""Check if the Application Configuration Service settings are valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param settings: Application Configuration Service settings to be validated. Required.
:type settings: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettings
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either
ConfigurationServiceSettingsValidateResult or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_validate(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
settings: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]:
"""Check if the Application Configuration Service settings are valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param settings: Application Configuration Service settings to be validated. Required.
:type settings: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either
ConfigurationServiceSettingsValidateResult or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_validate(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
settings: Union[_models.ConfigurationServiceSettings, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]:
"""Check if the Application Configuration Service settings are valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param settings: Application Configuration Service settings to be validated. Is either a
ConfigurationServiceSettings type or a IO[bytes] type. Required.
:type settings: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettings
or IO[bytes]
:return: An instance of AsyncLROPoller that returns either
ConfigurationServiceSettingsValidateResult or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._validate_initial(
resource_group_name=resource_group_name,
service_name=service_name,
configuration_service_name=configuration_service_name,
settings=settings,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(
AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _validate_resource_initial(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ConfigurationServiceSettingsValidateResult]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.ConfigurationServiceSettingsValidateResult]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(configuration_service_resource, (IOBase, bytes)):
_content = configuration_service_resource
else:
_json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource")
_request = build_validate_resource_request(
resource_group_name=resource_group_name,
service_name=service_name,
configuration_service_name=configuration_service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = None
response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response)
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
async def begin_validate_resource(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: _models.ConfigurationServiceResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]:
"""Check if the Application Configuration Service resource is valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param configuration_service_resource: Application Configuration Service resource to be
validated. Required.
:type configuration_service_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either
ConfigurationServiceSettingsValidateResult or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_validate_resource(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]:
"""Check if the Application Configuration Service resource is valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param configuration_service_resource: Application Configuration Service resource to be
validated. Required.
:type configuration_service_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either
ConfigurationServiceSettingsValidateResult or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_validate_resource(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]:
"""Check if the Application Configuration Service resource is valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param configuration_service_resource: Application Configuration Service resource to be
validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required.
:type configuration_service_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either
ConfigurationServiceSettingsValidateResult or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._validate_resource_initial(
resource_group_name=resource_group_name,
service_name=service_name,
configuration_service_name=configuration_service_name,
configuration_service_resource=configuration_service_resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(
AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
|
class ConfigurationServicesOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`configuration_services` attribute.
'''
def __init__(self, *args, **kwargs) -> None:
pass
@distributed_trace_async
async def get(
self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any
) -> _models.ConfigurationServiceResource:
'''Get the Application Configuration Service and its properties.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:return: ConfigurationServiceResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]],
**kwargs: Any
) -> _models.ConfigurationServiceResource:
pass
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: _models.ConfigurationServiceResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceResource]:
'''Create the default Application Configuration Service or update the existing Application
Configuration Service.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param configuration_service_resource: Parameters for the update operation. Required.
:type configuration_service_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: _models.ConfigurationServiceResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceResource]:
'''Create the default Application Configuration Service or update the existing Application
Configuration Service.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param configuration_service_resource: Parameters for the update operation. Required.
:type configuration_service_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: _models.ConfigurationServiceResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceResource]:
'''Create the default Application Configuration Service or update the existing Application
Configuration Service.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param configuration_service_resource: Parameters for the update operation. Is either a
ConfigurationServiceResource type or a IO[bytes] type. Required.
:type configuration_service_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any
) -> None:
pass
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
'''Disable the default Application Configuration Service.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list(
self, resource_group_name: str, service_name: str, **kwargs: Any
) -> AsyncIterable["_models.ConfigurationServiceResource"]:
'''Handles requests to list all resources in a Service.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: An iterator like instance of either ConfigurationServiceResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
async def extract_data(pipeline_response):
pass
async def get_next(next_link=None):
pass
async def _validate_initial(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
settings: Union[_models.ConfigurationServiceSettings, IO[bytes]],
**kwargs: Any
) -> _models.ConfigurationServiceSettingsValidateResult:
pass
@overload
async def begin_validate(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
settings: _models.ConfigurationServiceSettings,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]:
'''Check if the Application Configuration Service settings are valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param settings: Application Configuration Service settings to be validated. Required.
:type settings: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettings
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either
ConfigurationServiceSettingsValidateResult or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_validate(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
settings: _models.ConfigurationServiceSettings,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]:
'''Check if the Application Configuration Service settings are valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param settings: Application Configuration Service settings to be validated. Required.
:type settings: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either
ConfigurationServiceSettingsValidateResult or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_validate(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
settings: _models.ConfigurationServiceSettings,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]:
'''Check if the Application Configuration Service settings are valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param settings: Application Configuration Service settings to be validated. Is either a
ConfigurationServiceSettings type or a IO[bytes] type. Required.
:type settings: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettings
or IO[bytes]
:return: An instance of AsyncLROPoller that returns either
ConfigurationServiceSettingsValidateResult or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
async def _validate_resource_initial(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ConfigurationServiceSettingsValidateResult]:
pass
@overload
async def begin_validate_resource(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: _models.ConfigurationServiceResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]:
'''Check if the Application Configuration Service resource is valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param configuration_service_resource: Application Configuration Service resource to be
validated. Required.
:type configuration_service_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either
ConfigurationServiceSettingsValidateResult or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_validate_resource(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: _models.ConfigurationServiceResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]:
'''Check if the Application Configuration Service resource is valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param configuration_service_resource: Application Configuration Service resource to be
validated. Required.
:type configuration_service_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either
ConfigurationServiceSettingsValidateResult or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_validate_resource(
self,
resource_group_name: str,
service_name: str,
configuration_service_name: str,
configuration_service_resource: _models.ConfigurationServiceResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]:
'''Check if the Application Configuration Service resource is valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param configuration_service_name: The name of Application Configuration Service. Required.
:type configuration_service_name: str
:param configuration_service_resource: Application Configuration Service resource to be
validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required.
:type configuration_service_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either
ConfigurationServiceSettingsValidateResult or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
| 37 | 13 | 40 | 4 | 27 | 10 | 3 | 0.41 | 0 | 7 | 0 | 0 | 17 | 5 | 17 | 17 | 921 | 103 | 599 | 263 | 458 | 246 | 274 | 147 | 249 | 6 | 0 | 1 | 71 |
10,575 |
Azure/azure-cli-extensions
|
src/spring/azext_spring/vendored_sdks/appplatform/v2024_05_01_preview/aio/operations/_config_servers_operations.py
|
azext_spring.vendored_sdks.appplatform.v2024_05_01_preview.aio.operations._config_servers_operations.ConfigServersOperations
|
class ConfigServersOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`config_servers` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace_async
async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.ConfigServerResource:
"""Get the config server and its properties.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: ConfigServerResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ConfigServerResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _update_put_initial(
self,
resource_group_name: str,
service_name: str,
config_server_resource: Union[_models.ConfigServerResource, IO[bytes]],
**kwargs: Any
) -> _models.ConfigServerResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(config_server_resource, (IOBase, bytes)):
_content = config_server_resource
else:
_json = self._serialize.body(config_server_resource, "ConfigServerResource")
_request = build_update_put_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ConfigServerResource", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("ConfigServerResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_update_put(
self,
resource_group_name: str,
service_name: str,
config_server_resource: _models.ConfigServerResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerResource]:
"""Update the config server.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_resource: Parameters for the update operation. Required.
:type config_server_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_put(
self,
resource_group_name: str,
service_name: str,
config_server_resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerResource]:
"""Update the config server.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_resource: Parameters for the update operation. Required.
:type config_server_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_put(
self,
resource_group_name: str,
service_name: str,
config_server_resource: Union[_models.ConfigServerResource, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerResource]:
"""Update the config server.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_resource: Parameters for the update operation. Is either a
ConfigServerResource type or a IO[bytes] type. Required.
:type config_server_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_put_initial(
resource_group_name=resource_group_name,
service_name=service_name,
config_server_resource=config_server_resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ConfigServerResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.ConfigServerResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _update_patch_initial(
self,
resource_group_name: str,
service_name: str,
config_server_resource: Union[_models.ConfigServerResource, IO[bytes]],
**kwargs: Any
) -> _models.ConfigServerResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(config_server_resource, (IOBase, bytes)):
_content = config_server_resource
else:
_json = self._serialize.body(config_server_resource, "ConfigServerResource")
_request = build_update_patch_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ConfigServerResource", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("ConfigServerResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_update_patch(
self,
resource_group_name: str,
service_name: str,
config_server_resource: _models.ConfigServerResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerResource]:
"""Update the config server.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_resource: Parameters for the update operation. Required.
:type config_server_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_patch(
self,
resource_group_name: str,
service_name: str,
config_server_resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerResource]:
"""Update the config server.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_resource: Parameters for the update operation. Required.
:type config_server_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_patch(
self,
resource_group_name: str,
service_name: str,
config_server_resource: Union[_models.ConfigServerResource, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerResource]:
"""Update the config server.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_resource: Parameters for the update operation. Is either a
ConfigServerResource type or a IO[bytes] type. Required.
:type config_server_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_patch_initial(
resource_group_name=resource_group_name,
service_name=service_name,
config_server_resource=config_server_resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ConfigServerResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.ConfigServerResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, service_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
if cls:
return cls(pipeline_response, None, response_headers) # type: ignore
@distributed_trace_async
async def begin_delete(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
"""Disable the default Config Server, only available in Enterprise Plan.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
service_name=service_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, service_name: str, **kwargs: Any
) -> AsyncIterable["_models.ConfigServerResource"]:
"""Handles requests to list all config server resources in a Service.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: An iterator like instance of either ConfigServerResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.ConfigServerResourceCollection] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ConfigServerResourceCollection", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
async def _validate_initial(
self,
resource_group_name: str,
service_name: str,
config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]],
**kwargs: Any
) -> _models.ConfigServerSettingsValidateResult:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(config_server_settings, (IOBase, bytes)):
_content = config_server_settings
else:
_json = self._serialize.body(config_server_settings, "ConfigServerSettings")
_request = build_validate_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_validate(
self,
resource_group_name: str,
service_name: str,
config_server_settings: _models.ConfigServerSettings,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerSettingsValidateResult]:
"""Check if the config server settings are valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_settings: Config server settings to be validated. Required.
:type config_server_settings:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettings
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult
or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_validate(
self,
resource_group_name: str,
service_name: str,
config_server_settings: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerSettingsValidateResult]:
"""Check if the config server settings are valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_settings: Config server settings to be validated. Required.
:type config_server_settings: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult
or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_validate(
self,
resource_group_name: str,
service_name: str,
config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerSettingsValidateResult]:
"""Check if the config server settings are valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_settings: Config server settings to be validated. Is either a
ConfigServerSettings type or a IO[bytes] type. Required.
:type config_server_settings:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettings or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult
or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._validate_initial(
resource_group_name=resource_group_name,
service_name=service_name,
config_server_settings=config_server_settings,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(
AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.ConfigServerSettingsValidateResult](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
|
class ConfigServersOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`config_servers` attribute.
'''
def __init__(self, *args, **kwargs) -> None:
pass
@distributed_trace_async
async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.ConfigServerResource:
'''Get the config server and its properties.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: ConfigServerResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
async def _update_put_initial(
self,
resource_group_name: str,
service_name: str,
config_server_resource: Union[_models.ConfigServerResource, IO[bytes]],
**kwargs: Any
) -> _models.ConfigServerResource:
pass
@overload
async def begin_update_put(
self,
resource_group_name: str,
service_name: str,
config_server_resource: _models.ConfigServerResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerResource]:
'''Update the config server.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_resource: Parameters for the update operation. Required.
:type config_server_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_update_put(
self,
resource_group_name: str,
service_name: str,
config_server_resource: _models.ConfigServerResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerResource]:
'''Update the config server.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_resource: Parameters for the update operation. Required.
:type config_server_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_update_put(
self,
resource_group_name: str,
service_name: str,
config_server_resource: _models.ConfigServerResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerResource]:
'''Update the config server.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_resource: Parameters for the update operation. Is either a
ConfigServerResource type or a IO[bytes] type. Required.
:type config_server_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
async def _update_patch_initial(
self,
resource_group_name: str,
service_name: str,
config_server_resource: Union[_models.ConfigServerResource, IO[bytes]],
**kwargs: Any
) -> _models.ConfigServerResource:
pass
@overload
async def begin_update_patch(
self,
resource_group_name: str,
service_name: str,
config_server_resource: _models.ConfigServerResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerResource]:
'''Update the config server.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_resource: Parameters for the update operation. Required.
:type config_server_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_update_patch(
self,
resource_group_name: str,
service_name: str,
config_server_resource: _models.ConfigServerResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerResource]:
'''Update the config server.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_resource: Parameters for the update operation. Required.
:type config_server_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_update_patch(
self,
resource_group_name: str,
service_name: str,
config_server_resource: _models.ConfigServerResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerResource]:
'''Update the config server.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_resource: Parameters for the update operation. Is either a
ConfigServerResource type or a IO[bytes] type. Required.
:type config_server_resource:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, service_name: str, **kwargs: Any
) -> None:
pass
@distributed_trace_async
async def begin_delete(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
'''Disable the default Config Server, only available in Enterprise Plan.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list(
self, resource_group_name: str, service_name: str, **kwargs: Any
) -> AsyncIterable["_models.ConfigServerResource"]:
'''Handles requests to list all config server resources in a Service.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: An iterator like instance of either ConfigServerResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
async def extract_data(pipeline_response):
pass
async def get_next(next_link=None):
pass
async def _validate_initial(
self,
resource_group_name: str,
service_name: str,
config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]],
**kwargs: Any
) -> _models.ConfigServerSettingsValidateResult:
pass
@overload
async def begin_validate(
self,
resource_group_name: str,
service_name: str,
config_server_settings: _models.ConfigServerSettings,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerSettingsValidateResult]:
'''Check if the config server settings are valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_settings: Config server settings to be validated. Required.
:type config_server_settings:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettings
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult
or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_validate(
self,
resource_group_name: str,
service_name: str,
config_server_settings: _models.ConfigServerSettings,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerSettingsValidateResult]:
'''Check if the config server settings are valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_settings: Config server settings to be validated. Required.
:type config_server_settings: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult
or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_validate(
self,
resource_group_name: str,
service_name: str,
config_server_settings: _models.ConfigServerSettings,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigServerSettingsValidateResult]:
'''Check if the config server settings are valid.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param config_server_settings: Config server settings to be validated. Is either a
ConfigServerSettings type or a IO[bytes] type. Required.
:type config_server_settings:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettings or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult
or the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettingsValidateResult]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
| 37 | 13 | 37 | 4 | 26 | 9 | 3 | 0.38 | 0 | 7 | 0 | 0 | 17 | 5 | 17 | 17 | 870 | 104 | 573 | 247 | 448 | 220 | 275 | 147 | 250 | 6 | 0 | 1 | 72 |
10,576 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.VectorIndex
|
class VectorIndex(_serialization.Model):
"""VectorIndex.
All required parameters must be populated in order to send to server.
:ivar path: The path to the vector field in the document. Required.
:vartype path: str
:ivar type: The index type of the vector. Currently, flat, diskANN, and quantizedFlat are
supported. Required. Known values are: "flat", "diskANN", and "quantizedFlat".
:vartype type: str or ~azure.mgmt.cosmosdb.models.VectorIndexType
"""
_validation = {
"path": {"required": True},
"type": {"required": True},
}
_attribute_map = {
"path": {"key": "path", "type": "str"},
"type": {"key": "type", "type": "str"},
}
def __init__(self, *, path: str, type: Union[str, "_models.VectorIndexType"], **kwargs: Any) -> None:
"""
:keyword path: The path to the vector field in the document. Required.
:paramtype path: str
:keyword type: The index type of the vector. Currently, flat, diskANN, and quantizedFlat are
supported. Required. Known values are: "flat", "diskANN", and "quantizedFlat".
:paramtype type: str or ~azure.mgmt.cosmosdb.models.VectorIndexType
"""
super().__init__(**kwargs)
self.path = path
self.type = type
|
class VectorIndex(_serialization.Model):
'''VectorIndex.
All required parameters must be populated in order to send to server.
:ivar path: The path to the vector field in the document. Required.
:vartype path: str
:ivar type: The index type of the vector. Currently, flat, diskANN, and quantizedFlat are
supported. Required. Known values are: "flat", "diskANN", and "quantizedFlat".
:vartype type: str or ~azure.mgmt.cosmosdb.models.VectorIndexType
'''
def __init__(self, *, path: str, type: Union[str, "_models.VectorIndexType"], **kwargs: Any) -> None:
'''
:keyword path: The path to the vector field in the document. Required.
:paramtype path: str
:keyword type: The index type of the vector. Currently, flat, diskANN, and quantizedFlat are
supported. Required. Known values are: "flat", "diskANN", and "quantizedFlat".
:paramtype type: str or ~azure.mgmt.cosmosdb.models.VectorIndexType
'''
pass
| 2 | 2 | 11 | 0 | 4 | 7 | 1 | 1.15 | 1 | 3 | 0 | 0 | 1 | 2 | 1 | 16 | 33 | 5 | 13 | 6 | 11 | 15 | 7 | 6 | 5 | 1 | 2 | 0 | 1 |
10,577 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.VirtualNetworkRule
|
class VirtualNetworkRule(_serialization.Model):
"""Virtual Network ACL Rule object.
:ivar id: Resource ID of a subnet, for example:
/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. # pylint: disable=line-too-long
:vartype id: str
:ivar ignore_missing_v_net_service_endpoint: Create firewall rule before the virtual network
has vnet service endpoint enabled.
:vartype ignore_missing_v_net_service_endpoint: bool
"""
_attribute_map = {
"id": {"key": "id", "type": "str"},
"ignore_missing_v_net_service_endpoint": {"key": "ignoreMissingVNetServiceEndpoint", "type": "bool"},
}
def __init__(
self,
*,
id: Optional[str] = None, # pylint: disable=redefined-builtin
ignore_missing_v_net_service_endpoint: Optional[bool] = None,
**kwargs: Any
) -> None:
"""
:keyword id: Resource ID of a subnet, for example:
/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. # pylint: disable=line-too-long
:paramtype id: str
:keyword ignore_missing_v_net_service_endpoint: Create firewall rule before the virtual network
has vnet service endpoint enabled.
:paramtype ignore_missing_v_net_service_endpoint: bool
"""
super().__init__(**kwargs)
self.id = id
self.ignore_missing_v_net_service_endpoint = ignore_missing_v_net_service_endpoint
|
class VirtualNetworkRule(_serialization.Model):
'''Virtual Network ACL Rule object.
:ivar id: Resource ID of a subnet, for example:
/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. # pylint: disable=line-too-long
:vartype id: str
:ivar ignore_missing_v_net_service_endpoint: Create firewall rule before the virtual network
has vnet service endpoint enabled.
:vartype ignore_missing_v_net_service_endpoint: bool
'''
def __init__(
self,
*,
id: Optional[str] = None, # pylint: disable=redefined-builtin
ignore_missing_v_net_service_endpoint: Optional[bool] = None,
**kwargs: Any
) -> None:
'''
:keyword id: Resource ID of a subnet, for example:
/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. # pylint: disable=line-too-long
:paramtype id: str
:keyword ignore_missing_v_net_service_endpoint: Create firewall rule before the virtual network
has vnet service endpoint enabled.
:paramtype ignore_missing_v_net_service_endpoint: bool
'''
pass
| 2 | 2 | 18 | 0 | 10 | 9 | 1 | 1.13 | 1 | 4 | 0 | 0 | 1 | 2 | 1 | 16 | 34 | 3 | 15 | 11 | 7 | 17 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,578 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_cassandra_clusters_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._cassandra_clusters_operations.CassandraClustersOperations
|
class CassandraClustersOperations: # pylint: disable=too-many-public-methods
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`cassandra_clusters` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ClusterResource"]:
"""List all managed Cassandra clusters in this subscription.
:return: An iterator like instance of either ClusterResource or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListClusters] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_by_subscription_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ListClusters", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ClusterResource"]:
"""List all managed Cassandra clusters in this resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:return: An iterator like instance of either ClusterResource or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListClusters] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ListClusters", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.ClusterResource:
"""Get the properties of a managed Cassandra cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:return: ClusterResource or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ClusterResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ClusterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]:
"""Deletes a managed Cassandra cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _create_update_initial(
self,
resource_group_name: str,
cluster_name: str,
body: Union[_models.ClusterResource, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(body, (IOBase, bytes)):
_content = body
else:
_json = self._serialize.body(body, "ClusterResource")
_request = build_create_update_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
body: _models.ClusterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ClusterResource]:
"""Create or update a managed Cassandra cluster. When updating, you must specify all writable
properties. To update only some properties, use PATCH.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: The properties specifying the desired state of the managed Cassandra cluster.
Required.
:type body: ~azure.mgmt.cosmosdb.models.ClusterResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ClusterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ClusterResource]:
"""Create or update a managed Cassandra cluster. When updating, you must specify all writable
properties. To update only some properties, use PATCH.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: The properties specifying the desired state of the managed Cassandra cluster.
Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ClusterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
body: Union[_models.ClusterResource, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ClusterResource]:
"""Create or update a managed Cassandra cluster. When updating, you must specify all writable
properties. To update only some properties, use PATCH.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: The properties specifying the desired state of the managed Cassandra cluster. Is
either a ClusterResource type or a IO[bytes] type. Required.
:type body: ~azure.mgmt.cosmosdb.models.ClusterResource or IO[bytes]
:return: An instance of LROPoller that returns either ClusterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_update_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
body=body,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ClusterResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ClusterResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _update_initial(
self,
resource_group_name: str,
cluster_name: str,
body: Union[_models.ClusterResource, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(body, (IOBase, bytes)):
_content = body
else:
_json = self._serialize.body(body, "ClusterResource")
_request = build_update_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
def begin_update(
self,
resource_group_name: str,
cluster_name: str,
body: _models.ClusterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ClusterResource]:
"""Updates some of the properties of a managed Cassandra cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Parameters to provide for specifying the managed Cassandra cluster. Required.
:type body: ~azure.mgmt.cosmosdb.models.ClusterResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ClusterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update(
self,
resource_group_name: str,
cluster_name: str,
body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ClusterResource]:
"""Updates some of the properties of a managed Cassandra cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Parameters to provide for specifying the managed Cassandra cluster. Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ClusterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update(
self,
resource_group_name: str,
cluster_name: str,
body: Union[_models.ClusterResource, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ClusterResource]:
"""Updates some of the properties of a managed Cassandra cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Parameters to provide for specifying the managed Cassandra cluster. Is either a
ClusterResource type or a IO[bytes] type. Required.
:type body: ~azure.mgmt.cosmosdb.models.ClusterResource or IO[bytes]
:return: An instance of LROPoller that returns either ClusterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
body=body,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ClusterResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ClusterResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _invoke_command_initial(
self,
resource_group_name: str,
cluster_name: str,
body: Union[_models.CommandPostBody, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(body, (IOBase, bytes)):
_content = body
else:
_json = self._serialize.body(body, "CommandPostBody")
_request = build_invoke_command_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
def begin_invoke_command(
self,
resource_group_name: str,
cluster_name: str,
body: _models.CommandPostBody,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CommandOutput]:
"""Invoke a command like nodetool for cassandra maintenance.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Specification which command to run where. Required.
:type body: ~azure.mgmt.cosmosdb.models.CommandPostBody
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CommandOutput or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_invoke_command(
self,
resource_group_name: str,
cluster_name: str,
body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CommandOutput]:
"""Invoke a command like nodetool for cassandra maintenance.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Specification which command to run where. Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CommandOutput or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_invoke_command(
self,
resource_group_name: str,
cluster_name: str,
body: Union[_models.CommandPostBody, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.CommandOutput]:
"""Invoke a command like nodetool for cassandra maintenance.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Specification which command to run where. Is either a CommandPostBody type or a
IO[bytes] type. Required.
:type body: ~azure.mgmt.cosmosdb.models.CommandPostBody or IO[bytes]
:return: An instance of LROPoller that returns either CommandOutput or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CommandOutput] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._invoke_command_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
body=body,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CommandOutput", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.CommandOutput].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.CommandOutput](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _invoke_command_async_initial(
self,
resource_group_name: str,
cluster_name: str,
body: Union[_models.CommandAsyncPostBody, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(body, (IOBase, bytes)):
_content = body
else:
_json = self._serialize.body(body, "CommandAsyncPostBody")
_request = build_invoke_command_async_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_invoke_command_async(
self,
resource_group_name: str,
cluster_name: str,
body: _models.CommandAsyncPostBody,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CommandPublicResource]:
"""Invoke a command like nodetool for cassandra maintenance asynchronously.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Specification which command to run where. Required.
:type body: ~azure.mgmt.cosmosdb.models.CommandAsyncPostBody
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CommandPublicResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_invoke_command_async(
self,
resource_group_name: str,
cluster_name: str,
body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CommandPublicResource]:
"""Invoke a command like nodetool for cassandra maintenance asynchronously.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Specification which command to run where. Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CommandPublicResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_invoke_command_async(
self,
resource_group_name: str,
cluster_name: str,
body: Union[_models.CommandAsyncPostBody, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.CommandPublicResource]:
"""Invoke a command like nodetool for cassandra maintenance asynchronously.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Specification which command to run where. Is either a CommandAsyncPostBody type or
a IO[bytes] type. Required.
:type body: ~azure.mgmt.cosmosdb.models.CommandAsyncPostBody or IO[bytes]
:return: An instance of LROPoller that returns either CommandPublicResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CommandPublicResource] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._invoke_command_async_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
body=body,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CommandPublicResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.CommandPublicResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.CommandPublicResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace
def list_command(
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.CommandPublicResource"]:
"""List all commands currently running on ring info.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:return: An iterator like instance of either CommandPublicResource or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CommandPublicResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListCommands] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_command_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ListCommands", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get_command_async(
self, resource_group_name: str, cluster_name: str, command_id: str, **kwargs: Any
) -> _models.CommandPublicResource:
"""Get details about a specified command that was run asynchronously.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param command_id: Managed Cassandra cluster command id. Required.
:type command_id: str
:return: CommandPublicResource or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.CommandPublicResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CommandPublicResource] = kwargs.pop("cls", None)
_request = build_get_command_async_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
command_id=command_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CommandPublicResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def list_backups(
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.BackupResource"]:
"""List the backups of this cluster that are available to restore.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:return: An iterator like instance of either BackupResource or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.BackupResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListBackups] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_backups_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ListBackups", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get_backup(
self, resource_group_name: str, cluster_name: str, backup_id: str, **kwargs: Any
) -> _models.BackupResource:
"""Get the properties of an individual backup of this cluster that is available to restore.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param backup_id: Id of a restorable backup of a Cassandra cluster. Required.
:type backup_id: str
:return: BackupResource or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.BackupResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.BackupResource] = kwargs.pop("cls", None)
_request = build_get_backup_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
backup_id=backup_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("BackupResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _deallocate_initial(
self, resource_group_name: str, cluster_name: str, x_ms_force_deallocate: Optional[str] = None, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_deallocate_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
x_ms_force_deallocate=x_ms_force_deallocate,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_deallocate(
self, resource_group_name: str, cluster_name: str, x_ms_force_deallocate: Optional[str] = None, **kwargs: Any
) -> LROPoller[None]:
"""Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will
deallocate the host virtual machine of this cluster, and reserved the data disk. This won't do
anything on an already deallocated cluster. Use Start to restart the cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param x_ms_force_deallocate: Force to deallocate a cluster of Cluster Type Production. Force
to deallocate a cluster of Cluster Type Production might cause data loss. Default value is
None.
:type x_ms_force_deallocate: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._deallocate_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
x_ms_force_deallocate=x_ms_force_deallocate,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _start_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_start_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_start(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]:
"""Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host
virtual machine of this cluster with reserved data disk. This won't do anything on an already
running cluster. Use Deallocate to deallocate the cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._start_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def status(
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> _models.CassandraClusterPublicStatus:
"""Gets the CPU, memory, and disk usage statistics for each Cassandra node in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:return: CassandraClusterPublicStatus or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.CassandraClusterPublicStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CassandraClusterPublicStatus] = kwargs.pop("cls", None)
_request = build_status_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CassandraClusterPublicStatus", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
|
class CassandraClustersOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`cassandra_clusters` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ClusterResource"]:
'''List all managed Cassandra clusters in this subscription.
:return: An iterator like instance of either ClusterResource or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ClusterResource"]:
'''List all managed Cassandra clusters in this resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:return: An iterator like instance of either ClusterResource or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_next(next_link=None):
'''Get the properties of a managed Cassandra cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:return: ClusterResource or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.ClusterResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]:
pass
@distributed_trace
def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]:
'''Deletes a managed Cassandra cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _create_update_initial(
self,
resource_group_name: str,
cluster_name: str,
body: Union[_models.ClusterResource, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
body: _models.ClusterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ClusterResource]:
'''Create or update a managed Cassandra cluster. When updating, you must specify all writable
properties. To update only some properties, use PATCH.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: The properties specifying the desired state of the managed Cassandra cluster.
Required.
:type body: ~azure.mgmt.cosmosdb.models.ClusterResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ClusterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
body: _models.ClusterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ClusterResource]:
'''Create or update a managed Cassandra cluster. When updating, you must specify all writable
properties. To update only some properties, use PATCH.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: The properties specifying the desired state of the managed Cassandra cluster.
Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ClusterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
body: _models.ClusterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ClusterResource]:
'''Create or update a managed Cassandra cluster. When updating, you must specify all writable
properties. To update only some properties, use PATCH.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: The properties specifying the desired state of the managed Cassandra cluster. Is
either a ClusterResource type or a IO[bytes] type. Required.
:type body: ~azure.mgmt.cosmosdb.models.ClusterResource or IO[bytes]
:return: An instance of LROPoller that returns either ClusterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _update_initial(
self,
resource_group_name: str,
cluster_name: str,
body: Union[_models.ClusterResource, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_update(
self,
resource_group_name: str,
cluster_name: str,
body: _models.ClusterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ClusterResource]:
'''Updates some of the properties of a managed Cassandra cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Parameters to provide for specifying the managed Cassandra cluster. Required.
:type body: ~azure.mgmt.cosmosdb.models.ClusterResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ClusterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_update(
self,
resource_group_name: str,
cluster_name: str,
body: _models.ClusterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ClusterResource]:
'''Updates some of the properties of a managed Cassandra cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Parameters to provide for specifying the managed Cassandra cluster. Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ClusterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_update(
self,
resource_group_name: str,
cluster_name: str,
body: _models.ClusterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ClusterResource]:
'''Updates some of the properties of a managed Cassandra cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Parameters to provide for specifying the managed Cassandra cluster. Is either a
ClusterResource type or a IO[bytes] type. Required.
:type body: ~azure.mgmt.cosmosdb.models.ClusterResource or IO[bytes]
:return: An instance of LROPoller that returns either ClusterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _invoke_command_initial(
self,
resource_group_name: str,
cluster_name: str,
body: Union[_models.CommandPostBody, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_invoke_command(
self,
resource_group_name: str,
cluster_name: str,
body: _models.CommandPostBody,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CommandOutput]:
'''Invoke a command like nodetool for cassandra maintenance.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Specification which command to run where. Required.
:type body: ~azure.mgmt.cosmosdb.models.CommandPostBody
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CommandOutput or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_invoke_command(
self,
resource_group_name: str,
cluster_name: str,
body: _models.CommandPostBody,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CommandOutput]:
'''Invoke a command like nodetool for cassandra maintenance.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Specification which command to run where. Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CommandOutput or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_invoke_command(
self,
resource_group_name: str,
cluster_name: str,
body: _models.CommandPostBody,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CommandOutput]:
'''Invoke a command like nodetool for cassandra maintenance.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Specification which command to run where. Is either a CommandPostBody type or a
IO[bytes] type. Required.
:type body: ~azure.mgmt.cosmosdb.models.CommandPostBody or IO[bytes]
:return: An instance of LROPoller that returns either CommandOutput or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _invoke_command_async_initial(
self,
resource_group_name: str,
cluster_name: str,
body: Union[_models.CommandAsyncPostBody, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_invoke_command_async(
self,
resource_group_name: str,
cluster_name: str,
body: _models.CommandAsyncPostBody,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CommandPublicResource]:
'''Invoke a command like nodetool for cassandra maintenance asynchronously.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Specification which command to run where. Required.
:type body: ~azure.mgmt.cosmosdb.models.CommandAsyncPostBody
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CommandPublicResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_invoke_command_async(
self,
resource_group_name: str,
cluster_name: str,
body: _models.CommandAsyncPostBody,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CommandPublicResource]:
'''Invoke a command like nodetool for cassandra maintenance asynchronously.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Specification which command to run where. Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either CommandPublicResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_invoke_command_async(
self,
resource_group_name: str,
cluster_name: str,
body: _models.CommandAsyncPostBody,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CommandPublicResource]:
'''Invoke a command like nodetool for cassandra maintenance asynchronously.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param body: Specification which command to run where. Is either a CommandAsyncPostBody type or
a IO[bytes] type. Required.
:type body: ~azure.mgmt.cosmosdb.models.CommandAsyncPostBody or IO[bytes]
:return: An instance of LROPoller that returns either CommandPublicResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list_command(
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.CommandPublicResource"]:
'''List all commands currently running on ring info.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:return: An iterator like instance of either CommandPublicResource or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CommandPublicResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_command_async(
self, resource_group_name: str, cluster_name: str, command_id: str, **kwargs: Any
) -> _models.CommandPublicResource:
'''Get details about a specified command that was run asynchronously.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param command_id: Managed Cassandra cluster command id. Required.
:type command_id: str
:return: CommandPublicResource or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.CommandPublicResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def list_backups(
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.BackupResource"]:
'''List the backups of this cluster that are available to restore.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:return: An iterator like instance of either BackupResource or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.BackupResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_backup(
self, resource_group_name: str, cluster_name: str, backup_id: str, **kwargs: Any
) -> _models.BackupResource:
'''Get the properties of an individual backup of this cluster that is available to restore.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param backup_id: Id of a restorable backup of a Cassandra cluster. Required.
:type backup_id: str
:return: BackupResource or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.BackupResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _deallocate_initial(
self, resource_group_name: str, cluster_name: str, x_ms_force_deallocate: Optional[str] = None, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_deallocate(
self, resource_group_name: str, cluster_name: str, x_ms_force_deallocate: Optional[str] = None, **kwargs: Any
) -> LROPoller[None]:
'''Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will
deallocate the host virtual machine of this cluster, and reserved the data disk. This won't do
anything on an already deallocated cluster. Use Start to restart the cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param x_ms_force_deallocate: Force to deallocate a cluster of Cluster Type Production. Force
to deallocate a cluster of Cluster Type Production might cause data loss. Default value is
None.
:type x_ms_force_deallocate: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _start_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]:
pass
@distributed_trace
def begin_start(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]:
'''Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host
virtual machine of this cluster with reserved data disk. This won't do anything on an already
running cluster. Use Deallocate to deallocate the cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def status(
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> _models.CassandraClusterPublicStatus:
'''Gets the CPU, memory, and disk usage statistics for each Cassandra node in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:return: CassandraClusterPublicStatus or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.CassandraClusterPublicStatus
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
| 74 | 24 | 36 | 4 | 26 | 8 | 3 | 0.35 | 0 | 8 | 0 | 0 | 31 | 4 | 31 | 31 | 1,667 | 225 | 1,126 | 464 | 926 | 389 | 595 | 315 | 544 | 6 | 0 | 2 | 135 |
10,579 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_cassandra_data_centers_operations.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.operations._cassandra_data_centers_operations.CassandraDataCentersOperations
|
class CassandraDataCentersOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`cassandra_data_centers` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.DataCenterResource"]:
"""List all data centers in a particular managed Cassandra cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:return: An iterator like instance of either DataCenterResource or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DataCenterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListDataCenters] = kwargs.pop("cls", None)
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ListDataCenters", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get(
self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any
) -> _models.DataCenterResource:
"""Get the properties of a managed Cassandra data center.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:return: DataCenterResource or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataCenterResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
data_center_name=data_center_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DataCenterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _delete_initial(
self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
data_center_name=data_center_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete(
self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a managed Cassandra data center.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
data_center_name=data_center_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _create_update_initial(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: Union[_models.DataCenterResource, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(body, (IOBase, bytes)):
_content = body
else:
_json = self._serialize.body(body, "DataCenterResource")
_request = build_create_update_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
data_center_name=data_center_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: _models.DataCenterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DataCenterResource]:
"""Create or update a managed Cassandra data center. When updating, overwrite all properties. To
update only some properties, use PATCH.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:param body: Parameters specifying the managed Cassandra data center. Required.
:type body: ~azure.mgmt.cosmosdb.models.DataCenterResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DataCenterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DataCenterResource]:
"""Create or update a managed Cassandra data center. When updating, overwrite all properties. To
update only some properties, use PATCH.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:param body: Parameters specifying the managed Cassandra data center. Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DataCenterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: Union[_models.DataCenterResource, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.DataCenterResource]:
"""Create or update a managed Cassandra data center. When updating, overwrite all properties. To
update only some properties, use PATCH.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:param body: Parameters specifying the managed Cassandra data center. Is either a
DataCenterResource type or a IO[bytes] type. Required.
:type body: ~azure.mgmt.cosmosdb.models.DataCenterResource or IO[bytes]
:return: An instance of LROPoller that returns either DataCenterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_update_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
data_center_name=data_center_name,
body=body,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("DataCenterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.DataCenterResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.DataCenterResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _update_initial(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: Union[_models.DataCenterResource, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(body, (IOBase, bytes)):
_content = body
else:
_json = self._serialize.body(body, "DataCenterResource")
_request = build_update_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
data_center_name=data_center_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
def begin_update(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: _models.DataCenterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DataCenterResource]:
"""Update some of the properties of a managed Cassandra data center.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:param body: Parameters to provide for specifying the managed Cassandra data center. Required.
:type body: ~azure.mgmt.cosmosdb.models.DataCenterResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DataCenterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DataCenterResource]:
"""Update some of the properties of a managed Cassandra data center.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:param body: Parameters to provide for specifying the managed Cassandra data center. Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DataCenterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: Union[_models.DataCenterResource, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.DataCenterResource]:
"""Update some of the properties of a managed Cassandra data center.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:param body: Parameters to provide for specifying the managed Cassandra data center. Is either
a DataCenterResource type or a IO[bytes] type. Required.
:type body: ~azure.mgmt.cosmosdb.models.DataCenterResource or IO[bytes]
:return: An instance of LROPoller that returns either DataCenterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
data_center_name=data_center_name,
body=body,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("DataCenterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.DataCenterResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.DataCenterResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
|
class CassandraDataCentersOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s
:attr:`cassandra_data_centers` attribute.
'''
def __init__(self, *args, **kwargs):
pass
@distributed_trace
def list(
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.DataCenterResource"]:
'''List all data centers in a particular managed Cassandra cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:return: An iterator like instance of either DataCenterResource or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DataCenterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
def extract_data(pipeline_response):
pass
def get_next(next_link=None):
pass
@distributed_trace
def get_next(next_link=None):
'''Get the properties of a managed Cassandra data center.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:return: DataCenterResource or the result of cls(response)
:rtype: ~azure.mgmt.cosmosdb.models.DataCenterResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def _delete_initial(
self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any
) -> Iterator[bytes]:
pass
@distributed_trace
def begin_delete(
self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any
) -> LROPoller[None]:
'''Delete a managed Cassandra data center.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _create_update_initial(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: Union[_models.DataCenterResource, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: _models.DataCenterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DataCenterResource]:
'''Create or update a managed Cassandra data center. When updating, overwrite all properties. To
update only some properties, use PATCH.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:param body: Parameters specifying the managed Cassandra data center. Required.
:type body: ~azure.mgmt.cosmosdb.models.DataCenterResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DataCenterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: _models.DataCenterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DataCenterResource]:
'''Create or update a managed Cassandra data center. When updating, overwrite all properties. To
update only some properties, use PATCH.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:param body: Parameters specifying the managed Cassandra data center. Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DataCenterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: _models.DataCenterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DataCenterResource]:
'''Create or update a managed Cassandra data center. When updating, overwrite all properties. To
update only some properties, use PATCH.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:param body: Parameters specifying the managed Cassandra data center. Is either a
DataCenterResource type or a IO[bytes] type. Required.
:type body: ~azure.mgmt.cosmosdb.models.DataCenterResource or IO[bytes]
:return: An instance of LROPoller that returns either DataCenterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
def _update_initial(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: Union[_models.DataCenterResource, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
pass
@overload
def begin_update(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: _models.DataCenterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DataCenterResource]:
'''Update some of the properties of a managed Cassandra data center.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:param body: Parameters to provide for specifying the managed Cassandra data center. Required.
:type body: ~azure.mgmt.cosmosdb.models.DataCenterResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DataCenterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
def begin_update(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: _models.DataCenterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DataCenterResource]:
'''Update some of the properties of a managed Cassandra data center.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:param body: Parameters to provide for specifying the managed Cassandra data center. Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either DataCenterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace
def begin_update(
self,
resource_group_name: str,
cluster_name: str,
data_center_name: str,
body: _models.DataCenterResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.DataCenterResource]:
'''Update some of the properties of a managed Cassandra data center.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: Managed Cassandra cluster name. Required.
:type cluster_name: str
:param data_center_name: Data center name in a managed Cassandra cluster. Required.
:type data_center_name: str
:param body: Parameters to provide for specifying the managed Cassandra data center. Is either
a DataCenterResource type or a IO[bytes] type. Required.
:type body: ~azure.mgmt.cosmosdb.models.DataCenterResource or IO[bytes]
:return: An instance of LROPoller that returns either DataCenterResource or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
| 29 | 10 | 37 | 4 | 26 | 9 | 3 | 0.39 | 0 | 8 | 0 | 0 | 13 | 4 | 13 | 13 | 681 | 82 | 450 | 201 | 349 | 176 | 223 | 120 | 203 | 5 | 0 | 2 | 54 |
10,580 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.UsagesResult
|
class UsagesResult(_serialization.Model):
"""The response to a list usage request.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The list of usages for the database. A usage is a point in time metric.
:vartype value: list[~azure.mgmt.cosmosdb.models.Usage]
"""
_validation = {
"value": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[Usage]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
|
class UsagesResult(_serialization.Model):
'''The response to a list usage request.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The list of usages for the database. A usage is a point in time metric.
:vartype value: list[~azure.mgmt.cosmosdb.models.Usage]
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 4 | 0 | 3 | 1 | 1 | 0.6 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 16 | 21 | 5 | 10 | 5 | 8 | 6 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,581 |
Azure/azure-cli-extensions
|
src/spring/azext_spring/vendored_sdks/appplatform/v2024_05_01_preview/aio/operations/_apps_operations.py
|
azext_spring.vendored_sdks.appplatform.v2024_05_01_preview.aio.operations._apps_operations.AppsOperations
|
class AppsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`apps` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace_async
async def get(
self,
resource_group_name: str,
service_name: str,
app_name: str,
sync_status: Optional[str] = None,
**kwargs: Any
) -> _models.AppResource:
"""Get an App and its properties.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param sync_status: Indicates whether sync status. Default value is None.
:type sync_status: str
:return: AppResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.AppResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
subscription_id=self._config.subscription_id,
sync_status=sync_status,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("AppResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: Union[_models.AppResource, IO[bytes]],
**kwargs: Any
) -> _models.AppResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.AppResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(app_resource, (IOBase, bytes)):
_content = app_resource
else:
_json = self._serialize.body(app_resource, "AppResource")
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("AppResource", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("AppResource", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("AppResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: _models.AppResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
"""Create a new App or update an exiting App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param app_resource: Parameters for the create or update operation. Required.
:type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
"""Create a new App or update an exiting App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param app_resource: Parameters for the create or update operation. Required.
:type app_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: Union[_models.AppResource, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
"""Create a new App or update an exiting App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param app_resource: Parameters for the create or update operation. Is either a AppResource
type or a IO[bytes] type. Required.
:type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.AppResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
app_resource=app_resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("AppResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.AppResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.AppResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Operation to delete an App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _update_initial(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: Union[_models.AppResource, IO[bytes]],
**kwargs: Any
) -> _models.AppResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.AppResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(app_resource, (IOBase, bytes)):
_content = app_resource
else:
_json = self._serialize.body(app_resource, "AppResource")
_request = build_update_request(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("AppResource", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("AppResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: _models.AppResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
"""Operation to update an exiting App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param app_resource: Parameters for the update operation. Required.
:type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
"""Operation to update an exiting App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param app_resource: Parameters for the update operation. Required.
:type app_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: Union[_models.AppResource, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
"""Operation to update an exiting App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param app_resource: Parameters for the update operation. Is either a AppResource type or a
IO[bytes] type. Required.
:type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.AppResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_initial(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
app_resource=app_resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("AppResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.AppResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.AppResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace
def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]:
"""Handles requests to list all resources in a Service.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: An iterator like instance of either AppResource or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("AppResourceCollection", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
@distributed_trace_async
async def get_resource_upload_url(
self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any
) -> _models.ResourceUploadDefinition:
"""Get an resource upload URL for an App, which may be artifacts or source archive.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:return: ResourceUploadDefinition or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ResourceUploadDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None)
_request = build_get_resource_upload_url_request(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ResourceUploadDefinition", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _set_active_deployments_initial(
self,
resource_group_name: str,
service_name: str,
app_name: str,
active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]],
**kwargs: Any
) -> _models.AppResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.AppResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(active_deployment_collection, (IOBase, bytes)):
_content = active_deployment_collection
else:
_json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection")
_request = build_set_active_deployments_request(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("AppResource", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("AppResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_set_active_deployments(
self,
resource_group_name: str,
service_name: str,
app_name: str,
active_deployment_collection: _models.ActiveDeploymentCollection,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
"""Set existing Deployment under the app as active.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param active_deployment_collection: A list of Deployment name to be active. Required.
:type active_deployment_collection:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ActiveDeploymentCollection
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_set_active_deployments(
self,
resource_group_name: str,
service_name: str,
app_name: str,
active_deployment_collection: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
"""Set existing Deployment under the app as active.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param active_deployment_collection: A list of Deployment name to be active. Required.
:type active_deployment_collection: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_set_active_deployments(
self,
resource_group_name: str,
service_name: str,
app_name: str,
active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
"""Set existing Deployment under the app as active.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param active_deployment_collection: A list of Deployment name to be active. Is either a
ActiveDeploymentCollection type or a IO[bytes] type. Required.
:type active_deployment_collection:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ActiveDeploymentCollection or IO[bytes]
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.AppResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._set_active_deployments_initial(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
active_deployment_collection=active_deployment_collection,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("AppResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.AppResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.AppResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@overload
async def validate_domain(
self,
resource_group_name: str,
service_name: str,
app_name: str,
validate_payload: _models.CustomDomainValidatePayload,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.CustomDomainValidateResult:
"""Check the resource name is valid as well as not in use.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param validate_payload: Custom domain payload to be validated. Required.
:type validate_payload:
~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: CustomDomainValidateResult or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def validate_domain(
self,
resource_group_name: str,
service_name: str,
app_name: str,
validate_payload: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.CustomDomainValidateResult:
"""Check the resource name is valid as well as not in use.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param validate_payload: Custom domain payload to be validated. Required.
:type validate_payload: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: CustomDomainValidateResult or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def validate_domain(
self,
resource_group_name: str,
service_name: str,
app_name: str,
validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]],
**kwargs: Any
) -> _models.CustomDomainValidateResult:
"""Check the resource name is valid as well as not in use.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param validate_payload: Custom domain payload to be validated. Is either a
CustomDomainValidatePayload type or a IO[bytes] type. Required.
:type validate_payload:
~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload or IO[bytes]
:return: CustomDomainValidateResult or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(validate_payload, (IOBase, bytes)):
_content = validate_payload
else:
_json = self._serialize.body(validate_payload, "CustomDomainValidatePayload")
_request = build_validate_domain_request(
resource_group_name=resource_group_name,
service_name=service_name,
app_name=app_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CustomDomainValidateResult", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
|
class AppsOperations:
'''
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s
:attr:`apps` attribute.
'''
def __init__(self, *args, **kwargs) -> None:
pass
@distributed_trace_async
async def get(
self,
resource_group_name: str,
service_name: str,
app_name: str,
sync_status: Optional[str] = None,
**kwargs: Any
) -> _models.AppResource:
'''Get an App and its properties.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param sync_status: Indicates whether sync status. Default value is None.
:type sync_status: str
:return: AppResource or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: Union[_models.AppResource, IO[bytes]],
**kwargs: Any
) -> _models.AppResource:
pass
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: _models.AppResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
'''Create a new App or update an exiting App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param app_resource: Parameters for the create or update operation. Required.
:type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: _models.AppResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
'''Create a new App or update an exiting App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param app_resource: Parameters for the create or update operation. Required.
:type app_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: _models.AppResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
'''Create a new App or update an exiting App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param app_resource: Parameters for the create or update operation. Is either a AppResource
type or a IO[bytes] type. Required.
:type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any
) -> None:
pass
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
'''Operation to delete an App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
async def _update_initial(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: Union[_models.AppResource, IO[bytes]],
**kwargs: Any
) -> _models.AppResource:
pass
@overload
async def begin_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: _models.AppResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
'''Operation to update an exiting App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param app_resource: Parameters for the update operation. Required.
:type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: _models.AppResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
'''Operation to update an exiting App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param app_resource: Parameters for the update operation. Required.
:type app_resource: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_update(
self,
resource_group_name: str,
service_name: str,
app_name: str,
app_resource: _models.AppResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
'''Operation to update an exiting App.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param app_resource: Parameters for the update operation. Is either a AppResource type or a
IO[bytes] type. Required.
:type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@distributed_trace
def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]:
'''Handles requests to list all resources in a Service.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:return: An iterator like instance of either AppResource or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def prepare_request(next_link=None):
pass
async def extract_data(pipeline_response):
pass
async def get_next(next_link=None):
pass
@distributed_trace_async
async def get_resource_upload_url(
self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any
) -> _models.ResourceUploadDefinition:
'''Get an resource upload URL for an App, which may be artifacts or source archive.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:return: ResourceUploadDefinition or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ResourceUploadDefinition
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
async def _set_active_deployments_initial(
self,
resource_group_name: str,
service_name: str,
app_name: str,
active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]],
**kwargs: Any
) -> _models.AppResource:
pass
@overload
async def begin_set_active_deployments(
self,
resource_group_name: str,
service_name: str,
app_name: str,
active_deployment_collection: _models.ActiveDeploymentCollection,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
'''Set existing Deployment under the app as active.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param active_deployment_collection: A list of Deployment name to be active. Required.
:type active_deployment_collection:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ActiveDeploymentCollection
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def begin_set_active_deployments(
self,
resource_group_name: str,
service_name: str,
app_name: str,
active_deployment_collection: _models.ActiveDeploymentCollection,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
'''Set existing Deployment under the app as active.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param active_deployment_collection: A list of Deployment name to be active. Required.
:type active_deployment_collection: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def begin_set_active_deployments(
self,
resource_group_name: str,
service_name: str,
app_name: str,
active_deployment_collection: _models.ActiveDeploymentCollection,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AppResource]:
'''Set existing Deployment under the app as active.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param active_deployment_collection: A list of Deployment name to be active. Is either a
ActiveDeploymentCollection type or a IO[bytes] type. Required.
:type active_deployment_collection:
~azure.mgmt.appplatform.v2024_05_01_preview.models.ActiveDeploymentCollection or IO[bytes]
:return: An instance of AsyncLROPoller that returns either AppResource or the result of
cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource]
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
def get_long_running_output(pipeline_response):
pass
@overload
async def validate_domain(
self,
resource_group_name: str,
service_name: str,
app_name: str,
validate_payload: _models.CustomDomainValidatePayload,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.CustomDomainValidateResult:
'''Check the resource name is valid as well as not in use.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param validate_payload: Custom domain payload to be validated. Required.
:type validate_payload:
~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: CustomDomainValidateResult or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@overload
async def validate_domain(
self,
resource_group_name: str,
service_name: str,
app_name: str,
validate_payload: _models.CustomDomainValidatePayload,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.CustomDomainValidateResult:
'''Check the resource name is valid as well as not in use.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param validate_payload: Custom domain payload to be validated. Required.
:type validate_payload: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: CustomDomainValidateResult or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
@distributed_trace_async
async def validate_domain(
self,
resource_group_name: str,
service_name: str,
app_name: str,
validate_payload: _models.CustomDomainValidatePayload,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.CustomDomainValidateResult:
'''Check the resource name is valid as well as not in use.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param service_name: The name of the Service resource. Required.
:type service_name: str
:param app_name: The name of the App resource. Required.
:type app_name: str
:param validate_payload: Custom domain payload to be validated. Is either a
CustomDomainValidatePayload type or a IO[bytes] type. Required.
:type validate_payload:
~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload or IO[bytes]
:return: CustomDomainValidateResult or the result of cls(response)
:rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult
:raises ~azure.core.exceptions.HttpResponseError:
'''
pass
| 45 | 17 | 41 | 4 | 27 | 11 | 3 | 0.43 | 0 | 7 | 0 | 0 | 21 | 5 | 21 | 21 | 1,123 | 131 | 717 | 323 | 538 | 308 | 323 | 173 | 294 | 7 | 0 | 1 | 81 |
10,582 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlDatabaseResource
|
class SqlDatabaseResource(_serialization.Model):
"""Cosmos DB SQL database resource object.
All required parameters must be populated in order to send to server.
:ivar id: Name of the Cosmos DB SQL database. Required.
:vartype id: str
:ivar restore_parameters: Parameters to indicate the information about the restore.
:vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters
:ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default"
and "Restore".
:vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode
"""
_validation = {
"id": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"},
"create_mode": {"key": "createMode", "type": "str"},
}
def __init__(
self,
*,
id: str, # pylint: disable=redefined-builtin
restore_parameters: Optional["_models.ResourceRestoreParameters"] = None,
create_mode: Union[str, "_models.CreateMode"] = "Default",
**kwargs: Any
) -> None:
"""
:keyword id: Name of the Cosmos DB SQL database. Required.
:paramtype id: str
:keyword restore_parameters: Parameters to indicate the information about the restore.
:paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters
:keyword create_mode: Enum to indicate the mode of resource creation. Known values are:
"Default" and "Restore".
:paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode
"""
super().__init__(**kwargs)
self.id = id
self.restore_parameters = restore_parameters
self.create_mode = create_mode
|
class SqlDatabaseResource(_serialization.Model):
'''Cosmos DB SQL database resource object.
All required parameters must be populated in order to send to server.
:ivar id: Name of the Cosmos DB SQL database. Required.
:vartype id: str
:ivar restore_parameters: Parameters to indicate the information about the restore.
:vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters
:ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default"
and "Restore".
:vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode
'''
def __init__(
self,
*,
id: str, # pylint: disable=redefined-builtin
restore_parameters: Optional["_models.ResourceRestoreParameters"] = None,
create_mode: Union[str, "_models.CreateMode"] = "Default",
**kwargs: Any
) -> None:
'''
:keyword id: Name of the Cosmos DB SQL database. Required.
:paramtype id: str
:keyword restore_parameters: Parameters to indicate the information about the restore.
:paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters
:keyword create_mode: Enum to indicate the mode of resource creation. Known values are:
"Default" and "Restore".
:paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode
'''
pass
| 2 | 2 | 21 | 0 | 12 | 10 | 1 | 0.95 | 1 | 3 | 0 | 2 | 1 | 3 | 1 | 16 | 45 | 5 | 21 | 14 | 12 | 20 | 8 | 7 | 6 | 1 | 2 | 0 | 1 |
10,583 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.SqlDatabaseGetResults
|
class SqlDatabaseGetResults(ARMResourceProperties):
"""An Azure Cosmos DB SQL database.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource:
:vartype resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesResource
:ivar options:
:vartype options: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesOptions
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"location": {"key": "location", "type": "str"},
"tags": {"key": "tags", "type": "{str}"},
"identity": {"key": "identity", "type": "ManagedServiceIdentity"},
"resource": {"key": "properties.resource", "type": "SqlDatabaseGetPropertiesResource"},
"options": {"key": "properties.options", "type": "SqlDatabaseGetPropertiesOptions"},
}
def __init__(
self,
*,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
resource: Optional["_models.SqlDatabaseGetPropertiesResource"] = None,
options: Optional["_models.SqlDatabaseGetPropertiesOptions"] = None,
**kwargs: Any
) -> None:
"""
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource:
:paramtype resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesResource
:keyword options:
:paramtype options: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesOptions
"""
super().__init__(location=location, tags=tags, identity=identity, **kwargs)
self.resource = resource
self.options = options
|
class SqlDatabaseGetResults(ARMResourceProperties):
'''An Azure Cosmos DB SQL database.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:vartype tags: dict[str, str]
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:ivar resource:
:vartype resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesResource
:ivar options:
:vartype options: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesOptions
'''
def __init__(
self,
*,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
resource: Optional["_models.SqlDatabaseGetPropertiesResource"] = None,
options: Optional["_models.SqlDatabaseGetPropertiesOptions"] = None,
**kwargs: Any
) -> None:
'''
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be
used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can
be provided for a resource. Each tag must have a key no greater than 128 characters and value
no greater than 256 characters. For example, the default experience for a template type is set
with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table",
"Graph", "DocumentDB", and "MongoDB".
:paramtype tags: dict[str, str]
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity
:keyword resource:
:paramtype resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesResource
:keyword options:
:paramtype options: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesOptions
'''
pass
| 2 | 2 | 30 | 0 | 13 | 17 | 1 | 1.41 | 1 | 3 | 0 | 0 | 1 | 2 | 1 | 17 | 75 | 5 | 29 | 15 | 18 | 41 | 7 | 6 | 5 | 1 | 3 | 0 | 1 |
10,584 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.RegionForOnlineOffline
|
class RegionForOnlineOffline(_serialization.Model):
"""Cosmos DB region to online or offline.
All required parameters must be populated in order to send to server.
:ivar region: Cosmos DB region, with spaces between words and each word capitalized. Required.
:vartype region: str
"""
_validation = {
"region": {"required": True},
}
_attribute_map = {
"region": {"key": "region", "type": "str"},
}
def __init__(self, *, region: str, **kwargs: Any) -> None:
"""
:keyword region: Cosmos DB region, with spaces between words and each word capitalized.
Required.
:paramtype region: str
"""
super().__init__(**kwargs)
self.region = region
|
class RegionForOnlineOffline(_serialization.Model):
'''Cosmos DB region to online or offline.
All required parameters must be populated in order to send to server.
:ivar region: Cosmos DB region, with spaces between words and each word capitalized. Required.
:vartype region: str
'''
def __init__(self, *, region: str, **kwargs: Any) -> None:
'''
:keyword region: Cosmos DB region, with spaces between words and each word capitalized.
Required.
:paramtype region: str
'''
pass
| 2 | 2 | 8 | 0 | 3 | 5 | 1 | 1 | 1 | 3 | 0 | 0 | 1 | 1 | 1 | 16 | 25 | 5 | 10 | 5 | 8 | 10 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,585 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.RegionalServiceResource
|
class RegionalServiceResource(_serialization.Model):
"""Resource for a regional service location.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: The regional service name.
:vartype name: str
:ivar location: The location name.
:vartype location: str
:ivar status: Describes the status of a service. Known values are: "Creating", "Running",
"Updating", "Deleting", "Error", and "Stopped".
:vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus
"""
_validation = {
"name": {"readonly": True},
"location": {"readonly": True},
"status": {"readonly": True},
}
_attribute_map = {
"name": {"key": "name", "type": "str"},
"location": {"key": "location", "type": "str"},
"status": {"key": "status", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.name = None
self.location = None
self.status = None
|
class RegionalServiceResource(_serialization.Model):
'''Resource for a regional service location.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: The regional service name.
:vartype name: str
:ivar location: The location name.
:vartype location: str
:ivar status: Describes the status of a service. Known values are: "Creating", "Running",
"Updating", "Deleting", "Error", and "Stopped".
:vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 6 | 0 | 5 | 1 | 1 | 0.69 | 1 | 2 | 0 | 4 | 1 | 3 | 1 | 16 | 32 | 5 | 16 | 7 | 14 | 11 | 8 | 7 | 6 | 1 | 2 | 0 | 1 |
10,586 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.Resource
|
class Resource(_serialization.Model):
"""Common fields that are returned in the response for all Azure Resource Manager resources.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. E.g.
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"system_data": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"system_data": {"key": "systemData", "type": "SystemData"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.id = None
self.name = None
self.type = None
self.system_data = None
|
class Resource(_serialization.Model):
'''Common fields that are returned in the response for all Azure Resource Manager resources.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. E.g.
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 7 | 0 | 6 | 1 | 1 | 0.79 | 1 | 2 | 0 | 2 | 1 | 4 | 1 | 16 | 39 | 5 | 19 | 8 | 17 | 15 | 9 | 8 | 7 | 1 | 2 | 0 | 1 |
10,587 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.ResourceAssociation
|
class ResourceAssociation(_serialization.Model):
"""Information about resource association.
:ivar name: Name of the resource association.
:vartype name: str
:ivar access_mode: Access mode of the resource association. Known values are: "Enforced",
"Learning", and "Audit".
:vartype access_mode: str or ~azure.mgmt.cosmosdb.models.ResourceAssociationAccessMode
"""
_attribute_map = {
"name": {"key": "name", "type": "str"},
"access_mode": {"key": "accessMode", "type": "str"},
}
def __init__(
self,
*,
name: Optional[str] = None,
access_mode: Optional[Union[str, "_models.ResourceAssociationAccessMode"]] = None,
**kwargs: Any
) -> None:
"""
:keyword name: Name of the resource association.
:paramtype name: str
:keyword access_mode: Access mode of the resource association. Known values are: "Enforced",
"Learning", and "Audit".
:paramtype access_mode: str or ~azure.mgmt.cosmosdb.models.ResourceAssociationAccessMode
"""
super().__init__(**kwargs)
self.name = name
self.access_mode = access_mode
|
class ResourceAssociation(_serialization.Model):
'''Information about resource association.
:ivar name: Name of the resource association.
:vartype name: str
:ivar access_mode: Access mode of the resource association. Known values are: "Enforced",
"Learning", and "Audit".
:vartype access_mode: str or ~azure.mgmt.cosmosdb.models.ResourceAssociationAccessMode
'''
def __init__(
self,
*,
name: Optional[str] = None,
access_mode: Optional[Union[str, "_models.ResourceAssociationAccessMode"]] = None,
**kwargs: Any
) -> None:
'''
:keyword name: Name of the resource association.
:paramtype name: str
:keyword access_mode: Access mode of the resource association. Known values are: "Enforced",
"Learning", and "Audit".
:paramtype access_mode: str or ~azure.mgmt.cosmosdb.models.ResourceAssociationAccessMode
'''
pass
| 2 | 2 | 17 | 0 | 10 | 7 | 1 | 0.93 | 1 | 3 | 0 | 0 | 1 | 2 | 1 | 16 | 32 | 3 | 15 | 11 | 7 | 14 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,588 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.ResourceRestoreParameters
|
class ResourceRestoreParameters(RestoreParametersBase):
"""Parameters to indicate the information about the restore.
:ivar restore_source: The id of the restorable database account from which the restore has to
be initiated. For example:
/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. # pylint: disable=line-too-long
:vartype restore_source: str
:ivar restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 format).
:vartype restore_timestamp_in_utc: ~datetime.datetime
:ivar restore_with_ttl_disabled: Specifies whether the restored account will have Time-To-Live
disabled upon the successful restore.
:vartype restore_with_ttl_disabled: bool
"""
|
class ResourceRestoreParameters(RestoreParametersBase):
'''Parameters to indicate the information about the restore.
:ivar restore_source: The id of the restorable database account from which the restore has to
be initiated. For example:
/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. # pylint: disable=line-too-long
:vartype restore_source: str
:ivar restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 format).
:vartype restore_timestamp_in_utc: ~datetime.datetime
:ivar restore_with_ttl_disabled: Specifies whether the restored account will have Time-To-Live
disabled upon the successful restore.
:vartype restore_with_ttl_disabled: bool
'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 11 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 16 | 13 | 1 | 1 | 1 | 0 | 11 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
10,589 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.RestorableDatabaseAccountGetResult
|
class RestorableDatabaseAccountGetResult(_serialization.Model):
"""A Azure Cosmos DB restorable database account.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar account_name: The name of the global database account.
:vartype account_name: str
:ivar creation_time: The creation time of the restorable database account (ISO-8601 format).
:vartype creation_time: ~datetime.datetime
:ivar oldest_restorable_time: The least recent time at which the database account can be
restored to (ISO-8601 format).
:vartype oldest_restorable_time: ~datetime.datetime
:ivar deletion_time: The time at which the restorable database account has been deleted
(ISO-8601 format).
:vartype deletion_time: ~datetime.datetime
:ivar api_type: The API type of the restorable database account. Known values are: "MongoDB",
"Gremlin", "Cassandra", "Table", "Sql", and "GremlinV2".
:vartype api_type: str or ~azure.mgmt.cosmosdb.models.ApiType
:ivar restorable_locations: List of regions where the of the database account can be restored
from.
:vartype restorable_locations: list[~azure.mgmt.cosmosdb.models.RestorableLocationResource]
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"api_type": {"readonly": True},
"restorable_locations": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"location": {"key": "location", "type": "str"},
"account_name": {"key": "properties.accountName", "type": "str"},
"creation_time": {"key": "properties.creationTime", "type": "iso-8601"},
"oldest_restorable_time": {"key": "properties.oldestRestorableTime", "type": "iso-8601"},
"deletion_time": {"key": "properties.deletionTime", "type": "iso-8601"},
"api_type": {"key": "properties.apiType", "type": "str"},
"restorable_locations": {"key": "properties.restorableLocations", "type": "[RestorableLocationResource]"},
}
def __init__(
self,
*,
location: Optional[str] = None,
account_name: Optional[str] = None,
creation_time: Optional[datetime.datetime] = None,
oldest_restorable_time: Optional[datetime.datetime] = None,
deletion_time: Optional[datetime.datetime] = None,
**kwargs: Any
) -> None:
"""
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword account_name: The name of the global database account.
:paramtype account_name: str
:keyword creation_time: The creation time of the restorable database account (ISO-8601 format).
:paramtype creation_time: ~datetime.datetime
:keyword oldest_restorable_time: The least recent time at which the database account can be
restored to (ISO-8601 format).
:paramtype oldest_restorable_time: ~datetime.datetime
:keyword deletion_time: The time at which the restorable database account has been deleted
(ISO-8601 format).
:paramtype deletion_time: ~datetime.datetime
"""
super().__init__(**kwargs)
self.id = None
self.name = None
self.type = None
self.location = location
self.account_name = account_name
self.creation_time = creation_time
self.oldest_restorable_time = oldest_restorable_time
self.deletion_time = deletion_time
self.api_type = None
self.restorable_locations = None
|
class RestorableDatabaseAccountGetResult(_serialization.Model):
'''A Azure Cosmos DB restorable database account.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar location: The location of the resource group to which the resource belongs.
:vartype location: str
:ivar account_name: The name of the global database account.
:vartype account_name: str
:ivar creation_time: The creation time of the restorable database account (ISO-8601 format).
:vartype creation_time: ~datetime.datetime
:ivar oldest_restorable_time: The least recent time at which the database account can be
restored to (ISO-8601 format).
:vartype oldest_restorable_time: ~datetime.datetime
:ivar deletion_time: The time at which the restorable database account has been deleted
(ISO-8601 format).
:vartype deletion_time: ~datetime.datetime
:ivar api_type: The API type of the restorable database account. Known values are: "MongoDB",
"Gremlin", "Cassandra", "Table", "Sql", and "GremlinV2".
:vartype api_type: str or ~azure.mgmt.cosmosdb.models.ApiType
:ivar restorable_locations: List of regions where the of the database account can be restored
from.
:vartype restorable_locations: list[~azure.mgmt.cosmosdb.models.RestorableLocationResource]
'''
def __init__(
self,
*,
location: Optional[str] = None,
account_name: Optional[str] = None,
creation_time: Optional[datetime.datetime] = None,
oldest_restorable_time: Optional[datetime.datetime] = None,
deletion_time: Optional[datetime.datetime] = None,
**kwargs: Any
) -> None:
'''
:keyword location: The location of the resource group to which the resource belongs.
:paramtype location: str
:keyword account_name: The name of the global database account.
:paramtype account_name: str
:keyword creation_time: The creation time of the restorable database account (ISO-8601 format).
:paramtype creation_time: ~datetime.datetime
:keyword oldest_restorable_time: The least recent time at which the database account can be
restored to (ISO-8601 format).
:paramtype oldest_restorable_time: ~datetime.datetime
:keyword deletion_time: The time at which the restorable database account has been deleted
(ISO-8601 format).
:paramtype deletion_time: ~datetime.datetime
'''
pass
| 2 | 2 | 35 | 0 | 21 | 14 | 1 | 1 | 1 | 4 | 0 | 0 | 1 | 10 | 1 | 16 | 87 | 5 | 41 | 23 | 30 | 41 | 15 | 14 | 13 | 1 | 2 | 0 | 1 |
10,590 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.RestorableDatabaseAccountsListResult
|
class RestorableDatabaseAccountsListResult(_serialization.Model):
"""The List operation response, that contains the restorable database accounts and their
properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of restorable database accounts and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult]
"""
_validation = {
"value": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[RestorableDatabaseAccountGetResult]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
|
class RestorableDatabaseAccountsListResult(_serialization.Model):
'''The List operation response, that contains the restorable database accounts and their
properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of restorable database accounts and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult]
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 4 | 0 | 3 | 1 | 1 | 0.7 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 16 | 22 | 5 | 10 | 5 | 8 | 7 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,591 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.RestorableGremlinDatabaseGetResult
|
class RestorableGremlinDatabaseGetResult(_serialization.Model):
"""An Azure Cosmos DB Gremlin database event.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource Identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar resource: The resource of an Azure Cosmos DB Gremlin database event.
:vartype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinDatabasePropertiesResource
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"resource": {"key": "properties.resource", "type": "RestorableGremlinDatabasePropertiesResource"},
}
def __init__(
self, *, resource: Optional["_models.RestorableGremlinDatabasePropertiesResource"] = None, **kwargs: Any
) -> None:
"""
:keyword resource: The resource of an Azure Cosmos DB Gremlin database event.
:paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinDatabasePropertiesResource
"""
super().__init__(**kwargs)
self.id = None
self.name = None
self.type = None
self.resource = resource
|
class RestorableGremlinDatabaseGetResult(_serialization.Model):
'''An Azure Cosmos DB Gremlin database event.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource Identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar resource: The resource of an Azure Cosmos DB Gremlin database event.
:vartype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinDatabasePropertiesResource
'''
def __init__(
self, *, resource: Optional["_models.RestorableGremlinDatabasePropertiesResource"] = None, **kwargs: Any
) -> None:
'''
:keyword resource: The resource of an Azure Cosmos DB Gremlin database event.
:paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinDatabasePropertiesResource
'''
pass
| 2 | 2 | 12 | 0 | 8 | 4 | 1 | 0.75 | 1 | 2 | 0 | 0 | 1 | 4 | 1 | 16 | 40 | 5 | 20 | 10 | 16 | 15 | 9 | 8 | 7 | 1 | 2 | 0 | 1 |
10,592 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.RestorableGremlinDatabasePropertiesResource
|
class RestorableGremlinDatabasePropertiesResource(_serialization.Model): # pylint: disable=name-too-long
"""The resource of an Azure Cosmos DB Gremlin database event.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar rid: A system generated property. A unique identifier.
:vartype rid: str
:ivar operation_type: The operation type of this database event. Known values are: "Create",
"Replace", "Delete", "Recreate", and "SystemOperation".
:vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType
:ivar can_undelete: A state of this database to identify if this database is restorable in same
account.
:vartype can_undelete: str
:ivar can_undelete_reason: The reason why this database can not be restored in same account.
:vartype can_undelete_reason: str
:ivar event_timestamp: The time when this database event happened.
:vartype event_timestamp: str
:ivar owner_id: The name of this Gremlin database.
:vartype owner_id: str
:ivar owner_resource_id: The resource ID of this Gremlin database.
:vartype owner_resource_id: str
"""
_validation = {
"rid": {"readonly": True},
"operation_type": {"readonly": True},
"can_undelete": {"readonly": True},
"can_undelete_reason": {"readonly": True},
"event_timestamp": {"readonly": True},
"owner_id": {"readonly": True},
"owner_resource_id": {"readonly": True},
}
_attribute_map = {
"rid": {"key": "_rid", "type": "str"},
"operation_type": {"key": "operationType", "type": "str"},
"can_undelete": {"key": "canUndelete", "type": "str"},
"can_undelete_reason": {"key": "canUndeleteReason", "type": "str"},
"event_timestamp": {"key": "eventTimestamp", "type": "str"},
"owner_id": {"key": "ownerId", "type": "str"},
"owner_resource_id": {"key": "ownerResourceId", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.rid = None
self.operation_type = None
self.can_undelete = None
self.can_undelete_reason = None
self.event_timestamp = None
self.owner_id = None
self.owner_resource_id = None
|
class RestorableGremlinDatabasePropertiesResource(_serialization.Model):
'''The resource of an Azure Cosmos DB Gremlin database event.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar rid: A system generated property. A unique identifier.
:vartype rid: str
:ivar operation_type: The operation type of this database event. Known values are: "Create",
"Replace", "Delete", "Recreate", and "SystemOperation".
:vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType
:ivar can_undelete: A state of this database to identify if this database is restorable in same
account.
:vartype can_undelete: str
:ivar can_undelete_reason: The reason why this database can not be restored in same account.
:vartype can_undelete_reason: str
:ivar event_timestamp: The time when this database event happened.
:vartype event_timestamp: str
:ivar owner_id: The name of this Gremlin database.
:vartype owner_id: str
:ivar owner_resource_id: The resource ID of this Gremlin database.
:vartype owner_resource_id: str
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 10 | 0 | 9 | 1 | 1 | 0.75 | 1 | 2 | 0 | 0 | 1 | 7 | 1 | 16 | 53 | 5 | 28 | 11 | 26 | 21 | 12 | 11 | 10 | 1 | 2 | 0 | 1 |
10,593 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.RestorableGremlinDatabasesListResult
|
class RestorableGremlinDatabasesListResult(_serialization.Model):
"""The List operation response, that contains the Gremlin database events and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of Gremlin database events and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.RestorableGremlinDatabaseGetResult]
"""
_validation = {
"value": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[RestorableGremlinDatabaseGetResult]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
|
class RestorableGremlinDatabasesListResult(_serialization.Model):
'''The List operation response, that contains the Gremlin database events and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of Gremlin database events and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.RestorableGremlinDatabaseGetResult]
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 4 | 0 | 3 | 1 | 1 | 0.6 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 16 | 21 | 5 | 10 | 5 | 8 | 6 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,594 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.RestorableGremlinGraphGetResult
|
class RestorableGremlinGraphGetResult(_serialization.Model):
"""An Azure Cosmos DB Gremlin graph event.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource Identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar resource: The resource of an Azure Cosmos DB Gremlin graph event.
:vartype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinGraphPropertiesResource
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"resource": {"key": "properties.resource", "type": "RestorableGremlinGraphPropertiesResource"},
}
def __init__(
self, *, resource: Optional["_models.RestorableGremlinGraphPropertiesResource"] = None, **kwargs: Any
) -> None:
"""
:keyword resource: The resource of an Azure Cosmos DB Gremlin graph event.
:paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinGraphPropertiesResource
"""
super().__init__(**kwargs)
self.id = None
self.name = None
self.type = None
self.resource = resource
|
class RestorableGremlinGraphGetResult(_serialization.Model):
'''An Azure Cosmos DB Gremlin graph event.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource Identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar resource: The resource of an Azure Cosmos DB Gremlin graph event.
:vartype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinGraphPropertiesResource
'''
def __init__(
self, *, resource: Optional["_models.RestorableGremlinGraphPropertiesResource"] = None, **kwargs: Any
) -> None:
'''
:keyword resource: The resource of an Azure Cosmos DB Gremlin graph event.
:paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinGraphPropertiesResource
'''
pass
| 2 | 2 | 12 | 0 | 8 | 4 | 1 | 0.75 | 1 | 2 | 0 | 0 | 1 | 4 | 1 | 16 | 40 | 5 | 20 | 10 | 16 | 15 | 9 | 8 | 7 | 1 | 2 | 0 | 1 |
10,595 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.RestorableGremlinGraphPropertiesResource
|
class RestorableGremlinGraphPropertiesResource(_serialization.Model):
"""The resource of an Azure Cosmos DB Gremlin graph event.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar rid: A system generated property. A unique identifier.
:vartype rid: str
:ivar operation_type: The operation type of this graph event. Known values are: "Create",
"Replace", "Delete", "Recreate", and "SystemOperation".
:vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType
:ivar can_undelete: A state of this graph to identify if this graph is restorable in same
account.
:vartype can_undelete: str
:ivar can_undelete_reason: The reason why this graph can not be restored in same account.
:vartype can_undelete_reason: str
:ivar event_timestamp: The time when this graph event happened.
:vartype event_timestamp: str
:ivar owner_id: The name of this Gremlin graph.
:vartype owner_id: str
:ivar owner_resource_id: The resource ID of this Gremlin graph.
:vartype owner_resource_id: str
"""
_validation = {
"rid": {"readonly": True},
"operation_type": {"readonly": True},
"can_undelete": {"readonly": True},
"can_undelete_reason": {"readonly": True},
"event_timestamp": {"readonly": True},
"owner_id": {"readonly": True},
"owner_resource_id": {"readonly": True},
}
_attribute_map = {
"rid": {"key": "_rid", "type": "str"},
"operation_type": {"key": "operationType", "type": "str"},
"can_undelete": {"key": "canUndelete", "type": "str"},
"can_undelete_reason": {"key": "canUndeleteReason", "type": "str"},
"event_timestamp": {"key": "eventTimestamp", "type": "str"},
"owner_id": {"key": "ownerId", "type": "str"},
"owner_resource_id": {"key": "ownerResourceId", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.rid = None
self.operation_type = None
self.can_undelete = None
self.can_undelete_reason = None
self.event_timestamp = None
self.owner_id = None
self.owner_resource_id = None
|
class RestorableGremlinGraphPropertiesResource(_serialization.Model):
'''The resource of an Azure Cosmos DB Gremlin graph event.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar rid: A system generated property. A unique identifier.
:vartype rid: str
:ivar operation_type: The operation type of this graph event. Known values are: "Create",
"Replace", "Delete", "Recreate", and "SystemOperation".
:vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType
:ivar can_undelete: A state of this graph to identify if this graph is restorable in same
account.
:vartype can_undelete: str
:ivar can_undelete_reason: The reason why this graph can not be restored in same account.
:vartype can_undelete_reason: str
:ivar event_timestamp: The time when this graph event happened.
:vartype event_timestamp: str
:ivar owner_id: The name of this Gremlin graph.
:vartype owner_id: str
:ivar owner_resource_id: The resource ID of this Gremlin graph.
:vartype owner_resource_id: str
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 10 | 0 | 9 | 1 | 1 | 0.71 | 1 | 2 | 0 | 0 | 1 | 7 | 1 | 16 | 53 | 5 | 28 | 11 | 26 | 20 | 12 | 11 | 10 | 1 | 2 | 0 | 1 |
10,596 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.RestorableGremlinGraphsListResult
|
class RestorableGremlinGraphsListResult(_serialization.Model):
"""The List operation response, that contains the Gremlin graph events and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of Gremlin graph events and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.RestorableGremlinGraphGetResult]
"""
_validation = {
"value": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[RestorableGremlinGraphGetResult]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
|
class RestorableGremlinGraphsListResult(_serialization.Model):
'''The List operation response, that contains the Gremlin graph events and their properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of Gremlin graph events and their properties.
:vartype value: list[~azure.mgmt.cosmosdb.models.RestorableGremlinGraphGetResult]
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 4 | 0 | 3 | 1 | 1 | 0.6 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 16 | 21 | 5 | 10 | 5 | 8 | 6 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,597 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.RestorableGremlinResourcesGetResult
|
class RestorableGremlinResourcesGetResult(_serialization.Model):
"""Specific Databases to restore.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar database_name: The name of the gremlin database available for restore.
:vartype database_name: str
:ivar graph_names: The names of the graphs available for restore.
:vartype graph_names: list[str]
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"database_name": {"key": "databaseName", "type": "str"},
"graph_names": {"key": "graphNames", "type": "[str]"},
}
def __init__(
self, *, database_name: Optional[str] = None, graph_names: Optional[List[str]] = None, **kwargs: Any
) -> None:
"""
:keyword database_name: The name of the gremlin database available for restore.
:paramtype database_name: str
:keyword graph_names: The names of the graphs available for restore.
:paramtype graph_names: list[str]
"""
super().__init__(**kwargs)
self.id = None
self.name = None
self.type = None
self.database_name = database_name
self.graph_names = graph_names
|
class RestorableGremlinResourcesGetResult(_serialization.Model):
'''Specific Databases to restore.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The unique resource identifier of the ARM resource.
:vartype id: str
:ivar name: The name of the ARM resource.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:ivar database_name: The name of the gremlin database available for restore.
:vartype database_name: str
:ivar graph_names: The names of the graphs available for restore.
:vartype graph_names: list[str]
'''
def __init__(
self, *, database_name: Optional[str] = None, graph_names: Optional[List[str]] = None, **kwargs: Any
) -> None:
'''
:keyword database_name: The name of the gremlin database available for restore.
:paramtype database_name: str
:keyword graph_names: The names of the graphs available for restore.
:paramtype graph_names: list[str]
'''
pass
| 2 | 2 | 15 | 0 | 9 | 6 | 1 | 0.86 | 1 | 3 | 0 | 0 | 1 | 5 | 1 | 16 | 46 | 5 | 22 | 11 | 18 | 19 | 10 | 9 | 8 | 1 | 2 | 0 | 1 |
10,598 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.RestorableGremlinResourcesListResult
|
class RestorableGremlinResourcesListResult(_serialization.Model):
"""The List operation response, that contains the restorable Gremlin resources.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of restorable Gremlin resources, including the gremlin database and graph
names.
:vartype value: list[~azure.mgmt.cosmosdb.models.RestorableGremlinResourcesGetResult]
"""
_validation = {
"value": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[RestorableGremlinResourcesGetResult]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
|
class RestorableGremlinResourcesListResult(_serialization.Model):
'''The List operation response, that contains the restorable Gremlin resources.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of restorable Gremlin resources, including the gremlin database and graph
names.
:vartype value: list[~azure.mgmt.cosmosdb.models.RestorableGremlinResourcesGetResult]
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 4 | 0 | 3 | 1 | 1 | 0.7 | 1 | 2 | 0 | 0 | 1 | 1 | 1 | 16 | 22 | 5 | 10 | 5 | 8 | 7 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
10,599 |
Azure/azure-cli-extensions
|
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/_models_py3.py
|
azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models._models_py3.RestorableLocationResource
|
class RestorableLocationResource(_serialization.Model):
"""Properties of the regional restorable account.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar location_name: The location of the regional restorable account.
:vartype location_name: str
:ivar regional_database_account_instance_id: The instance id of the regional restorable
account.
:vartype regional_database_account_instance_id: str
:ivar creation_time: The creation time of the regional restorable database account (ISO-8601
format).
:vartype creation_time: ~datetime.datetime
:ivar deletion_time: The time at which the regional restorable database account has been
deleted (ISO-8601 format).
:vartype deletion_time: ~datetime.datetime
"""
_validation = {
"location_name": {"readonly": True},
"regional_database_account_instance_id": {"readonly": True},
"creation_time": {"readonly": True},
"deletion_time": {"readonly": True},
}
_attribute_map = {
"location_name": {"key": "locationName", "type": "str"},
"regional_database_account_instance_id": {"key": "regionalDatabaseAccountInstanceId", "type": "str"},
"creation_time": {"key": "creationTime", "type": "iso-8601"},
"deletion_time": {"key": "deletionTime", "type": "iso-8601"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.location_name = None
self.regional_database_account_instance_id = None
self.creation_time = None
self.deletion_time = None
|
class RestorableLocationResource(_serialization.Model):
'''Properties of the regional restorable account.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar location_name: The location of the regional restorable account.
:vartype location_name: str
:ivar regional_database_account_instance_id: The instance id of the regional restorable
account.
:vartype regional_database_account_instance_id: str
:ivar creation_time: The creation time of the regional restorable database account (ISO-8601
format).
:vartype creation_time: ~datetime.datetime
:ivar deletion_time: The time at which the regional restorable database account has been
deleted (ISO-8601 format).
:vartype deletion_time: ~datetime.datetime
'''
def __init__(self, **kwargs: Any) -> None:
''' '''
pass
| 2 | 2 | 7 | 0 | 6 | 1 | 1 | 0.79 | 1 | 2 | 0 | 0 | 1 | 4 | 1 | 16 | 39 | 5 | 19 | 8 | 17 | 15 | 9 | 8 | 7 | 1 | 2 | 0 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.