From 216a73e73cd6d740d3250fce1ace6b8b59685146 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 16 Nov 2020 02:52:26 +0000 Subject: [PATCH] CodeGen from PR 11678 in Azure/azure-rest-api-specs Amend error response to indicate that we return additional error info. (#11678) --- .../_app_configuration_management_client.py | 7 +- .../mgmt/appconfiguration/models/__init__.py | 32 +- .../mgmt/appconfiguration/models/_models.py | 289 ++++++++++++--- .../appconfiguration/models/_models_py3.py | 299 ++++++++++++--- .../appconfiguration/models/_paged_models.py | 13 + .../appconfiguration/operations/__init__.py | 2 + .../_configuration_stores_operations.py | 111 +----- .../operations/_key_values_operations.py | 345 ++++++++++++++++++ .../operations/_operations.py | 12 +- ...private_endpoint_connections_operations.py | 20 +- .../_private_link_resources_operations.py | 12 +- 11 files changed, 907 insertions(+), 235 deletions(-) create mode 100644 sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_key_values_operations.py diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py index e87b243ceb8d..848eacfa137c 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py @@ -17,6 +17,7 @@ from .operations import Operations from .operations import PrivateEndpointConnectionsOperations from .operations import PrivateLinkResourcesOperations +from .operations import KeyValuesOperations from . import models @@ -34,6 +35,8 @@ class AppConfigurationManagementClient(SDKClient): :vartype private_endpoint_connections: azure.mgmt.appconfiguration.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResources operations :vartype private_link_resources: azure.mgmt.appconfiguration.operations.PrivateLinkResourcesOperations + :ivar key_values: KeyValues operations + :vartype key_values: azure.mgmt.appconfiguration.operations.KeyValuesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -50,7 +53,7 @@ def __init__( super(AppConfigurationManagementClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2020-06-01' + self.api_version = '2020-07-01-preview' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) @@ -62,3 +65,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self.config, self._serialize, self._deserialize) + self.key_values = KeyValuesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/__init__.py index 8f670de6be62..4b59905a7b48 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/__init__.py @@ -15,13 +15,18 @@ from ._models_py3 import ConfigurationStore from ._models_py3 import ConfigurationStoreUpdateParameters from ._models_py3 import EncryptionProperties - from ._models_py3 import Error, ErrorException + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetails + from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import KeyValue from ._models_py3 import KeyVaultProperties - from ._models_py3 import ListKeyValueParameters + from ._models_py3 import LogSpecification + from ._models_py3 import MetricDimension + from ._models_py3 import MetricSpecification from ._models_py3 import NameAvailabilityStatus from ._models_py3 import OperationDefinition from ._models_py3 import OperationDefinitionDisplay + from ._models_py3 import OperationProperties from ._models_py3 import PrivateEndpoint from ._models_py3 import PrivateEndpointConnection from ._models_py3 import PrivateEndpointConnectionReference @@ -30,6 +35,7 @@ from ._models_py3 import RegenerateKeyParameters from ._models_py3 import Resource from ._models_py3 import ResourceIdentity + from ._models_py3 import ServiceSpecification from ._models_py3 import Sku from ._models_py3 import UserIdentity except (SyntaxError, ImportError): @@ -38,13 +44,18 @@ from ._models import ConfigurationStore from ._models import ConfigurationStoreUpdateParameters from ._models import EncryptionProperties - from ._models import Error, ErrorException + from ._models import ErrorAdditionalInfo + from ._models import ErrorDetails + from ._models import ErrorResponse, ErrorResponseException from ._models import KeyValue from ._models import KeyVaultProperties - from ._models import ListKeyValueParameters + from ._models import LogSpecification + from ._models import MetricDimension + from ._models import MetricSpecification from ._models import NameAvailabilityStatus from ._models import OperationDefinition from ._models import OperationDefinitionDisplay + from ._models import OperationProperties from ._models import PrivateEndpoint from ._models import PrivateEndpointConnection from ._models import PrivateEndpointConnectionReference @@ -53,10 +64,12 @@ from ._models import RegenerateKeyParameters from ._models import Resource from ._models import ResourceIdentity + from ._models import ServiceSpecification from ._models import Sku from ._models import UserIdentity from ._paged_models import ApiKeyPaged from ._paged_models import ConfigurationStorePaged +from ._paged_models import KeyValuePaged from ._paged_models import OperationDefinitionPaged from ._paged_models import PrivateEndpointConnectionPaged from ._paged_models import PrivateLinkResourcePaged @@ -74,13 +87,18 @@ 'ConfigurationStore', 'ConfigurationStoreUpdateParameters', 'EncryptionProperties', - 'Error', 'ErrorException', + 'ErrorAdditionalInfo', + 'ErrorDetails', + 'ErrorResponse', 'ErrorResponseException', 'KeyValue', 'KeyVaultProperties', - 'ListKeyValueParameters', + 'LogSpecification', + 'MetricDimension', + 'MetricSpecification', 'NameAvailabilityStatus', 'OperationDefinition', 'OperationDefinitionDisplay', + 'OperationProperties', 'PrivateEndpoint', 'PrivateEndpointConnection', 'PrivateEndpointConnectionReference', @@ -89,6 +107,7 @@ 'RegenerateKeyParameters', 'Resource', 'ResourceIdentity', + 'ServiceSpecification', 'Sku', 'UserIdentity', 'ConfigurationStorePaged', @@ -96,6 +115,7 @@ 'OperationDefinitionPaged', 'PrivateEndpointConnectionPaged', 'PrivateLinkResourcePaged', + 'KeyValuePaged', 'IdentityType', 'ProvisioningState', 'ConnectionStatus', diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models.py index 4c892b7a7a3c..49d0f13d17db 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models.py @@ -241,11 +241,6 @@ class ConfigurationStoreUpdateParameters(Model): :param encryption: The encryption settings of the configuration store. :type encryption: ~azure.mgmt.appconfiguration.models.EncryptionProperties - :param public_network_access: Control permission for data plane traffic - coming from public networks while private endpoint is enabled. Possible - values include: 'Enabled', 'Disabled' - :type public_network_access: str or - ~azure.mgmt.appconfiguration.models.PublicNetworkAccess :param identity: The managed identity information for the configuration store. :type identity: ~azure.mgmt.appconfiguration.models.ResourceIdentity @@ -257,7 +252,6 @@ class ConfigurationStoreUpdateParameters(Model): _attribute_map = { 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, 'sku': {'key': 'sku', 'type': 'Sku'}, 'tags': {'key': 'tags', 'type': '{str}'}, @@ -266,7 +260,6 @@ class ConfigurationStoreUpdateParameters(Model): def __init__(self, **kwargs): super(ConfigurationStoreUpdateParameters, self).__init__(**kwargs) self.encryption = kwargs.get('encryption', None) - self.public_network_access = kwargs.get('public_network_access', None) self.identity = kwargs.get('identity', None) self.sku = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -289,28 +282,87 @@ def __init__(self, **kwargs): self.key_vault_properties = kwargs.get('key_vault_properties', None) -class Error(Model): - """AppConfiguration error object. +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetails(Model): + """The details of the error. + + Variables are only populated by the server, and will be ignored when + sending a request. - :param code: Error code. - :type code: str - :param message: Error message. - :type message: str + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.appconfiguration.models.ErrorAdditionalInfo] """ + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.message = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response indicates that the service is not able to process the + incoming request. The reason is provided in the error message. + + :param error: The details of the error. + :type error: ~azure.mgmt.appconfiguration.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, } def __init__(self, **kwargs): - super(Error, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) -class ErrorException(HttpOperationError): - """Server responsed with exception of type: 'Error'. +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. :param deserialize: A deserializer :param response: Server response to be deserialized. @@ -318,28 +370,33 @@ class ErrorException(HttpOperationError): def __init__(self, deserialize, response, *args): - super(ErrorException, self).__init__(deserialize, response, 'Error', *args) + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) class KeyValue(Model): - """The result of a request to retrieve a key-value from the specified - configuration store. + """The key-value resource along with all resource properties. Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str :ivar key: The primary identifier of a key-value. The key is used in unison with the label to uniquely identify a key-value. :vartype key: str :ivar label: A value used to group key-values. The label is used in unison with the key to uniquely identify a key-value. :vartype label: str - :ivar value: The value of the key-value. - :vartype value: str - :ivar content_type: The content type of the key-value's value. + :param value: The value of the key-value. + :type value: str + :param content_type: The content type of the key-value's value. Providing a proper content-type can enable transformations of values when they are retrieved by applications. - :vartype content_type: str + :type content_type: str :ivar e_tag: An ETag indicating the state of a key-value within a configuration store. :vartype e_tag: str @@ -349,43 +406,49 @@ class KeyValue(Model): :ivar locked: A value indicating whether the key-value is locked. A locked key-value may not be modified until it is unlocked. :vartype locked: bool - :ivar tags: A dictionary of tags that can help identify what a key-value + :param tags: A dictionary of tags that can help identify what a key-value may be applicable for. - :vartype tags: dict[str, str] + :type tags: dict[str, str] """ _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, 'key': {'readonly': True}, 'label': {'readonly': True}, - 'value': {'readonly': True}, - 'content_type': {'readonly': True}, 'e_tag': {'readonly': True}, 'last_modified': {'readonly': True}, 'locked': {'readonly': True}, - 'tags': {'readonly': True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, - 'locked': {'key': 'locked', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'key': {'key': 'properties.key', 'type': 'str'}, + 'label': {'key': 'properties.label', 'type': 'str'}, + 'value': {'key': 'properties.value', 'type': 'str'}, + 'content_type': {'key': 'properties.contentType', 'type': 'str'}, + 'e_tag': {'key': 'properties.eTag', 'type': 'str'}, + 'last_modified': {'key': 'properties.lastModified', 'type': 'iso-8601'}, + 'locked': {'key': 'properties.locked', 'type': 'bool'}, + 'tags': {'key': 'properties.tags', 'type': '{str}'}, } def __init__(self, **kwargs): super(KeyValue, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None self.key = None self.label = None - self.value = None - self.content_type = None + self.value = kwargs.get('value', None) + self.content_type = kwargs.get('content_type', None) self.e_tag = None self.last_modified = None self.locked = None - self.tags = None + self.tags = kwargs.get('tags', None) class KeyVaultProperties(Model): @@ -409,30 +472,94 @@ def __init__(self, **kwargs): self.identity_client_id = kwargs.get('identity_client_id', None) -class ListKeyValueParameters(Model): - """The parameters used to list a configuration store key-value. +class LogSpecification(Model): + """Specifications of the Log for Azure Monitoring. - All required parameters must be populated in order to send to Azure. + :param name: Name of the log + :type name: str + :param display_name: Localized friendly display name of the log + :type display_name: str + :param blob_duration: Blob duration of the log + :type blob_duration: str + """ - :param key: Required. The key to retrieve. - :type key: str - :param label: The label of the key. - :type label: str + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LogSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.blob_duration = kwargs.get('blob_duration', None) + + +class MetricDimension(Model): + """Specifications of the Dimension of metrics. + + :param name: Name of the dimension + :type name: str + :param display_name: Localized friendly display name of the dimension + :type display_name: str + :param internal_name: Internal name of the dimension. + :type internal_name: str """ - _validation = { - 'key': {'required': True}, + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'internal_name': {'key': 'internalName', 'type': 'str'}, } + def __init__(self, **kwargs): + super(MetricDimension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.internal_name = kwargs.get('internal_name', None) + + +class MetricSpecification(Model): + """Specifications of the Metrics for Azure Monitoring. + + :param name: Name of the metric + :type name: str + :param display_name: Localized friendly display name of the metric + :type display_name: str + :param display_description: Localized friendly description of the metric + :type display_description: str + :param unit: Unit that makes sense for the metric + :type unit: str + :param aggregation_type: Only provide one value for this field. Valid + values: Average, Minimum, Maximum, Total, Count. + :type aggregation_type: str + :param internal_metric_name: Internal metric name. + :type internal_metric_name: str + :param dimensions: Dimensions of the metric + :type dimensions: + list[~azure.mgmt.appconfiguration.models.MetricDimension] + """ + _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, } def __init__(self, **kwargs): - super(ListKeyValueParameters, self).__init__(**kwargs) - self.key = kwargs.get('key', None) - self.label = kwargs.get('label', None) + super(MetricSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.display_description = kwargs.get('display_description', None) + self.unit = kwargs.get('unit', None) + self.aggregation_type = kwargs.get('aggregation_type', None) + self.internal_metric_name = kwargs.get('internal_metric_name', None) + self.dimensions = kwargs.get('dimensions', None) class NameAvailabilityStatus(Model): @@ -475,21 +602,33 @@ class OperationDefinition(Model): :param name: Operation name: {provider}/{resource}/{operation}. :type name: str + :param is_data_action: Indicates whether the operation is a data action + :type is_data_action: bool :param display: The display information for the configuration store operation. :type display: ~azure.mgmt.appconfiguration.models.OperationDefinitionDisplay + :param origin: Origin of the operation + :type origin: str + :param properties: Properties of the operation + :type properties: ~azure.mgmt.appconfiguration.models.OperationProperties """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDefinitionDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } def __init__(self, **kwargs): super(OperationDefinition, self).__init__(**kwargs) self.name = kwargs.get('name', None) + self.is_data_action = kwargs.get('is_data_action', None) self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + self.properties = kwargs.get('properties', None) class OperationDefinitionDisplay(Model): @@ -527,6 +666,23 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) +class OperationProperties(Model): + """Extra Operation properties. + + :param service_specification: Service specifications of the operation + :type service_specification: + ~azure.mgmt.appconfiguration.models.ServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__(self, **kwargs): + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = kwargs.get('service_specification', None) + + class PrivateEndpoint(Model): """Private endpoint which a connection belongs to. @@ -800,6 +956,29 @@ def __init__(self, **kwargs): self.tenant_id = None +class ServiceSpecification(Model): + """Service specification payload. + + :param log_specifications: Specifications of the Log for Azure Monitoring + :type log_specifications: + list[~azure.mgmt.appconfiguration.models.LogSpecification] + :param metric_specifications: Specifications of the Metrics for Azure + Monitoring + :type metric_specifications: + list[~azure.mgmt.appconfiguration.models.MetricSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__(self, **kwargs): + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = kwargs.get('log_specifications', None) + self.metric_specifications = kwargs.get('metric_specifications', None) + + class Sku(Model): """Describes a configuration store SKU. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models_py3.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models_py3.py index 15213ffa3a2d..1320127e0985 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models_py3.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models_py3.py @@ -241,11 +241,6 @@ class ConfigurationStoreUpdateParameters(Model): :param encryption: The encryption settings of the configuration store. :type encryption: ~azure.mgmt.appconfiguration.models.EncryptionProperties - :param public_network_access: Control permission for data plane traffic - coming from public networks while private endpoint is enabled. Possible - values include: 'Enabled', 'Disabled' - :type public_network_access: str or - ~azure.mgmt.appconfiguration.models.PublicNetworkAccess :param identity: The managed identity information for the configuration store. :type identity: ~azure.mgmt.appconfiguration.models.ResourceIdentity @@ -257,16 +252,14 @@ class ConfigurationStoreUpdateParameters(Model): _attribute_map = { 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, 'sku': {'key': 'sku', 'type': 'Sku'}, 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, encryption=None, public_network_access=None, identity=None, sku=None, tags=None, **kwargs) -> None: + def __init__(self, *, encryption=None, identity=None, sku=None, tags=None, **kwargs) -> None: super(ConfigurationStoreUpdateParameters, self).__init__(**kwargs) self.encryption = encryption - self.public_network_access = public_network_access self.identity = identity self.sku = sku self.tags = tags @@ -289,28 +282,87 @@ def __init__(self, *, key_vault_properties=None, **kwargs) -> None: self.key_vault_properties = key_vault_properties -class Error(Model): - """AppConfiguration error object. +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetails(Model): + """The details of the error. + + Variables are only populated by the server, and will be ignored when + sending a request. - :param code: Error code. - :type code: str - :param message: Error message. - :type message: str + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.appconfiguration.models.ErrorAdditionalInfo] """ + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } - def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: - super(Error, self).__init__(**kwargs) - self.code = code - self.message = message + def __init__(self, **kwargs) -> None: + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.message = None + self.additional_info = None -class ErrorException(HttpOperationError): - """Server responsed with exception of type: 'Error'. +class ErrorResponse(Model): + """Error response indicates that the service is not able to process the + incoming request. The reason is provided in the error message. + + :param error: The details of the error. + :type error: ~azure.mgmt.appconfiguration.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. :param deserialize: A deserializer :param response: Server response to be deserialized. @@ -318,28 +370,33 @@ class ErrorException(HttpOperationError): def __init__(self, deserialize, response, *args): - super(ErrorException, self).__init__(deserialize, response, 'Error', *args) + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) class KeyValue(Model): - """The result of a request to retrieve a key-value from the specified - configuration store. + """The key-value resource along with all resource properties. Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str :ivar key: The primary identifier of a key-value. The key is used in unison with the label to uniquely identify a key-value. :vartype key: str :ivar label: A value used to group key-values. The label is used in unison with the key to uniquely identify a key-value. :vartype label: str - :ivar value: The value of the key-value. - :vartype value: str - :ivar content_type: The content type of the key-value's value. + :param value: The value of the key-value. + :type value: str + :param content_type: The content type of the key-value's value. Providing a proper content-type can enable transformations of values when they are retrieved by applications. - :vartype content_type: str + :type content_type: str :ivar e_tag: An ETag indicating the state of a key-value within a configuration store. :vartype e_tag: str @@ -349,43 +406,49 @@ class KeyValue(Model): :ivar locked: A value indicating whether the key-value is locked. A locked key-value may not be modified until it is unlocked. :vartype locked: bool - :ivar tags: A dictionary of tags that can help identify what a key-value + :param tags: A dictionary of tags that can help identify what a key-value may be applicable for. - :vartype tags: dict[str, str] + :type tags: dict[str, str] """ _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, 'key': {'readonly': True}, 'label': {'readonly': True}, - 'value': {'readonly': True}, - 'content_type': {'readonly': True}, 'e_tag': {'readonly': True}, 'last_modified': {'readonly': True}, 'locked': {'readonly': True}, - 'tags': {'readonly': True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, - 'locked': {'key': 'locked', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'key': {'key': 'properties.key', 'type': 'str'}, + 'label': {'key': 'properties.label', 'type': 'str'}, + 'value': {'key': 'properties.value', 'type': 'str'}, + 'content_type': {'key': 'properties.contentType', 'type': 'str'}, + 'e_tag': {'key': 'properties.eTag', 'type': 'str'}, + 'last_modified': {'key': 'properties.lastModified', 'type': 'iso-8601'}, + 'locked': {'key': 'properties.locked', 'type': 'bool'}, + 'tags': {'key': 'properties.tags', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: + def __init__(self, *, value: str=None, content_type: str=None, tags=None, **kwargs) -> None: super(KeyValue, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None self.key = None self.label = None - self.value = None - self.content_type = None + self.value = value + self.content_type = content_type self.e_tag = None self.last_modified = None self.locked = None - self.tags = None + self.tags = tags class KeyVaultProperties(Model): @@ -409,30 +472,94 @@ def __init__(self, *, key_identifier: str=None, identity_client_id: str=None, ** self.identity_client_id = identity_client_id -class ListKeyValueParameters(Model): - """The parameters used to list a configuration store key-value. +class LogSpecification(Model): + """Specifications of the Log for Azure Monitoring. - All required parameters must be populated in order to send to Azure. + :param name: Name of the log + :type name: str + :param display_name: Localized friendly display name of the log + :type display_name: str + :param blob_duration: Blob duration of the log + :type blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } - :param key: Required. The key to retrieve. - :type key: str - :param label: The label of the key. - :type label: str + def __init__(self, *, name: str=None, display_name: str=None, blob_duration: str=None, **kwargs) -> None: + super(LogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class MetricDimension(Model): + """Specifications of the Dimension of metrics. + + :param name: Name of the dimension + :type name: str + :param display_name: Localized friendly display name of the dimension + :type display_name: str + :param internal_name: Internal name of the dimension. + :type internal_name: str """ - _validation = { - 'key': {'required': True}, + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'internal_name': {'key': 'internalName', 'type': 'str'}, } + def __init__(self, *, name: str=None, display_name: str=None, internal_name: str=None, **kwargs) -> None: + super(MetricDimension, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.internal_name = internal_name + + +class MetricSpecification(Model): + """Specifications of the Metrics for Azure Monitoring. + + :param name: Name of the metric + :type name: str + :param display_name: Localized friendly display name of the metric + :type display_name: str + :param display_description: Localized friendly description of the metric + :type display_description: str + :param unit: Unit that makes sense for the metric + :type unit: str + :param aggregation_type: Only provide one value for this field. Valid + values: Average, Minimum, Maximum, Total, Count. + :type aggregation_type: str + :param internal_metric_name: Internal metric name. + :type internal_metric_name: str + :param dimensions: Dimensions of the metric + :type dimensions: + list[~azure.mgmt.appconfiguration.models.MetricDimension] + """ + _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, } - def __init__(self, *, key: str, label: str=None, **kwargs) -> None: - super(ListKeyValueParameters, self).__init__(**kwargs) - self.key = key - self.label = label + def __init__(self, *, name: str=None, display_name: str=None, display_description: str=None, unit: str=None, aggregation_type: str=None, internal_metric_name: str=None, dimensions=None, **kwargs) -> None: + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.internal_metric_name = internal_metric_name + self.dimensions = dimensions class NameAvailabilityStatus(Model): @@ -475,21 +602,33 @@ class OperationDefinition(Model): :param name: Operation name: {provider}/{resource}/{operation}. :type name: str + :param is_data_action: Indicates whether the operation is a data action + :type is_data_action: bool :param display: The display information for the configuration store operation. :type display: ~azure.mgmt.appconfiguration.models.OperationDefinitionDisplay + :param origin: Origin of the operation + :type origin: str + :param properties: Properties of the operation + :type properties: ~azure.mgmt.appconfiguration.models.OperationProperties """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDefinitionDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } - def __init__(self, *, name: str=None, display=None, **kwargs) -> None: + def __init__(self, *, name: str=None, is_data_action: bool=None, display=None, origin: str=None, properties=None, **kwargs) -> None: super(OperationDefinition, self).__init__(**kwargs) self.name = name + self.is_data_action = is_data_action self.display = display + self.origin = origin + self.properties = properties class OperationDefinitionDisplay(Model): @@ -527,6 +666,23 @@ def __init__(self, *, resource: str=None, operation: str=None, description: str= self.description = description +class OperationProperties(Model): + """Extra Operation properties. + + :param service_specification: Service specifications of the operation + :type service_specification: + ~azure.mgmt.appconfiguration.models.ServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__(self, *, service_specification=None, **kwargs) -> None: + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = service_specification + + class PrivateEndpoint(Model): """Private endpoint which a connection belongs to. @@ -800,6 +956,29 @@ def __init__(self, *, type=None, user_assigned_identities=None, **kwargs) -> Non self.tenant_id = None +class ServiceSpecification(Model): + """Service specification payload. + + :param log_specifications: Specifications of the Log for Azure Monitoring + :type log_specifications: + list[~azure.mgmt.appconfiguration.models.LogSpecification] + :param metric_specifications: Specifications of the Metrics for Azure + Monitoring + :type metric_specifications: + list[~azure.mgmt.appconfiguration.models.MetricSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__(self, *, log_specifications=None, metric_specifications=None, **kwargs) -> None: + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = log_specifications + self.metric_specifications = metric_specifications + + class Sku(Model): """Describes a configuration store SKU. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_paged_models.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_paged_models.py index 1605c1056678..4b75921107d4 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_paged_models.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_paged_models.py @@ -77,3 +77,16 @@ class PrivateLinkResourcePaged(Paged): def __init__(self, *args, **kwargs): super(PrivateLinkResourcePaged, self).__init__(*args, **kwargs) +class KeyValuePaged(Paged): + """ + A paging container for iterating over a list of :class:`KeyValue ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[KeyValue]'} + } + + def __init__(self, *args, **kwargs): + + super(KeyValuePaged, self).__init__(*args, **kwargs) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/__init__.py index 3f2fa8e0ec48..0651b55494aa 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/__init__.py @@ -13,10 +13,12 @@ from ._operations import Operations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._key_values_operations import KeyValuesOperations __all__ = [ 'ConfigurationStoresOperations', 'Operations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', + 'KeyValuesOperations', ] diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_configuration_stores_operations.py index e81ce3612e77..44f4ada0599b 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_configuration_stores_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_configuration_stores_operations.py @@ -26,7 +26,7 @@ class ConfigurationStoresOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The client API version. Constant value: "2020-06-01". + :ivar api_version: The client API version. Constant value: "2020-07-01-preview". """ models = models @@ -36,7 +36,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-06-01" + self.api_version = "2020-07-01-preview" self.config = config @@ -59,7 +59,7 @@ def list( :rtype: ~azure.mgmt.appconfiguration.models.ConfigurationStorePaged[~azure.mgmt.appconfiguration.models.ConfigurationStore] :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -100,7 +100,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) return response @@ -135,7 +135,7 @@ def list_by_resource_group( :rtype: ~azure.mgmt.appconfiguration.models.ConfigurationStorePaged[~azure.mgmt.appconfiguration.models.ConfigurationStore] :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -177,7 +177,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) return response @@ -208,7 +208,7 @@ def get( :rtype: ~azure.mgmt.appconfiguration.models.ConfigurationStore or ~msrest.pipeline.ClientRawResponse :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ # Construct URL url = self.get.metadata['url'] @@ -238,7 +238,7 @@ def get( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -286,7 +286,7 @@ def _create_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) deserialized = None @@ -326,7 +326,7 @@ def create( or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appconfiguration.models.ConfigurationStore]] :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ raw_result = self._create_initial( resource_group_name=resource_group_name, @@ -385,7 +385,7 @@ def _delete_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 202, 204]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) @@ -410,7 +410,7 @@ def delete( :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ raw_result = self._delete_initial( resource_group_name=resource_group_name, @@ -469,7 +469,7 @@ def _update_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) deserialized = None @@ -509,7 +509,7 @@ def update( or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appconfiguration.models.ConfigurationStore]] :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ raw_result = self._update_initial( resource_group_name=resource_group_name, @@ -562,7 +562,7 @@ def list_keys( :rtype: ~azure.mgmt.appconfiguration.models.ApiKeyPaged[~azure.mgmt.appconfiguration.models.ApiKey] :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -605,7 +605,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) return response @@ -616,7 +616,7 @@ def internal_paging(next_link=None): deserialized = models.ApiKeyPaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/ListKeys'} + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys'} def regenerate_key( self, resource_group_name, config_store_name, id=None, custom_headers=None, raw=False, **operation_config): @@ -638,7 +638,7 @@ def regenerate_key( :rtype: ~azure.mgmt.appconfiguration.models.ApiKey or ~msrest.pipeline.ClientRawResponse :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ regenerate_key_parameters = models.RegenerateKeyParameters(id=id) @@ -674,7 +674,7 @@ def regenerate_key( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -685,75 +685,4 @@ def regenerate_key( return client_raw_response return deserialized - regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/RegenerateKey'} - - def list_key_value( - self, resource_group_name, config_store_name, key, label=None, custom_headers=None, raw=False, **operation_config): - """Lists a configuration store key-value. - - :param resource_group_name: The name of the resource group to which - the container registry belongs. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. - :type config_store_name: str - :param key: The key to retrieve. - :type key: str - :param label: The label of the key. - :type label: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: KeyValue or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appconfiguration.models.KeyValue or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorException` - """ - list_key_value_parameters = models.ListKeyValueParameters(key=key, label=label) - - # Construct URL - url = self.list_key_value.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'configStoreName': self._serialize.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(list_key_value_parameters, 'ListKeyValueParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyValue', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list_key_value.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeyValue'} + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey'} diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_key_values_operations.py new file mode 100644 index 000000000000..bdb1192a6f1d --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_key_values_operations.py @@ -0,0 +1,345 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class KeyValuesOperations(object): + """KeyValuesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The client API version. Constant value: "2020-07-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-07-01-preview" + + self.config = config + + def list_by_configuration_store( + self, resource_group_name, config_store_name, skip_token=None, custom_headers=None, raw=False, **operation_config): + """Lists the key-values for a given configuration store. + + :param resource_group_name: The name of the resource group to which + the container registry belongs. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. + :type config_store_name: str + :param skip_token: A skip token is used to continue retrieving items + after an operation returns a partial result. If a previous response + contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use + for subsequent calls. + :type skip_token: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of KeyValue + :rtype: + ~azure.mgmt.appconfiguration.models.KeyValuePaged[~azure.mgmt.appconfiguration.models.KeyValue] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_configuration_store.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'configStoreName': self._serialize.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.KeyValuePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_configuration_store.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues'} + + def get( + self, resource_group_name, config_store_name, key_value_name, custom_headers=None, raw=False, **operation_config): + """Gets the properties of the specified key-value. + + :param resource_group_name: The name of the resource group to which + the container registry belongs. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key + and label are joined by $ character. Label is optional. + :type key_value_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: KeyValue or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.appconfiguration.models.KeyValue or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'configStoreName': self._serialize.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + 'keyValueName': self._serialize.url("key_value_name", key_value_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('KeyValue', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}'} + + def create_or_update( + self, resource_group_name, config_store_name, key_value_name, key_value_parameters=None, custom_headers=None, raw=False, **operation_config): + """Creates a key-value. + + :param resource_group_name: The name of the resource group to which + the container registry belongs. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key + and label are joined by $ character. Label is optional. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. + :type key_value_parameters: + ~azure.mgmt.appconfiguration.models.KeyValue + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: KeyValue or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.appconfiguration.models.KeyValue or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'configStoreName': self._serialize.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + 'keyValueName': self._serialize.url("key_value_name", key_value_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + if key_value_parameters is not None: + body_content = self._serialize.body(key_value_parameters, 'KeyValue') + else: + body_content = None + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('KeyValue', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}'} + + + def _delete_initial( + self, resource_group_name, config_store_name, key_value_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'configStoreName': self._serialize.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + 'keyValueName': self._serialize.url("key_value_name", key_value_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, config_store_name, key_value_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a key-value. + + :param resource_group_name: The name of the resource group to which + the container registry belongs. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key + and label are joined by $ character. Label is optional. + :type key_value_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + key_value_name=key_value_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}'} diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_operations.py index 98a1d019392d..b3bcd9ee1940 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_operations.py @@ -24,7 +24,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The client API version. Constant value: "2020-06-01". + :ivar api_version: The client API version. Constant value: "2020-07-01-preview". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-06-01" + self.api_version = "2020-07-01-preview" self.config = config @@ -53,7 +53,7 @@ def check_name_availability( :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus or ~msrest.pipeline.ClientRawResponse :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ check_name_availability_parameters = models.CheckNameAvailabilityParameters(name=name) @@ -87,7 +87,7 @@ def check_name_availability( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -119,7 +119,7 @@ def list( :rtype: ~azure.mgmt.appconfiguration.models.OperationDefinitionPaged[~azure.mgmt.appconfiguration.models.OperationDefinition] :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -156,7 +156,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) return response diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_private_endpoint_connections_operations.py index 0994852951e1..bdf1dcae229c 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_private_endpoint_connections_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_private_endpoint_connections_operations.py @@ -26,7 +26,7 @@ class PrivateEndpointConnectionsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The client API version. Constant value: "2020-06-01". + :ivar api_version: The client API version. Constant value: "2020-07-01-preview". """ models = models @@ -36,7 +36,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-06-01" + self.api_version = "2020-07-01-preview" self.config = config @@ -58,7 +58,7 @@ def list_by_configuration_store( :rtype: ~azure.mgmt.appconfiguration.models.PrivateEndpointConnectionPaged[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -99,7 +99,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) return response @@ -134,7 +134,7 @@ def get( :rtype: ~azure.mgmt.appconfiguration.models.PrivateEndpointConnection or ~msrest.pipeline.ClientRawResponse :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ # Construct URL url = self.get.metadata['url'] @@ -165,7 +165,7 @@ def get( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -216,7 +216,7 @@ def _create_or_update_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) deserialized = None @@ -265,7 +265,7 @@ def create_or_update( or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection]] :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, @@ -327,7 +327,7 @@ def _delete_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 202, 204]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) @@ -355,7 +355,7 @@ def delete( :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ raw_result = self._delete_initial( resource_group_name=resource_group_name, diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_private_link_resources_operations.py index 2889aa906108..4f753c19c3fa 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_private_link_resources_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_private_link_resources_operations.py @@ -24,7 +24,7 @@ class PrivateLinkResourcesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The client API version. Constant value: "2020-06-01". + :ivar api_version: The client API version. Constant value: "2020-07-01-preview". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-06-01" + self.api_version = "2020-07-01-preview" self.config = config @@ -57,7 +57,7 @@ def list_by_configuration_store( :rtype: ~azure.mgmt.appconfiguration.models.PrivateLinkResourcePaged[~azure.mgmt.appconfiguration.models.PrivateLinkResource] :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -98,7 +98,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) return response @@ -132,7 +132,7 @@ def get( :rtype: ~azure.mgmt.appconfiguration.models.PrivateLinkResource or ~msrest.pipeline.ClientRawResponse :raises: - :class:`ErrorException` + :class:`ErrorResponseException` """ # Construct URL url = self.get.metadata['url'] @@ -163,7 +163,7 @@ def get( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: