From a4ba2d1bf7699f7259a80cbfdba01c2f29c24655 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 20 Feb 2020 07:44:41 +0000 Subject: [PATCH] Generated from 3dc4d0ac3e5fc780dd402ff0f767c54ae50c78eb add swagger file --- .../_app_platform_management_client.py | 20 + .../azure/mgmt/appplatform/models/__init__.py | 30 ++ .../_app_platform_management_client_enums.py | 3 + .../azure/mgmt/appplatform/models/_models.py | 276 ++++++++++- .../mgmt/appplatform/models/_models_py3.py | 280 ++++++++++- .../mgmt/appplatform/operations/__init__.py | 8 + .../operations/_apps_operations.py | 18 +- .../operations/_bindings_operations.py | 18 +- .../operations/_certificate_operations.py | 353 ++++++++++++++ .../operations/_custom_domains_operations.py | 445 ++++++++++++++++++ .../operations/_deployments_operations.py | 18 +- .../operations/_health_operations.py | 83 ++++ .../operations/_services_operations.py | 39 +- .../appplatform/operations/_sku_operations.py | 91 ++++ 14 files changed, 1607 insertions(+), 75 deletions(-) create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_certificate_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_custom_domains_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_health_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_sku_operations.py diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_app_platform_management_client.py index 176133a5f297..b7898900615e 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_app_platform_management_client.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_app_platform_management_client.py @@ -16,8 +16,12 @@ from .operations import ServicesOperations from .operations import AppsOperations from .operations import BindingsOperations +from .operations import CertificateOperations +from .operations import CustomDomainsOperations from .operations import DeploymentsOperations +from .operations import HealthOperations from .operations import Operations +from .operations import SkuOperations from . import models @@ -33,10 +37,18 @@ class AppPlatformManagementClient(SDKClient): :vartype apps: azure.mgmt.appplatform.operations.AppsOperations :ivar bindings: Bindings operations :vartype bindings: azure.mgmt.appplatform.operations.BindingsOperations + :ivar certificate: Certificate operations + :vartype certificate: azure.mgmt.appplatform.operations.CertificateOperations + :ivar custom_domains: CustomDomains operations + :vartype custom_domains: azure.mgmt.appplatform.operations.CustomDomainsOperations :ivar deployments: Deployments operations :vartype deployments: azure.mgmt.appplatform.operations.DeploymentsOperations + :ivar health: Health operations + :vartype health: azure.mgmt.appplatform.operations.HealthOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.operations.Operations + :ivar sku: Sku operations + :vartype sku: azure.mgmt.appplatform.operations.SkuOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -65,7 +77,15 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.bindings = BindingsOperations( self._client, self.config, self._serialize, self._deserialize) + self.certificate = CertificateOperations( + self._client, self.config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self.config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations( self._client, self.config, self._serialize, self._deserialize) + self.health = HealthOperations( + self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) + self.sku = SkuOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/__init__.py index 1bee2b655937..c27cb9fc1f88 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/__init__.py @@ -14,10 +14,16 @@ from ._models_py3 import AppResourceProperties from ._models_py3 import BindingResource from ._models_py3 import BindingResourceProperties + from ._models_py3 import CertificateProperties + from ._models_py3 import CertificateResource + from ._models_py3 import CertificateResourceCollection from ._models_py3 import ClusterResourceProperties from ._models_py3 import ConfigServerGitProperty from ._models_py3 import ConfigServerProperties from ._models_py3 import ConfigServerSettings + from ._models_py3 import CustomDomainProperties + from ._models_py3 import CustomDomainResource + from ._models_py3 import CustomDomainResourceCollection from ._models_py3 import DeploymentInstance from ._models_py3 import DeploymentResource from ._models_py3 import DeploymentResourceProperties @@ -37,9 +43,13 @@ from ._models_py3 import ProxyResource from ._models_py3 import RegenerateTestKeyRequestPayload from ._models_py3 import Resource + from ._models_py3 import ResourceTypeSku + from ._models_py3 import ResourceTypeSkuCollection from ._models_py3 import ResourceUploadDefinition from ._models_py3 import ServiceResource from ._models_py3 import ServiceSpecification + from ._models_py3 import Sku + from ._models_py3 import SkuSetting from ._models_py3 import TemporaryDisk from ._models_py3 import TestKeys from ._models_py3 import TraceProperties @@ -50,10 +60,16 @@ from ._models import AppResourceProperties from ._models import BindingResource from ._models import BindingResourceProperties + from ._models import CertificateProperties + from ._models import CertificateResource + from ._models import CertificateResourceCollection from ._models import ClusterResourceProperties from ._models import ConfigServerGitProperty from ._models import ConfigServerProperties from ._models import ConfigServerSettings + from ._models import CustomDomainProperties + from ._models import CustomDomainResource + from ._models import CustomDomainResourceCollection from ._models import DeploymentInstance from ._models import DeploymentResource from ._models import DeploymentResourceProperties @@ -73,9 +89,13 @@ from ._models import ProxyResource from ._models import RegenerateTestKeyRequestPayload from ._models import Resource + from ._models import ResourceTypeSku + from ._models import ResourceTypeSkuCollection from ._models import ResourceUploadDefinition from ._models import ServiceResource from ._models import ServiceSpecification + from ._models import Sku + from ._models import SkuSetting from ._models import TemporaryDisk from ._models import TestKeys from ._models import TraceProperties @@ -103,10 +123,16 @@ 'AppResourceProperties', 'BindingResource', 'BindingResourceProperties', + 'CertificateProperties', + 'CertificateResource', + 'CertificateResourceCollection', 'ClusterResourceProperties', 'ConfigServerGitProperty', 'ConfigServerProperties', 'ConfigServerSettings', + 'CustomDomainProperties', + 'CustomDomainResource', + 'CustomDomainResourceCollection', 'DeploymentInstance', 'DeploymentResource', 'DeploymentResourceProperties', @@ -126,9 +152,13 @@ 'ProxyResource', 'RegenerateTestKeyRequestPayload', 'Resource', + 'ResourceTypeSku', + 'ResourceTypeSkuCollection', 'ResourceUploadDefinition', 'ServiceResource', 'ServiceSpecification', + 'Sku', + 'SkuSetting', 'TemporaryDisk', 'TestKeys', 'TraceProperties', diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_app_platform_management_client_enums.py index d285514c52b0..7414c43268d5 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_app_platform_management_client_enums.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_app_platform_management_client_enums.py @@ -54,6 +54,7 @@ class AppResourceProvisioningState(str, Enum): failed = "Failed" creating = "Creating" updating = "Updating" + deleting = "Deleting" class UserSourceType(str, Enum): @@ -68,6 +69,7 @@ class DeploymentResourceProvisioningState(str, Enum): updating = "Updating" succeeded = "Succeeded" failed = "Failed" + deleting = "Deleting" class RuntimeVersion(str, Enum): @@ -85,3 +87,4 @@ class DeploymentResourceStatus(str, Enum): allocating = "Allocating" upgrading = "Upgrading" compiling = "Compiling" + processing = "Processing" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_models.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_models.py index 04edddf0bb8f..0c35f2ed1902 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_models.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_models.py @@ -122,7 +122,7 @@ class AppResourceProperties(Model): :ivar url: URL of the App :vartype url: str :ivar provisioning_state: Provisioning state of the App. Possible values - include: 'Succeeded', 'Failed', 'Creating', 'Updating' + include: 'Succeeded', 'Failed', 'Creating', 'Updating', 'Deleting' :vartype provisioning_state: str or ~azure.mgmt.appplatform.models.AppResourceProvisioningState :param active_deployment_name: Name of the active deployment of the App @@ -251,6 +251,94 @@ def __init__(self, **kwargs): self.updated_at = None +class CertificateProperties(Model): + """Certificate resource payload. + + All required parameters must be populated in order to send to Azure. + + :param keyvault_resource_id: The resource id of user keyvault. + :type keyvault_resource_id: str + :param keyvault_certificate_name: Required. The certificate name of user + keyvault. + :type keyvault_certificate_name: str + :param vault_uri: Required. The vault uri of user key vault. + :type vault_uri: str + """ + + _validation = { + 'keyvault_certificate_name': {'required': True}, + 'vault_uri': {'required': True}, + } + + _attribute_map = { + 'keyvault_resource_id': {'key': 'keyvaultResourceId', 'type': 'str'}, + 'keyvault_certificate_name': {'key': 'keyvaultCertificateName', 'type': 'str'}, + 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CertificateProperties, self).__init__(**kwargs) + self.keyvault_resource_id = kwargs.get('keyvault_resource_id', None) + self.keyvault_certificate_name = kwargs.get('keyvault_certificate_name', None) + self.vault_uri = kwargs.get('vault_uri', None) + + +class CertificateResource(Resource): + """Certificate resource payload. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param properties: Properties of the certificate resource payload. + :type properties: ~azure.mgmt.appplatform.models.CertificateProperties + """ + + _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'}, + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + } + + def __init__(self, **kwargs): + super(CertificateResource, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class CertificateResourceCollection(Model): + """Collection compose of certificate resources list and a possible link for + next page. + + :param resources: The certificate resources list. + :type resources: + list[~azure.mgmt.appplatform.models.CertificateResourceCollection] + :param next_link: The link to next page of certificate list. + :type next_link: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[CertificateResourceCollection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CertificateResourceCollection, self).__init__(**kwargs) + self.resources = kwargs.get('resources', None) + self.next_link = kwargs.get('next_link', None) + + class CloudError(Model): """An error response from the service. @@ -464,6 +552,87 @@ def __init__(self, **kwargs): self.git_property = kwargs.get('git_property', None) +class CustomDomainProperties(Model): + """Custom domain of app resource payload. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of custom domain. + :type name: str + :param thumbprint: The thumbprint of bound ceritifcate. + :type thumbprint: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CustomDomainProperties, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.thumbprint = kwargs.get('thumbprint', None) + + +class CustomDomainResource(Resource): + """Custom domain resource payload. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param properties: Properties of the custom domain resource. + :type properties: ~azure.mgmt.appplatform.models.CustomDomainProperties + """ + + _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'}, + 'properties': {'key': 'properties', 'type': 'CustomDomainProperties'}, + } + + def __init__(self, **kwargs): + super(CustomDomainResource, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class CustomDomainResourceCollection(Model): + """Collection compose of a custom domain resources list and a possible link + for next page. + + :param resources: The custom domain resources list. + :type resources: list[~azure.mgmt.appplatform.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[CustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CustomDomainResourceCollection, self).__init__(**kwargs) + self.resources = kwargs.get('resources', None) + self.next_link = kwargs.get('next_link', None) + + class DeploymentInstance(Model): """Deployment instance payload. @@ -548,7 +717,7 @@ class DeploymentResourceProperties(Model): :ivar app_name: App name of the deployment :vartype app_name: str :ivar provisioning_state: Provisioning state of the Deployment. Possible - values include: 'Creating', 'Updating', 'Succeeded', 'Failed' + values include: 'Creating', 'Updating', 'Succeeded', 'Failed', 'Deleting' :vartype provisioning_state: str or ~azure.mgmt.appplatform.models.DeploymentResourceProvisioningState :param deployment_settings: Deployment settings of the Deployment @@ -556,7 +725,7 @@ class DeploymentResourceProperties(Model): ~azure.mgmt.appplatform.models.DeploymentSettings :ivar status: Status of the Deployment. Possible values include: 'Unknown', 'Stopped', 'Running', 'Failed', 'Allocating', 'Upgrading', - 'Compiling' + 'Compiling', 'Processing' :vartype status: str or ~azure.mgmt.appplatform.models.DeploymentResourceStatus :ivar active: Indicates whether the Deployment is active @@ -780,17 +949,22 @@ class MetricDimension(Model): :type name: str :param display_name: Localized friendly display name of the dimension :type display_name: str + :param to_be_exported_for_shoebox: Whether this dimension should be + included for the Shoebox export scenario + :type to_be_exported_for_shoebox: bool """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } def __init__(self, **kwargs): super(MetricDimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) + self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) class MetricSpecification(Model): @@ -1031,6 +1205,42 @@ def __init__(self, **kwargs): self.key_type = kwargs.get('key_type', None) +class ResourceTypeSku(Model): + """Supported Skus of Azure Spring Cloud resources. + + :param resource_type: Resource type + :type resource_type: str + :param skus: Supported Skus + :type skus: list[~azure.mgmt.appplatform.models.SkuSetting] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'skus': {'key': 'skus', 'type': '[SkuSetting]'}, + } + + def __init__(self, **kwargs): + super(ResourceTypeSku, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.skus = kwargs.get('skus', None) + + +class ResourceTypeSkuCollection(Model): + """Collection of supported Skus of Azure Spring Cloud resources. + + :param value: Collection of supported Skus + :type value: list[~azure.mgmt.appplatform.models.ResourceTypeSku] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceTypeSku]'}, + } + + def __init__(self, **kwargs): + super(ResourceTypeSkuCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + class ResourceUploadDefinition(Model): """Resource upload definition payload. @@ -1109,6 +1319,8 @@ class ServiceResource(TrackedResource): :type tags: dict[str, str] :param properties: Properties of the Service resource :type properties: ~azure.mgmt.appplatform.models.ClusterResourceProperties + :param sku: Sku of the Service resource + :type sku: ~azure.mgmt.appplatform.models.Sku """ _validation = { @@ -1124,11 +1336,13 @@ class ServiceResource(TrackedResource): 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'properties': {'key': 'properties', 'type': 'ClusterResourceProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, } def __init__(self, **kwargs): super(ServiceResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) + self.sku = kwargs.get('sku', None) class ServiceSpecification(Model): @@ -1154,6 +1368,62 @@ def __init__(self, **kwargs): self.metric_specifications = kwargs.get('metric_specifications', None) +class Sku(Model): + """Sku of Azure Spring Cloud. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Name of the Sku + :vartype name: str + :ivar tier: Tier of the Sku + :vartype tier: str + """ + + _validation = { + 'name': {'readonly': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Sku, self).__init__(**kwargs) + self.name = None + self.tier = None + + +class SkuSetting(Model): + """Supported Sku settings of Azure Spring Cloud. + + :param name: Name of the Sku + :type name: str + :param tier: Tier of the Sku + :type tier: str + :param locations: Locations of the Sku + :type locations: list[str] + :param required_features: Required features of the Sku + :type required_features: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'required_features': {'key': 'requiredFeatures', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(SkuSetting, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + self.locations = kwargs.get('locations', None) + self.required_features = kwargs.get('required_features', None) + + class TemporaryDisk(Model): """Temporary disk payload. diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_models_py3.py index 467dba09ed08..7bde942c1042 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_models_py3.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_models_py3.py @@ -122,7 +122,7 @@ class AppResourceProperties(Model): :ivar url: URL of the App :vartype url: str :ivar provisioning_state: Provisioning state of the App. Possible values - include: 'Succeeded', 'Failed', 'Creating', 'Updating' + include: 'Succeeded', 'Failed', 'Creating', 'Updating', 'Deleting' :vartype provisioning_state: str or ~azure.mgmt.appplatform.models.AppResourceProvisioningState :param active_deployment_name: Name of the active deployment of the App @@ -251,6 +251,94 @@ def __init__(self, *, resource_name: str=None, resource_type: str=None, resource self.updated_at = None +class CertificateProperties(Model): + """Certificate resource payload. + + All required parameters must be populated in order to send to Azure. + + :param keyvault_resource_id: The resource id of user keyvault. + :type keyvault_resource_id: str + :param keyvault_certificate_name: Required. The certificate name of user + keyvault. + :type keyvault_certificate_name: str + :param vault_uri: Required. The vault uri of user key vault. + :type vault_uri: str + """ + + _validation = { + 'keyvault_certificate_name': {'required': True}, + 'vault_uri': {'required': True}, + } + + _attribute_map = { + 'keyvault_resource_id': {'key': 'keyvaultResourceId', 'type': 'str'}, + 'keyvault_certificate_name': {'key': 'keyvaultCertificateName', 'type': 'str'}, + 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + } + + def __init__(self, *, keyvault_certificate_name: str, vault_uri: str, keyvault_resource_id: str=None, **kwargs) -> None: + super(CertificateProperties, self).__init__(**kwargs) + self.keyvault_resource_id = keyvault_resource_id + self.keyvault_certificate_name = keyvault_certificate_name + self.vault_uri = vault_uri + + +class CertificateResource(Resource): + """Certificate resource payload. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param properties: Properties of the certificate resource payload. + :type properties: ~azure.mgmt.appplatform.models.CertificateProperties + """ + + _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'}, + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(CertificateResource, self).__init__(**kwargs) + self.properties = properties + + +class CertificateResourceCollection(Model): + """Collection compose of certificate resources list and a possible link for + next page. + + :param resources: The certificate resources list. + :type resources: + list[~azure.mgmt.appplatform.models.CertificateResourceCollection] + :param next_link: The link to next page of certificate list. + :type next_link: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[CertificateResourceCollection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, resources=None, next_link: str=None, **kwargs) -> None: + super(CertificateResourceCollection, self).__init__(**kwargs) + self.resources = resources + self.next_link = next_link + + class CloudError(Model): """An error response from the service. @@ -464,6 +552,87 @@ def __init__(self, *, git_property=None, **kwargs) -> None: self.git_property = git_property +class CustomDomainProperties(Model): + """Custom domain of app resource payload. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of custom domain. + :type name: str + :param thumbprint: The thumbprint of bound ceritifcate. + :type thumbprint: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + } + + def __init__(self, *, name: str, thumbprint: str=None, **kwargs) -> None: + super(CustomDomainProperties, self).__init__(**kwargs) + self.name = name + self.thumbprint = thumbprint + + +class CustomDomainResource(Resource): + """Custom domain resource payload. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param properties: Properties of the custom domain resource. + :type properties: ~azure.mgmt.appplatform.models.CustomDomainProperties + """ + + _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'}, + 'properties': {'key': 'properties', 'type': 'CustomDomainProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(CustomDomainResource, self).__init__(**kwargs) + self.properties = properties + + +class CustomDomainResourceCollection(Model): + """Collection compose of a custom domain resources list and a possible link + for next page. + + :param resources: The custom domain resources list. + :type resources: list[~azure.mgmt.appplatform.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[CustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, resources=None, next_link: str=None, **kwargs) -> None: + super(CustomDomainResourceCollection, self).__init__(**kwargs) + self.resources = resources + self.next_link = next_link + + class DeploymentInstance(Model): """Deployment instance payload. @@ -548,7 +717,7 @@ class DeploymentResourceProperties(Model): :ivar app_name: App name of the deployment :vartype app_name: str :ivar provisioning_state: Provisioning state of the Deployment. Possible - values include: 'Creating', 'Updating', 'Succeeded', 'Failed' + values include: 'Creating', 'Updating', 'Succeeded', 'Failed', 'Deleting' :vartype provisioning_state: str or ~azure.mgmt.appplatform.models.DeploymentResourceProvisioningState :param deployment_settings: Deployment settings of the Deployment @@ -556,7 +725,7 @@ class DeploymentResourceProperties(Model): ~azure.mgmt.appplatform.models.DeploymentSettings :ivar status: Status of the Deployment. Possible values include: 'Unknown', 'Stopped', 'Running', 'Failed', 'Allocating', 'Upgrading', - 'Compiling' + 'Compiling', 'Processing' :vartype status: str or ~azure.mgmt.appplatform.models.DeploymentResourceStatus :ivar active: Indicates whether the Deployment is active @@ -780,17 +949,22 @@ class MetricDimension(Model): :type name: str :param display_name: Localized friendly display name of the dimension :type display_name: str + :param to_be_exported_for_shoebox: Whether this dimension should be + included for the Shoebox export scenario + :type to_be_exported_for_shoebox: bool """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, *, name: str=None, display_name: str=None, **kwargs) -> None: + def __init__(self, *, name: str=None, display_name: str=None, to_be_exported_for_shoebox: bool=None, **kwargs) -> None: super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox class MetricSpecification(Model): @@ -1031,6 +1205,42 @@ def __init__(self, *, key_type, **kwargs) -> None: self.key_type = key_type +class ResourceTypeSku(Model): + """Supported Skus of Azure Spring Cloud resources. + + :param resource_type: Resource type + :type resource_type: str + :param skus: Supported Skus + :type skus: list[~azure.mgmt.appplatform.models.SkuSetting] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'skus': {'key': 'skus', 'type': '[SkuSetting]'}, + } + + def __init__(self, *, resource_type: str=None, skus=None, **kwargs) -> None: + super(ResourceTypeSku, self).__init__(**kwargs) + self.resource_type = resource_type + self.skus = skus + + +class ResourceTypeSkuCollection(Model): + """Collection of supported Skus of Azure Spring Cloud resources. + + :param value: Collection of supported Skus + :type value: list[~azure.mgmt.appplatform.models.ResourceTypeSku] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceTypeSku]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(ResourceTypeSkuCollection, self).__init__(**kwargs) + self.value = value + + class ResourceUploadDefinition(Model): """Resource upload definition payload. @@ -1109,6 +1319,8 @@ class ServiceResource(TrackedResource): :type tags: dict[str, str] :param properties: Properties of the Service resource :type properties: ~azure.mgmt.appplatform.models.ClusterResourceProperties + :param sku: Sku of the Service resource + :type sku: ~azure.mgmt.appplatform.models.Sku """ _validation = { @@ -1124,11 +1336,13 @@ class ServiceResource(TrackedResource): 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'properties': {'key': 'properties', 'type': 'ClusterResourceProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, *, location: str=None, tags=None, properties=None, **kwargs) -> None: + def __init__(self, *, location: str=None, tags=None, properties=None, sku=None, **kwargs) -> None: super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties + self.sku = sku class ServiceSpecification(Model): @@ -1154,6 +1368,62 @@ def __init__(self, *, log_specifications=None, metric_specifications=None, **kwa self.metric_specifications = metric_specifications +class Sku(Model): + """Sku of Azure Spring Cloud. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Name of the Sku + :vartype name: str + :ivar tier: Tier of the Sku + :vartype tier: str + """ + + _validation = { + 'name': {'readonly': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Sku, self).__init__(**kwargs) + self.name = None + self.tier = None + + +class SkuSetting(Model): + """Supported Sku settings of Azure Spring Cloud. + + :param name: Name of the Sku + :type name: str + :param tier: Tier of the Sku + :type tier: str + :param locations: Locations of the Sku + :type locations: list[str] + :param required_features: Required features of the Sku + :type required_features: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'required_features': {'key': 'requiredFeatures', 'type': '[str]'}, + } + + def __init__(self, *, name: str=None, tier: str=None, locations=None, required_features=None, **kwargs) -> None: + super(SkuSetting, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.locations = locations + self.required_features = required_features + + class TemporaryDisk(Model): """Temporary disk payload. diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/__init__.py index caf4e58455d0..1d2704215977 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/__init__.py @@ -12,13 +12,21 @@ from ._services_operations import ServicesOperations from ._apps_operations import AppsOperations from ._bindings_operations import BindingsOperations +from ._certificate_operations import CertificateOperations +from ._custom_domains_operations import CustomDomainsOperations from ._deployments_operations import DeploymentsOperations +from ._health_operations import HealthOperations from ._operations import Operations +from ._sku_operations import SkuOperations __all__ = [ 'ServicesOperations', 'AppsOperations', 'BindingsOperations', + 'CertificateOperations', + 'CustomDomainsOperations', 'DeploymentsOperations', + 'HealthOperations', 'Operations', + 'SkuOperations', ] diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_apps_operations.py index 22b7af0eb1d3..b80a5da1d0aa 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_apps_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_apps_operations.py @@ -114,9 +114,7 @@ def get( def _create_or_update_initial( self, resource_group_name, service_name, app_name, properties=None, custom_headers=None, raw=False, **operation_config): - app_resource = None - if properties is not None: - app_resource = models.AppResource(properties=properties) + app_resource = models.AppResource(properties=properties) # Construct URL url = self.create_or_update.metadata['url'] @@ -144,10 +142,7 @@ def _create_or_update_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - if app_resource is not None: - body_content = self._serialize.body(app_resource, 'AppResource') - else: - body_content = None + body_content = self._serialize.body(app_resource, 'AppResource') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) @@ -287,9 +282,7 @@ def delete( def _update_initial( self, resource_group_name, service_name, app_name, properties=None, custom_headers=None, raw=False, **operation_config): - app_resource = None - if properties is not None: - app_resource = models.AppResource(properties=properties) + app_resource = models.AppResource(properties=properties) # Construct URL url = self.update.metadata['url'] @@ -317,10 +310,7 @@ def _update_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - if app_resource is not None: - body_content = self._serialize.body(app_resource, 'AppResource') - else: - body_content = None + body_content = self._serialize.body(app_resource, 'AppResource') # Construct and send request request = self._client.patch(url, query_parameters, header_parameters, body_content) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_bindings_operations.py index 2a5b4322ca07..1be603bdfc98 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_bindings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_bindings_operations.py @@ -135,9 +135,7 @@ def create_or_update( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - binding_resource = None - if properties is not None: - binding_resource = models.BindingResource(properties=properties) + binding_resource = models.BindingResource(properties=properties) # Construct URL url = self.create_or_update.metadata['url'] @@ -166,10 +164,7 @@ def create_or_update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - if binding_resource is not None: - body_content = self._serialize.body(binding_resource, 'BindingResource') - else: - body_content = None + body_content = self._serialize.body(binding_resource, 'BindingResource') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) @@ -279,9 +274,7 @@ def update( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - binding_resource = None - if properties is not None: - binding_resource = models.BindingResource(properties=properties) + binding_resource = models.BindingResource(properties=properties) # Construct URL url = self.update.metadata['url'] @@ -310,10 +303,7 @@ def update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - if binding_resource is not None: - body_content = self._serialize.body(binding_resource, 'BindingResource') - else: - body_content = None + body_content = self._serialize.body(binding_resource, 'BindingResource') # Construct and send request request = self._client.patch(url, query_parameters, header_parameters, body_content) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_certificate_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_certificate_operations.py new file mode 100644 index 000000000000..7f4d3d82e4dc --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_certificate_operations.py @@ -0,0 +1,353 @@ +# 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 msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class CertificateOperations(object): + """CertificateOperations 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: Client Api Version. Constant value: "2019-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-05-01-preview" + + self.config = config + + def get_async( + self, certificate_name, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + """Get the certificate resource. + + :param certificate_name: + :type certificate_name: str + :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. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_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: CertificateResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.appplatform.models.CertificateResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_async.metadata['url'] + path_format_arguments = { + 'CertificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[a-z0-9-]{1,127}$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CertificateResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_async.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} + + + def _create_or_update_async_initial( + self, certificate_name, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, **operation_config): + certificate_resource = models.CertificateResource(properties=properties) + + # Construct URL + url = self.create_or_update_async.metadata['url'] + path_format_arguments = { + 'CertificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[a-z0-9-]{1,127}$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_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 + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + + # 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, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CertificateResource', response) + if response.status_code == 201: + deserialized = self._deserialize('CertificateResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update_async( + self, certificate_name, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update certificate resource. + + :param certificate_name: + :type certificate_name: str + :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. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param properties: Properties of the certificate resource payload. + :type properties: ~azure.mgmt.appplatform.models.CertificateProperties + :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 CertificateResource or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.models.CertificateResource] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.models.CertificateResource]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_async_initial( + certificate_name=certificate_name, + resource_group_name=resource_group_name, + service_name=service_name, + properties=properties, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('CertificateResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + 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) + create_or_update_async.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} + + def delete_async( + self, certificate_name, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + """Delete the certificate resource. + + :param certificate_name: + :type certificate_name: str + :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. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_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: CertificateResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.appplatform.models.CertificateResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete_async.metadata['url'] + path_format_arguments = { + 'CertificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[a-z0-9-]{1,127}$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_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.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CertificateResource', response) + if response.status_code == 204: + deserialized = self._deserialize('CertificateResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + delete_async.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} + + def list_async( + self, certificate_name, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + """List all the certificates of one user. + + :param certificate_name: + :type certificate_name: str + :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. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_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: CertificateResourceCollection or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.appplatform.models.CertificateResourceCollection + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_async.metadata['url'] + path_format_arguments = { + 'CertificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[a-z0-9-]{1,127}$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CertificateResourceCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_async.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_custom_domains_operations.py new file mode 100644 index 000000000000..0bf0c0ebd27f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_custom_domains_operations.py @@ -0,0 +1,445 @@ +# 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 msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class CustomDomainsOperations(object): + """CustomDomainsOperations 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: Client Api Version. Constant value: "2019-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-05-01-preview" + + self.config = config + + def get_async( + self, domain_name, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + """Get the custom domain of one lifecycle application. + + :param domain_name: + :type domain_name: str + :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. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_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: CustomDomainResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.appplatform.models.CustomDomainResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_async.metadata['url'] + path_format_arguments = { + 'DomainName': self._serialize.url("domain_name", domain_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_async.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} + + + def _create_or_update_async_initial( + self, domain_name, resource_group_name, service_name, app_name, properties=None, custom_headers=None, raw=False, **operation_config): + domain_resource = models.CustomDomainResource(properties=properties) + + # Construct URL + url = self.create_or_update_async.metadata['url'] + path_format_arguments = { + 'DomainName': self._serialize.url("domain_name", domain_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_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 + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + + # 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, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', response) + if response.status_code == 201: + deserialized = self._deserialize('CustomDomainResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update_async( + self, domain_name, resource_group_name, service_name, app_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update custom domain of one lifecycle application. + + :param domain_name: + :type domain_name: str + :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. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param properties: Properties of the custom domain resource. + :type properties: + ~azure.mgmt.appplatform.models.CustomDomainProperties + :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 CustomDomainResource or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.models.CustomDomainResource] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.models.CustomDomainResource]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_async_initial( + domain_name=domain_name, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + properties=properties, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('CustomDomainResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + 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) + create_or_update_async.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} + + def delete_async( + self, domain_name, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + """Delete the custom domain of one lifecycle application. + + :param domain_name: + :type domain_name: str + :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. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_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: CustomDomainResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.appplatform.models.CustomDomainResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete_async.metadata['url'] + path_format_arguments = { + 'DomainName': self._serialize.url("domain_name", domain_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_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.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', response) + if response.status_code == 204: + deserialized = self._deserialize('CustomDomainResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + delete_async.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} + + def patch_async( + self, domain_name, resource_group_name, service_name, app_name, properties=None, custom_headers=None, raw=False, **operation_config): + """Update custom domain of one lifecycle application. + + :param domain_name: + :type domain_name: str + :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. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param properties: Properties of the custom domain resource. + :type properties: + ~azure.mgmt.appplatform.models.CustomDomainProperties + :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: CustomDomainResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.appplatform.models.CustomDomainResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + domain_resource = models.CustomDomainResource(properties=properties) + + # Construct URL + url = self.patch_async.metadata['url'] + path_format_arguments = { + 'DomainName': self._serialize.url("domain_name", domain_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_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 + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + patch_async.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} + + def list_async( + self, domain_name, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + """List the custom domains of one lifecycle application. + + :param domain_name: + :type domain_name: str + :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. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_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: CustomDomainResourceCollection or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.appplatform.models.CustomDomainResourceCollection + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_async.metadata['url'] + path_format_arguments = { + 'DomainName': self._serialize.url("domain_name", domain_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResourceCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_async.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_deployments_operations.py index 9d07e4221749..3fe638e1abe3 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_deployments_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_deployments_operations.py @@ -113,9 +113,7 @@ def get( def _create_or_update_initial( self, resource_group_name, service_name, app_name, deployment_name, properties=None, custom_headers=None, raw=False, **operation_config): - deployment_resource = None - if properties is not None: - deployment_resource = models.DeploymentResource(properties=properties) + deployment_resource = models.DeploymentResource(properties=properties) # Construct URL url = self.create_or_update.metadata['url'] @@ -144,10 +142,7 @@ def _create_or_update_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - if deployment_resource is not None: - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - else: - body_content = None + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) @@ -294,9 +289,7 @@ def delete( def _update_initial( self, resource_group_name, service_name, app_name, deployment_name, properties=None, custom_headers=None, raw=False, **operation_config): - deployment_resource = None - if properties is not None: - deployment_resource = models.DeploymentResource(properties=properties) + deployment_resource = models.DeploymentResource(properties=properties) # Construct URL url = self.update.metadata['url'] @@ -325,10 +318,7 @@ def _update_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - if deployment_resource is not None: - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - else: - body_content = None + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') # Construct and send request request = self._client.patch(url, query_parameters, header_parameters, body_content) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_health_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_health_operations.py new file mode 100644 index 000000000000..6dc46c0763cd --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_health_operations.py @@ -0,0 +1,83 @@ +# 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 msrestazure.azure_exceptions import CloudError + +from .. import models + + +class HealthOperations(object): + """HealthOperations 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: Client Api Version. Constant value: "2019-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-05-01-preview" + + self.config = config + + def get( + self, custom_headers=None, raw=False, **operation_config): + """ + + :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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + + # 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.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + get.metadata = {'url': '/internal/health'} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_services_operations.py index 95a200815e9d..eea8c269d105 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_services_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_services_operations.py @@ -106,7 +106,7 @@ def get( def _create_or_update_initial( - self, resource_group_name, service_name, resource=None, custom_headers=None, raw=False, **operation_config): + self, resource, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { @@ -132,10 +132,7 @@ def _create_or_update_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - if resource is not None: - body_content = self._serialize.body(resource, 'ServiceResource') - else: - body_content = None + body_content = self._serialize.body(resource, 'ServiceResource') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) @@ -160,17 +157,17 @@ def _create_or_update_initial( return deserialized def create_or_update( - self, resource_group_name, service_name, resource=None, custom_headers=None, raw=False, polling=True, **operation_config): + self, resource, resource_group_name, service_name, custom_headers=None, raw=False, polling=True, **operation_config): """Create a new Service or update an exiting Service. + :param resource: Parameters for the create or update operation + :type resource: ~azure.mgmt.appplatform.models.ServiceResource :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. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param resource: Parameters for the create or update operation - :type resource: ~azure.mgmt.appplatform.models.ServiceResource :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 @@ -185,9 +182,9 @@ def create_or_update( :raises: :class:`CloudError` """ raw_result = self._create_or_update_initial( + resource=resource, resource_group_name=resource_group_name, service_name=service_name, - resource=resource, custom_headers=custom_headers, raw=True, **operation_config @@ -294,7 +291,7 @@ def get_long_running_output(response): def _update_initial( - self, resource_group_name, service_name, resource=None, custom_headers=None, raw=False, **operation_config): + self, resource, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.update.metadata['url'] path_format_arguments = { @@ -320,10 +317,7 @@ def _update_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - if resource is not None: - body_content = self._serialize.body(resource, 'ServiceResource') - else: - body_content = None + body_content = self._serialize.body(resource, 'ServiceResource') # Construct and send request request = self._client.patch(url, query_parameters, header_parameters, body_content) @@ -348,17 +342,17 @@ def _update_initial( return deserialized def update( - self, resource_group_name, service_name, resource=None, custom_headers=None, raw=False, polling=True, **operation_config): + self, resource, resource_group_name, service_name, custom_headers=None, raw=False, polling=True, **operation_config): """Operation to update an exiting Service. + :param resource: Parameters for the update operation + :type resource: ~azure.mgmt.appplatform.models.ServiceResource :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. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param resource: Parameters for the update operation - :type resource: ~azure.mgmt.appplatform.models.ServiceResource :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 @@ -373,9 +367,9 @@ def update( :raises: :class:`CloudError` """ raw_result = self._update_initial( + resource=resource, resource_group_name=resource_group_name, service_name=service_name, - resource=resource, custom_headers=custom_headers, raw=True, **operation_config @@ -485,9 +479,7 @@ def regenerate_test_key( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - regenerate_test_key_request = None - if key_type is not None: - regenerate_test_key_request = models.RegenerateTestKeyRequestPayload(key_type=key_type) + regenerate_test_key_request = models.RegenerateTestKeyRequestPayload(key_type=key_type) # Construct URL url = self.regenerate_test_key.metadata['url'] @@ -514,10 +506,7 @@ def regenerate_test_key( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - if regenerate_test_key_request is not None: - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - else: - body_content = None + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') # Construct and send request request = self._client.post(url, query_parameters, header_parameters, body_content) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_sku_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_sku_operations.py new file mode 100644 index 000000000000..8e34f02abc12 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_sku_operations.py @@ -0,0 +1,91 @@ +# 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 msrestazure.azure_exceptions import CloudError + +from .. import models + + +class SkuOperations(object): + """SkuOperations 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: Client Api Version. Constant value: "2019-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-05-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """ + + :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: ResourceTypeSkuCollection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.appplatform.models.ResourceTypeSkuCollection or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list.metadata['url'] + + # 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceTypeSkuCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/skus'}