diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_deployment_scripts_client.py index 52fe055e9c75..f84c15f7ecb6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_deployment_scripts_client.py @@ -46,7 +46,7 @@ class DeploymentScriptsClient(MultiApiClientMixin, SDKClient): :type profile: azure.profiles.KnownProfiles """ - DEFAULT_API_VERSION = '2019-10-01-preview' + DEFAULT_API_VERSION = '2020-10-01' _PROFILE_TAG = "azure.mgmt.resource.deploymentscripts.DeploymentScriptsClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -72,22 +72,36 @@ def _models_dict(cls, api_version): def models(cls, api_version=DEFAULT_API_VERSION): """Module depends on the API version: + * 2019-10-01-preview: :mod:`v2019_10_01_preview.models` * 2019-10-01-preview: :mod:`v2019_10_preview.models` + * 2020-10-01: :mod:`v2020_10_01.models` """ if api_version == '2019-10-01-preview': + from .v2019_10_01_preview import models + return models + elif api_version == '2019-10-01-preview': from .v2019_10_preview import models return models + elif api_version == '2020-10-01': + from .v2020_10_01 import models + return models raise NotImplementedError("APIVersion {} is not available".format(api_version)) @property def deployment_scripts(self): """Instance depends on the API version: + * 2019-10-01-preview: :class:`DeploymentScriptsOperations` * 2019-10-01-preview: :class:`DeploymentScriptsOperations` + * 2020-10-01: :class:`DeploymentScriptsOperations` """ api_version = self._get_api_version('deployment_scripts') if api_version == '2019-10-01-preview': + from .v2019_10_01_preview.operations import DeploymentScriptsOperations as OperationClass + elif api_version == '2019-10-01-preview': from .v2019_10_preview.operations import DeploymentScriptsOperations as OperationClass + elif api_version == '2020-10-01': + from .v2020_10_01.operations import DeploymentScriptsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/models.py index b44e4943769f..3a453a73ab82 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/models.py @@ -4,4 +4,4 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2019_10_preview.models import * +from .v2020_10_01.models import * diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/__init__.py new file mode 100644 index 000000000000..08e241ee1ed8 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import DeploymentScriptsClientConfiguration +from ._deployment_scripts_client import DeploymentScriptsClient +__all__ = ['DeploymentScriptsClient', 'DeploymentScriptsClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_configuration.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_configuration.py new file mode 100644 index 000000000000..142be065a596 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_configuration.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class DeploymentScriptsClientConfiguration(AzureConfiguration): + """Configuration for DeploymentScriptsClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription Id which forms part of the URI for + every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(DeploymentScriptsClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-resource/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py new file mode 100644 index 000000000000..7ad792dc361c --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import DeploymentScriptsClientConfiguration +from .operations import DeploymentScriptsOperations +from . import models + + +class DeploymentScriptsClient(SDKClient): + """The APIs listed in this specification can be used to manage Deployment Scripts resource through the Azure Resource Manager. + + :ivar config: Configuration for client. + :vartype config: DeploymentScriptsClientConfiguration + + :ivar deployment_scripts: DeploymentScripts operations + :vartype deployment_scripts: azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.operations.DeploymentScriptsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription Id which forms part of the URI for + every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = DeploymentScriptsClientConfiguration(credentials, subscription_id, base_url) + super(DeploymentScriptsClient, 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 = '2019-10-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.deployment_scripts = DeploymentScriptsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/__init__.py new file mode 100644 index 000000000000..6dd3003be147 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/__init__.py @@ -0,0 +1,79 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AzureCliScript + from ._models_py3 import AzurePowerShellScript + from ._models_py3 import AzureResourceBase + from ._models_py3 import ContainerConfiguration + from ._models_py3 import DeploymentScript + from ._models_py3 import DeploymentScriptsError, DeploymentScriptsErrorException + from ._models_py3 import DeploymentScriptUpdateParameter + from ._models_py3 import EnvironmentVariable + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import ManagedServiceIdentity + from ._models_py3 import ScriptLog + from ._models_py3 import ScriptLogsList + from ._models_py3 import ScriptStatus + from ._models_py3 import StorageAccountConfiguration + from ._models_py3 import SystemData + from ._models_py3 import UserAssignedIdentity +except (SyntaxError, ImportError): + from ._models import AzureCliScript + from ._models import AzurePowerShellScript + from ._models import AzureResourceBase + from ._models import ContainerConfiguration + from ._models import DeploymentScript + from ._models import DeploymentScriptsError, DeploymentScriptsErrorException + from ._models import DeploymentScriptUpdateParameter + from ._models import EnvironmentVariable + from ._models import ErrorAdditionalInfo + from ._models import ErrorResponse + from ._models import ManagedServiceIdentity + from ._models import ScriptLog + from ._models import ScriptLogsList + from ._models import ScriptStatus + from ._models import StorageAccountConfiguration + from ._models import SystemData + from ._models import UserAssignedIdentity +from ._paged_models import DeploymentScriptPaged +from ._deployment_scripts_client_enums import ( + ManagedServiceIdentityType, + CreatedByType, + CleanupOptions, + ScriptProvisioningState, +) + +__all__ = [ + 'AzureCliScript', + 'AzurePowerShellScript', + 'AzureResourceBase', + 'ContainerConfiguration', + 'DeploymentScript', + 'DeploymentScriptsError', 'DeploymentScriptsErrorException', + 'DeploymentScriptUpdateParameter', + 'EnvironmentVariable', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'ManagedServiceIdentity', + 'ScriptLog', + 'ScriptLogsList', + 'ScriptStatus', + 'StorageAccountConfiguration', + 'SystemData', + 'UserAssignedIdentity', + 'DeploymentScriptPaged', + 'ManagedServiceIdentityType', + 'CreatedByType', + 'CleanupOptions', + 'ScriptProvisioningState', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_deployment_scripts_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_deployment_scripts_client_enums.py new file mode 100644 index 000000000000..b59700cab06f --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_deployment_scripts_client_enums.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class ManagedServiceIdentityType(str, Enum): + + user_assigned = "UserAssigned" + + +class CreatedByType(str, Enum): + + user = "User" + application = "Application" + managed_identity = "ManagedIdentity" + key = "Key" + + +class CleanupOptions(str, Enum): + + always = "Always" + on_success = "OnSuccess" + on_expiration = "OnExpiration" + + +class ScriptProvisioningState(str, Enum): + + creating = "Creating" + provisioning_resources = "ProvisioningResources" + running = "Running" + succeeded = "Succeeded" + failed = "Failed" + canceled = "Canceled" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models.py new file mode 100644 index 000000000000..f7a7c155a66f --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models.py @@ -0,0 +1,927 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AzureResourceBase(Model): + """Common properties for all Azure resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureResourceBase, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class DeploymentScript(AzureResourceBase): + """Deployment script object. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzurePowerShellScript, AzureCliScript + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param identity: Required. Managed identity to be used for this deployment + script. Currently, only user-assigned MSI is supported. + :type identity: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ManagedServiceIdentity + :param location: Required. The location of the ACI and the storage account + for the deployment script. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar system_data: The system metadata related to this resource. + :vartype system_data: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.SystemData + :param kind: Required. Constant filled by server. + :type kind: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'identity': {'required': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'AzurePowerShell': 'AzurePowerShellScript', 'AzureCLI': 'AzureCliScript'} + } + + def __init__(self, **kwargs): + super(DeploymentScript, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.system_data = None + self.kind = None + self.kind = 'DeploymentScript' + + +class AzureCliScript(DeploymentScript): + """Object model for the Azure CLI script. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param identity: Required. Managed identity to be used for this deployment + script. Currently, only user-assigned MSI is supported. + :type identity: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ManagedServiceIdentity + :param location: Required. The location of the ACI and the storage account + for the deployment script. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar system_data: The system metadata related to this resource. + :vartype system_data: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.SystemData + :param kind: Required. Constant filled by server. + :type kind: str + :param container_settings: Container settings. + :type container_settings: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ContainerConfiguration + :param storage_account_settings: Storage Account settings. + :type storage_account_settings: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration + :param cleanup_preference: The clean up preference when the script + execution gets in a terminal state. Default setting is 'Always'. Possible + values include: 'Always', 'OnSuccess', 'OnExpiration' + :type cleanup_preference: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions + :ivar provisioning_state: State of the script execution. This only appears + in the response. Possible values include: 'Creating', + 'ProvisioningResources', 'Running', 'Succeeded', 'Failed', 'Canceled' + :vartype provisioning_state: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptProvisioningState + :ivar status: Contains the results of script execution. + :vartype status: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptStatus + :ivar outputs: List of script outputs. + :vartype outputs: dict[str, object] + :param primary_script_uri: Uri for the script. This is the entry point for + the external script. + :type primary_script_uri: str + :param supporting_script_uris: Supporting files for the external script. + :type supporting_script_uris: list[str] + :param script_content: Script body. + :type script_content: str + :param arguments: Command line arguments to pass to the script. Arguments + are separated by spaces. ex: -Name blue* -Location 'West US 2' + :type arguments: str + :param environment_variables: The environment variables to pass over to + the script. + :type environment_variables: + list[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.EnvironmentVariable] + :param force_update_tag: Gets or sets how the deployment script should be + forced to execute even if the script resource has not changed. Can be + current time stamp or a GUID. + :type force_update_tag: str + :param retention_interval: Required. Interval for which the service + retains the script resource after it reaches a terminal state. Resource + will be deleted when this duration expires. Duration is based on ISO 8601 + pattern (for example P7D means one week). + :type retention_interval: timedelta + :param timeout: Maximum allowed script execution time specified in ISO + 8601 format. Default value is PT1H + :type timeout: timedelta + :param az_cli_version: Required. Azure CLI module version to be used. + :type az_cli_version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'identity': {'required': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'outputs': {'readonly': True}, + 'script_content': {'max_length': 32000}, + 'retention_interval': {'required': True}, + 'az_cli_version': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'container_settings': {'key': 'properties.containerSettings', 'type': 'ContainerConfiguration'}, + 'storage_account_settings': {'key': 'properties.storageAccountSettings', 'type': 'StorageAccountConfiguration'}, + 'cleanup_preference': {'key': 'properties.cleanupPreference', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'ScriptStatus'}, + 'outputs': {'key': 'properties.outputs', 'type': '{object}'}, + 'primary_script_uri': {'key': 'properties.primaryScriptUri', 'type': 'str'}, + 'supporting_script_uris': {'key': 'properties.supportingScriptUris', 'type': '[str]'}, + 'script_content': {'key': 'properties.scriptContent', 'type': 'str'}, + 'arguments': {'key': 'properties.arguments', 'type': 'str'}, + 'environment_variables': {'key': 'properties.environmentVariables', 'type': '[EnvironmentVariable]'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'retention_interval': {'key': 'properties.retentionInterval', 'type': 'duration'}, + 'timeout': {'key': 'properties.timeout', 'type': 'duration'}, + 'az_cli_version': {'key': 'properties.azCliVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureCliScript, self).__init__(**kwargs) + self.container_settings = kwargs.get('container_settings', None) + self.storage_account_settings = kwargs.get('storage_account_settings', None) + self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.provisioning_state = None + self.status = None + self.outputs = None + self.primary_script_uri = kwargs.get('primary_script_uri', None) + self.supporting_script_uris = kwargs.get('supporting_script_uris', None) + self.script_content = kwargs.get('script_content', None) + self.arguments = kwargs.get('arguments', None) + self.environment_variables = kwargs.get('environment_variables', None) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.retention_interval = kwargs.get('retention_interval', None) + self.timeout = kwargs.get('timeout', None) + self.az_cli_version = kwargs.get('az_cli_version', None) + self.kind = 'AzureCLI' + + +class AzurePowerShellScript(DeploymentScript): + """Object model for the Azure PowerShell script. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param identity: Required. Managed identity to be used for this deployment + script. Currently, only user-assigned MSI is supported. + :type identity: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ManagedServiceIdentity + :param location: Required. The location of the ACI and the storage account + for the deployment script. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar system_data: The system metadata related to this resource. + :vartype system_data: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.SystemData + :param kind: Required. Constant filled by server. + :type kind: str + :param container_settings: Container settings. + :type container_settings: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ContainerConfiguration + :param storage_account_settings: Storage Account settings. + :type storage_account_settings: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration + :param cleanup_preference: The clean up preference when the script + execution gets in a terminal state. Default setting is 'Always'. Possible + values include: 'Always', 'OnSuccess', 'OnExpiration' + :type cleanup_preference: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions + :ivar provisioning_state: State of the script execution. This only appears + in the response. Possible values include: 'Creating', + 'ProvisioningResources', 'Running', 'Succeeded', 'Failed', 'Canceled' + :vartype provisioning_state: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptProvisioningState + :ivar status: Contains the results of script execution. + :vartype status: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptStatus + :ivar outputs: List of script outputs. + :vartype outputs: dict[str, object] + :param primary_script_uri: Uri for the script. This is the entry point for + the external script. + :type primary_script_uri: str + :param supporting_script_uris: Supporting files for the external script. + :type supporting_script_uris: list[str] + :param script_content: Script body. + :type script_content: str + :param arguments: Command line arguments to pass to the script. Arguments + are separated by spaces. ex: -Name blue* -Location 'West US 2' + :type arguments: str + :param environment_variables: The environment variables to pass over to + the script. + :type environment_variables: + list[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.EnvironmentVariable] + :param force_update_tag: Gets or sets how the deployment script should be + forced to execute even if the script resource has not changed. Can be + current time stamp or a GUID. + :type force_update_tag: str + :param retention_interval: Required. Interval for which the service + retains the script resource after it reaches a terminal state. Resource + will be deleted when this duration expires. Duration is based on ISO 8601 + pattern (for example P7D means one week). + :type retention_interval: timedelta + :param timeout: Maximum allowed script execution time specified in ISO + 8601 format. Default value is PT1H + :type timeout: timedelta + :param az_power_shell_version: Required. Azure PowerShell module version + to be used. + :type az_power_shell_version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'identity': {'required': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'outputs': {'readonly': True}, + 'script_content': {'max_length': 32000}, + 'retention_interval': {'required': True}, + 'az_power_shell_version': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'container_settings': {'key': 'properties.containerSettings', 'type': 'ContainerConfiguration'}, + 'storage_account_settings': {'key': 'properties.storageAccountSettings', 'type': 'StorageAccountConfiguration'}, + 'cleanup_preference': {'key': 'properties.cleanupPreference', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'ScriptStatus'}, + 'outputs': {'key': 'properties.outputs', 'type': '{object}'}, + 'primary_script_uri': {'key': 'properties.primaryScriptUri', 'type': 'str'}, + 'supporting_script_uris': {'key': 'properties.supportingScriptUris', 'type': '[str]'}, + 'script_content': {'key': 'properties.scriptContent', 'type': 'str'}, + 'arguments': {'key': 'properties.arguments', 'type': 'str'}, + 'environment_variables': {'key': 'properties.environmentVariables', 'type': '[EnvironmentVariable]'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'retention_interval': {'key': 'properties.retentionInterval', 'type': 'duration'}, + 'timeout': {'key': 'properties.timeout', 'type': 'duration'}, + 'az_power_shell_version': {'key': 'properties.azPowerShellVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzurePowerShellScript, self).__init__(**kwargs) + self.container_settings = kwargs.get('container_settings', None) + self.storage_account_settings = kwargs.get('storage_account_settings', None) + self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.provisioning_state = None + self.status = None + self.outputs = None + self.primary_script_uri = kwargs.get('primary_script_uri', None) + self.supporting_script_uris = kwargs.get('supporting_script_uris', None) + self.script_content = kwargs.get('script_content', None) + self.arguments = kwargs.get('arguments', None) + self.environment_variables = kwargs.get('environment_variables', None) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.retention_interval = kwargs.get('retention_interval', None) + self.timeout = kwargs.get('timeout', None) + self.az_power_shell_version = kwargs.get('az_power_shell_version', None) + self.kind = 'AzurePowerShell' + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ContainerConfiguration(Model): + """Settings to customize ACI container instance. + + :param container_group_name: Container group name, if not specified then + the name will get auto-generated. Not specifying a 'containerGroupName' + indicates the system to generate a unique name which might end up flagging + an Azure Policy as non-compliant. Use 'containerGroupName' when you have + an Azure Policy that expects a specific naming convention or when you want + to fully control the name. 'containerGroupName' property must be between 1 + and 63 characters long, must contain only lowercase letters, numbers, and + dashes and it cannot start or end with a dash and consecutive dashes are + not allowed. To specify a 'containerGroupName', add the following object + to properties: { "containerSettings": { "containerGroupName": + "contoso-container" } }. If you do not want to specify a + 'containerGroupName' then do not add 'containerSettings' property. + :type container_group_name: str + """ + + _validation = { + 'container_group_name': {'max_length': 63, 'min_length': 1}, + } + + _attribute_map = { + 'container_group_name': {'key': 'containerGroupName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ContainerConfiguration, self).__init__(**kwargs) + self.container_group_name = kwargs.get('container_group_name', None) + + +class DeploymentScriptPropertiesBase(Model): + """Common properties for the deployment script. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param container_settings: Container settings. + :type container_settings: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ContainerConfiguration + :param storage_account_settings: Storage Account settings. + :type storage_account_settings: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration + :param cleanup_preference: The clean up preference when the script + execution gets in a terminal state. Default setting is 'Always'. Possible + values include: 'Always', 'OnSuccess', 'OnExpiration' + :type cleanup_preference: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions + :ivar provisioning_state: State of the script execution. This only appears + in the response. Possible values include: 'Creating', + 'ProvisioningResources', 'Running', 'Succeeded', 'Failed', 'Canceled' + :vartype provisioning_state: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptProvisioningState + :ivar status: Contains the results of script execution. + :vartype status: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptStatus + :ivar outputs: List of script outputs. + :vartype outputs: dict[str, object] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'outputs': {'readonly': True}, + } + + _attribute_map = { + 'container_settings': {'key': 'containerSettings', 'type': 'ContainerConfiguration'}, + 'storage_account_settings': {'key': 'storageAccountSettings', 'type': 'StorageAccountConfiguration'}, + 'cleanup_preference': {'key': 'cleanupPreference', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ScriptStatus'}, + 'outputs': {'key': 'outputs', 'type': '{object}'}, + } + + def __init__(self, **kwargs): + super(DeploymentScriptPropertiesBase, self).__init__(**kwargs) + self.container_settings = kwargs.get('container_settings', None) + self.storage_account_settings = kwargs.get('storage_account_settings', None) + self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.provisioning_state = None + self.status = None + self.outputs = None + + +class DeploymentScriptsError(Model): + """Deployment scripts error response. + + :param error: + :type error: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(DeploymentScriptsError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class DeploymentScriptsErrorException(HttpOperationError): + """Server responsed with exception of type: 'DeploymentScriptsError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(DeploymentScriptsErrorException, self).__init__(deserialize, response, 'DeploymentScriptsError', *args) + + +class DeploymentScriptUpdateParameter(AzureResourceBase): + """Deployment script parameters to be updated. . + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param tags: Resource tags to be updated. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(DeploymentScriptUpdateParameter, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class EnvironmentVariable(Model): + """The environment variable to pass to the script in the container instance. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the environment variable. + :type name: str + :param value: The value of the environment variable. + :type value: str + :param secure_value: The value of the secure environment variable. + :type secure_value: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'secure_value': {'key': 'secureValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EnvironmentVariable, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + self.secure_value = kwargs.get('secure_value', None) + + +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 ErrorResponse(Model): + """The resource management error response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ManagedServiceIdentity(Model): + """Managed identity generic object. + + :param type: Type of the managed identity. Possible values include: + 'UserAssigned' + :type type: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ManagedServiceIdentityType + :param user_assigned_identities: The list of user-assigned managed + identities associated with the resource. Key is the Azure resource Id of + the managed identity. + :type user_assigned_identities: dict[str, + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.UserAssignedIdentity] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__(self, **kwargs): + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class ScriptConfigurationBase(Model): + """Common configuration settings for both Azure PowerShell and Azure CLI + scripts. + + All required parameters must be populated in order to send to Azure. + + :param primary_script_uri: Uri for the script. This is the entry point for + the external script. + :type primary_script_uri: str + :param supporting_script_uris: Supporting files for the external script. + :type supporting_script_uris: list[str] + :param script_content: Script body. + :type script_content: str + :param arguments: Command line arguments to pass to the script. Arguments + are separated by spaces. ex: -Name blue* -Location 'West US 2' + :type arguments: str + :param environment_variables: The environment variables to pass over to + the script. + :type environment_variables: + list[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.EnvironmentVariable] + :param force_update_tag: Gets or sets how the deployment script should be + forced to execute even if the script resource has not changed. Can be + current time stamp or a GUID. + :type force_update_tag: str + :param retention_interval: Required. Interval for which the service + retains the script resource after it reaches a terminal state. Resource + will be deleted when this duration expires. Duration is based on ISO 8601 + pattern (for example P7D means one week). + :type retention_interval: timedelta + :param timeout: Maximum allowed script execution time specified in ISO + 8601 format. Default value is PT1H + :type timeout: timedelta + """ + + _validation = { + 'script_content': {'max_length': 32000}, + 'retention_interval': {'required': True}, + } + + _attribute_map = { + 'primary_script_uri': {'key': 'primaryScriptUri', 'type': 'str'}, + 'supporting_script_uris': {'key': 'supportingScriptUris', 'type': '[str]'}, + 'script_content': {'key': 'scriptContent', 'type': 'str'}, + 'arguments': {'key': 'arguments', 'type': 'str'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '[EnvironmentVariable]'}, + 'force_update_tag': {'key': 'forceUpdateTag', 'type': 'str'}, + 'retention_interval': {'key': 'retentionInterval', 'type': 'duration'}, + 'timeout': {'key': 'timeout', 'type': 'duration'}, + } + + def __init__(self, **kwargs): + super(ScriptConfigurationBase, self).__init__(**kwargs) + self.primary_script_uri = kwargs.get('primary_script_uri', None) + self.supporting_script_uris = kwargs.get('supporting_script_uris', None) + self.script_content = kwargs.get('script_content', None) + self.arguments = kwargs.get('arguments', None) + self.environment_variables = kwargs.get('environment_variables', None) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.retention_interval = kwargs.get('retention_interval', None) + self.timeout = kwargs.get('timeout', None) + + +class ScriptLog(AzureResourceBase): + """Script execution log object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :ivar log: Script execution logs in text format. + :vartype log: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'log': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'log': {'key': 'properties.log', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ScriptLog, self).__init__(**kwargs) + self.log = None + + +class ScriptLogsList(Model): + """Deployment script execution logs. + + :param value: Deployment scripts logs. + :type value: + list[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptLog] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScriptLog]'}, + } + + def __init__(self, **kwargs): + super(ScriptLogsList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ScriptStatus(Model): + """Generic object modeling results of script execution. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar container_instance_id: ACI resource Id. + :vartype container_instance_id: str + :ivar storage_account_id: Storage account resource Id. + :vartype storage_account_id: str + :ivar start_time: Start time of the script execution. + :vartype start_time: datetime + :ivar end_time: End time of the script execution. + :vartype end_time: datetime + :ivar expiration_time: Time the deployment script resource will expire. + :vartype expiration_time: datetime + :param error: Error that is relayed from the script execution. + :type error: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ErrorResponse + """ + + _validation = { + 'container_instance_id': {'readonly': True}, + 'storage_account_id': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'expiration_time': {'readonly': True}, + } + + _attribute_map = { + 'container_instance_id': {'key': 'containerInstanceId', 'type': 'str'}, + 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'expiration_time': {'key': 'expirationTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(ScriptStatus, self).__init__(**kwargs) + self.container_instance_id = None + self.storage_account_id = None + self.start_time = None + self.end_time = None + self.expiration_time = None + self.error = kwargs.get('error', None) + + +class StorageAccountConfiguration(Model): + """Settings to use an existing storage account. Valid storage account kinds + are: Storage, StorageV2 and FileStorage. + + :param storage_account_name: The storage account name. + :type storage_account_name: str + :param storage_account_key: The storage account access key. + :type storage_account_key: str + """ + + _attribute_map = { + 'storage_account_name': {'key': 'storageAccountName', 'type': 'str'}, + 'storage_account_key': {'key': 'storageAccountKey', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(StorageAccountConfiguration, self).__init__(**kwargs) + self.storage_account_name = kwargs.get('storage_account_name', None) + self.storage_account_key = kwargs.get('storage_account_key', None) + + +class SystemData(Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. + Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + :type created_by_type: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the + resource. Possible values include: 'User', 'Application', + 'ManagedIdentity', 'Key' + :type last_modified_by_type: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CreatedByType + :param last_modified_at: The type of identity that last modified the + resource. + :type last_modified_at: datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class UserAssignedIdentity(Model): + """User-assigned managed identity. + + :param principal_id: Azure Active Directory principal ID associated with + this identity. + :type principal_id: str + :param client_id: Client App Id associated with this identity. + :type client_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.client_id = kwargs.get('client_id', None) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..6a75f9a8bba3 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py @@ -0,0 +1,927 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AzureResourceBase(Model): + """Common properties for all Azure resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(AzureResourceBase, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class DeploymentScript(AzureResourceBase): + """Deployment script object. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzurePowerShellScript, AzureCliScript + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param identity: Required. Managed identity to be used for this deployment + script. Currently, only user-assigned MSI is supported. + :type identity: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ManagedServiceIdentity + :param location: Required. The location of the ACI and the storage account + for the deployment script. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar system_data: The system metadata related to this resource. + :vartype system_data: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.SystemData + :param kind: Required. Constant filled by server. + :type kind: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'identity': {'required': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'AzurePowerShell': 'AzurePowerShellScript', 'AzureCLI': 'AzureCliScript'} + } + + def __init__(self, *, identity, location: str, tags=None, **kwargs) -> None: + super(DeploymentScript, self).__init__(**kwargs) + self.identity = identity + self.location = location + self.tags = tags + self.system_data = None + self.kind = None + self.kind = 'DeploymentScript' + + +class AzureCliScript(DeploymentScript): + """Object model for the Azure CLI script. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param identity: Required. Managed identity to be used for this deployment + script. Currently, only user-assigned MSI is supported. + :type identity: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ManagedServiceIdentity + :param location: Required. The location of the ACI and the storage account + for the deployment script. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar system_data: The system metadata related to this resource. + :vartype system_data: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.SystemData + :param kind: Required. Constant filled by server. + :type kind: str + :param container_settings: Container settings. + :type container_settings: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ContainerConfiguration + :param storage_account_settings: Storage Account settings. + :type storage_account_settings: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration + :param cleanup_preference: The clean up preference when the script + execution gets in a terminal state. Default setting is 'Always'. Possible + values include: 'Always', 'OnSuccess', 'OnExpiration' + :type cleanup_preference: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions + :ivar provisioning_state: State of the script execution. This only appears + in the response. Possible values include: 'Creating', + 'ProvisioningResources', 'Running', 'Succeeded', 'Failed', 'Canceled' + :vartype provisioning_state: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptProvisioningState + :ivar status: Contains the results of script execution. + :vartype status: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptStatus + :ivar outputs: List of script outputs. + :vartype outputs: dict[str, object] + :param primary_script_uri: Uri for the script. This is the entry point for + the external script. + :type primary_script_uri: str + :param supporting_script_uris: Supporting files for the external script. + :type supporting_script_uris: list[str] + :param script_content: Script body. + :type script_content: str + :param arguments: Command line arguments to pass to the script. Arguments + are separated by spaces. ex: -Name blue* -Location 'West US 2' + :type arguments: str + :param environment_variables: The environment variables to pass over to + the script. + :type environment_variables: + list[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.EnvironmentVariable] + :param force_update_tag: Gets or sets how the deployment script should be + forced to execute even if the script resource has not changed. Can be + current time stamp or a GUID. + :type force_update_tag: str + :param retention_interval: Required. Interval for which the service + retains the script resource after it reaches a terminal state. Resource + will be deleted when this duration expires. Duration is based on ISO 8601 + pattern (for example P7D means one week). + :type retention_interval: timedelta + :param timeout: Maximum allowed script execution time specified in ISO + 8601 format. Default value is PT1H + :type timeout: timedelta + :param az_cli_version: Required. Azure CLI module version to be used. + :type az_cli_version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'identity': {'required': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'outputs': {'readonly': True}, + 'script_content': {'max_length': 32000}, + 'retention_interval': {'required': True}, + 'az_cli_version': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'container_settings': {'key': 'properties.containerSettings', 'type': 'ContainerConfiguration'}, + 'storage_account_settings': {'key': 'properties.storageAccountSettings', 'type': 'StorageAccountConfiguration'}, + 'cleanup_preference': {'key': 'properties.cleanupPreference', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'ScriptStatus'}, + 'outputs': {'key': 'properties.outputs', 'type': '{object}'}, + 'primary_script_uri': {'key': 'properties.primaryScriptUri', 'type': 'str'}, + 'supporting_script_uris': {'key': 'properties.supportingScriptUris', 'type': '[str]'}, + 'script_content': {'key': 'properties.scriptContent', 'type': 'str'}, + 'arguments': {'key': 'properties.arguments', 'type': 'str'}, + 'environment_variables': {'key': 'properties.environmentVariables', 'type': '[EnvironmentVariable]'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'retention_interval': {'key': 'properties.retentionInterval', 'type': 'duration'}, + 'timeout': {'key': 'properties.timeout', 'type': 'duration'}, + 'az_cli_version': {'key': 'properties.azCliVersion', 'type': 'str'}, + } + + def __init__(self, *, identity, location: str, retention_interval, az_cli_version: str, tags=None, container_settings=None, storage_account_settings=None, cleanup_preference=None, primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout=None, **kwargs) -> None: + super(AzureCliScript, self).__init__(identity=identity, location=location, tags=tags, **kwargs) + self.container_settings = container_settings + self.storage_account_settings = storage_account_settings + self.cleanup_preference = cleanup_preference + self.provisioning_state = None + self.status = None + self.outputs = None + self.primary_script_uri = primary_script_uri + self.supporting_script_uris = supporting_script_uris + self.script_content = script_content + self.arguments = arguments + self.environment_variables = environment_variables + self.force_update_tag = force_update_tag + self.retention_interval = retention_interval + self.timeout = timeout + self.az_cli_version = az_cli_version + self.kind = 'AzureCLI' + + +class AzurePowerShellScript(DeploymentScript): + """Object model for the Azure PowerShell script. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param identity: Required. Managed identity to be used for this deployment + script. Currently, only user-assigned MSI is supported. + :type identity: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ManagedServiceIdentity + :param location: Required. The location of the ACI and the storage account + for the deployment script. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar system_data: The system metadata related to this resource. + :vartype system_data: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.SystemData + :param kind: Required. Constant filled by server. + :type kind: str + :param container_settings: Container settings. + :type container_settings: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ContainerConfiguration + :param storage_account_settings: Storage Account settings. + :type storage_account_settings: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration + :param cleanup_preference: The clean up preference when the script + execution gets in a terminal state. Default setting is 'Always'. Possible + values include: 'Always', 'OnSuccess', 'OnExpiration' + :type cleanup_preference: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions + :ivar provisioning_state: State of the script execution. This only appears + in the response. Possible values include: 'Creating', + 'ProvisioningResources', 'Running', 'Succeeded', 'Failed', 'Canceled' + :vartype provisioning_state: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptProvisioningState + :ivar status: Contains the results of script execution. + :vartype status: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptStatus + :ivar outputs: List of script outputs. + :vartype outputs: dict[str, object] + :param primary_script_uri: Uri for the script. This is the entry point for + the external script. + :type primary_script_uri: str + :param supporting_script_uris: Supporting files for the external script. + :type supporting_script_uris: list[str] + :param script_content: Script body. + :type script_content: str + :param arguments: Command line arguments to pass to the script. Arguments + are separated by spaces. ex: -Name blue* -Location 'West US 2' + :type arguments: str + :param environment_variables: The environment variables to pass over to + the script. + :type environment_variables: + list[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.EnvironmentVariable] + :param force_update_tag: Gets or sets how the deployment script should be + forced to execute even if the script resource has not changed. Can be + current time stamp or a GUID. + :type force_update_tag: str + :param retention_interval: Required. Interval for which the service + retains the script resource after it reaches a terminal state. Resource + will be deleted when this duration expires. Duration is based on ISO 8601 + pattern (for example P7D means one week). + :type retention_interval: timedelta + :param timeout: Maximum allowed script execution time specified in ISO + 8601 format. Default value is PT1H + :type timeout: timedelta + :param az_power_shell_version: Required. Azure PowerShell module version + to be used. + :type az_power_shell_version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'identity': {'required': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'outputs': {'readonly': True}, + 'script_content': {'max_length': 32000}, + 'retention_interval': {'required': True}, + 'az_power_shell_version': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'container_settings': {'key': 'properties.containerSettings', 'type': 'ContainerConfiguration'}, + 'storage_account_settings': {'key': 'properties.storageAccountSettings', 'type': 'StorageAccountConfiguration'}, + 'cleanup_preference': {'key': 'properties.cleanupPreference', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'ScriptStatus'}, + 'outputs': {'key': 'properties.outputs', 'type': '{object}'}, + 'primary_script_uri': {'key': 'properties.primaryScriptUri', 'type': 'str'}, + 'supporting_script_uris': {'key': 'properties.supportingScriptUris', 'type': '[str]'}, + 'script_content': {'key': 'properties.scriptContent', 'type': 'str'}, + 'arguments': {'key': 'properties.arguments', 'type': 'str'}, + 'environment_variables': {'key': 'properties.environmentVariables', 'type': '[EnvironmentVariable]'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'retention_interval': {'key': 'properties.retentionInterval', 'type': 'duration'}, + 'timeout': {'key': 'properties.timeout', 'type': 'duration'}, + 'az_power_shell_version': {'key': 'properties.azPowerShellVersion', 'type': 'str'}, + } + + def __init__(self, *, identity, location: str, retention_interval, az_power_shell_version: str, tags=None, container_settings=None, storage_account_settings=None, cleanup_preference=None, primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout=None, **kwargs) -> None: + super(AzurePowerShellScript, self).__init__(identity=identity, location=location, tags=tags, **kwargs) + self.container_settings = container_settings + self.storage_account_settings = storage_account_settings + self.cleanup_preference = cleanup_preference + self.provisioning_state = None + self.status = None + self.outputs = None + self.primary_script_uri = primary_script_uri + self.supporting_script_uris = supporting_script_uris + self.script_content = script_content + self.arguments = arguments + self.environment_variables = environment_variables + self.force_update_tag = force_update_tag + self.retention_interval = retention_interval + self.timeout = timeout + self.az_power_shell_version = az_power_shell_version + self.kind = 'AzurePowerShell' + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ContainerConfiguration(Model): + """Settings to customize ACI container instance. + + :param container_group_name: Container group name, if not specified then + the name will get auto-generated. Not specifying a 'containerGroupName' + indicates the system to generate a unique name which might end up flagging + an Azure Policy as non-compliant. Use 'containerGroupName' when you have + an Azure Policy that expects a specific naming convention or when you want + to fully control the name. 'containerGroupName' property must be between 1 + and 63 characters long, must contain only lowercase letters, numbers, and + dashes and it cannot start or end with a dash and consecutive dashes are + not allowed. To specify a 'containerGroupName', add the following object + to properties: { "containerSettings": { "containerGroupName": + "contoso-container" } }. If you do not want to specify a + 'containerGroupName' then do not add 'containerSettings' property. + :type container_group_name: str + """ + + _validation = { + 'container_group_name': {'max_length': 63, 'min_length': 1}, + } + + _attribute_map = { + 'container_group_name': {'key': 'containerGroupName', 'type': 'str'}, + } + + def __init__(self, *, container_group_name: str=None, **kwargs) -> None: + super(ContainerConfiguration, self).__init__(**kwargs) + self.container_group_name = container_group_name + + +class DeploymentScriptPropertiesBase(Model): + """Common properties for the deployment script. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param container_settings: Container settings. + :type container_settings: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ContainerConfiguration + :param storage_account_settings: Storage Account settings. + :type storage_account_settings: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration + :param cleanup_preference: The clean up preference when the script + execution gets in a terminal state. Default setting is 'Always'. Possible + values include: 'Always', 'OnSuccess', 'OnExpiration' + :type cleanup_preference: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions + :ivar provisioning_state: State of the script execution. This only appears + in the response. Possible values include: 'Creating', + 'ProvisioningResources', 'Running', 'Succeeded', 'Failed', 'Canceled' + :vartype provisioning_state: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptProvisioningState + :ivar status: Contains the results of script execution. + :vartype status: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptStatus + :ivar outputs: List of script outputs. + :vartype outputs: dict[str, object] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'outputs': {'readonly': True}, + } + + _attribute_map = { + 'container_settings': {'key': 'containerSettings', 'type': 'ContainerConfiguration'}, + 'storage_account_settings': {'key': 'storageAccountSettings', 'type': 'StorageAccountConfiguration'}, + 'cleanup_preference': {'key': 'cleanupPreference', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ScriptStatus'}, + 'outputs': {'key': 'outputs', 'type': '{object}'}, + } + + def __init__(self, *, container_settings=None, storage_account_settings=None, cleanup_preference=None, **kwargs) -> None: + super(DeploymentScriptPropertiesBase, self).__init__(**kwargs) + self.container_settings = container_settings + self.storage_account_settings = storage_account_settings + self.cleanup_preference = cleanup_preference + self.provisioning_state = None + self.status = None + self.outputs = None + + +class DeploymentScriptsError(Model): + """Deployment scripts error response. + + :param error: + :type error: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(DeploymentScriptsError, self).__init__(**kwargs) + self.error = error + + +class DeploymentScriptsErrorException(HttpOperationError): + """Server responsed with exception of type: 'DeploymentScriptsError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(DeploymentScriptsErrorException, self).__init__(deserialize, response, 'DeploymentScriptsError', *args) + + +class DeploymentScriptUpdateParameter(AzureResourceBase): + """Deployment script parameters to be updated. . + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param tags: Resource tags to be updated. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(DeploymentScriptUpdateParameter, self).__init__(**kwargs) + self.tags = tags + + +class EnvironmentVariable(Model): + """The environment variable to pass to the script in the container instance. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the environment variable. + :type name: str + :param value: The value of the environment variable. + :type value: str + :param secure_value: The value of the secure environment variable. + :type secure_value: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'secure_value': {'key': 'secureValue', 'type': 'str'}, + } + + def __init__(self, *, name: str, value: str=None, secure_value: str=None, **kwargs) -> None: + super(EnvironmentVariable, self).__init__(**kwargs) + self.name = name + self.value = value + self.secure_value = secure_value + + +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 ErrorResponse(Model): + """The resource management error response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ManagedServiceIdentity(Model): + """Managed identity generic object. + + :param type: Type of the managed identity. Possible values include: + 'UserAssigned' + :type type: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ManagedServiceIdentityType + :param user_assigned_identities: The list of user-assigned managed + identities associated with the resource. Key is the Azure resource Id of + the managed identity. + :type user_assigned_identities: dict[str, + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.UserAssignedIdentity] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__(self, *, type=None, user_assigned_identities=None, **kwargs) -> None: + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ScriptConfigurationBase(Model): + """Common configuration settings for both Azure PowerShell and Azure CLI + scripts. + + All required parameters must be populated in order to send to Azure. + + :param primary_script_uri: Uri for the script. This is the entry point for + the external script. + :type primary_script_uri: str + :param supporting_script_uris: Supporting files for the external script. + :type supporting_script_uris: list[str] + :param script_content: Script body. + :type script_content: str + :param arguments: Command line arguments to pass to the script. Arguments + are separated by spaces. ex: -Name blue* -Location 'West US 2' + :type arguments: str + :param environment_variables: The environment variables to pass over to + the script. + :type environment_variables: + list[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.EnvironmentVariable] + :param force_update_tag: Gets or sets how the deployment script should be + forced to execute even if the script resource has not changed. Can be + current time stamp or a GUID. + :type force_update_tag: str + :param retention_interval: Required. Interval for which the service + retains the script resource after it reaches a terminal state. Resource + will be deleted when this duration expires. Duration is based on ISO 8601 + pattern (for example P7D means one week). + :type retention_interval: timedelta + :param timeout: Maximum allowed script execution time specified in ISO + 8601 format. Default value is PT1H + :type timeout: timedelta + """ + + _validation = { + 'script_content': {'max_length': 32000}, + 'retention_interval': {'required': True}, + } + + _attribute_map = { + 'primary_script_uri': {'key': 'primaryScriptUri', 'type': 'str'}, + 'supporting_script_uris': {'key': 'supportingScriptUris', 'type': '[str]'}, + 'script_content': {'key': 'scriptContent', 'type': 'str'}, + 'arguments': {'key': 'arguments', 'type': 'str'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '[EnvironmentVariable]'}, + 'force_update_tag': {'key': 'forceUpdateTag', 'type': 'str'}, + 'retention_interval': {'key': 'retentionInterval', 'type': 'duration'}, + 'timeout': {'key': 'timeout', 'type': 'duration'}, + } + + def __init__(self, *, retention_interval, primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout=None, **kwargs) -> None: + super(ScriptConfigurationBase, self).__init__(**kwargs) + self.primary_script_uri = primary_script_uri + self.supporting_script_uris = supporting_script_uris + self.script_content = script_content + self.arguments = arguments + self.environment_variables = environment_variables + self.force_update_tag = force_update_tag + self.retention_interval = retention_interval + self.timeout = timeout + + +class ScriptLog(AzureResourceBase): + """Script execution log object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :ivar log: Script execution logs in text format. + :vartype log: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'log': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'log': {'key': 'properties.log', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ScriptLog, self).__init__(**kwargs) + self.log = None + + +class ScriptLogsList(Model): + """Deployment script execution logs. + + :param value: Deployment scripts logs. + :type value: + list[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptLog] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScriptLog]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(ScriptLogsList, self).__init__(**kwargs) + self.value = value + + +class ScriptStatus(Model): + """Generic object modeling results of script execution. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar container_instance_id: ACI resource Id. + :vartype container_instance_id: str + :ivar storage_account_id: Storage account resource Id. + :vartype storage_account_id: str + :ivar start_time: Start time of the script execution. + :vartype start_time: datetime + :ivar end_time: End time of the script execution. + :vartype end_time: datetime + :ivar expiration_time: Time the deployment script resource will expire. + :vartype expiration_time: datetime + :param error: Error that is relayed from the script execution. + :type error: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ErrorResponse + """ + + _validation = { + 'container_instance_id': {'readonly': True}, + 'storage_account_id': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'expiration_time': {'readonly': True}, + } + + _attribute_map = { + 'container_instance_id': {'key': 'containerInstanceId', 'type': 'str'}, + 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'expiration_time': {'key': 'expirationTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ScriptStatus, self).__init__(**kwargs) + self.container_instance_id = None + self.storage_account_id = None + self.start_time = None + self.end_time = None + self.expiration_time = None + self.error = error + + +class StorageAccountConfiguration(Model): + """Settings to use an existing storage account. Valid storage account kinds + are: Storage, StorageV2 and FileStorage. + + :param storage_account_name: The storage account name. + :type storage_account_name: str + :param storage_account_key: The storage account access key. + :type storage_account_key: str + """ + + _attribute_map = { + 'storage_account_name': {'key': 'storageAccountName', 'type': 'str'}, + 'storage_account_key': {'key': 'storageAccountKey', 'type': 'str'}, + } + + def __init__(self, *, storage_account_name: str=None, storage_account_key: str=None, **kwargs) -> None: + super(StorageAccountConfiguration, self).__init__(**kwargs) + self.storage_account_name = storage_account_name + self.storage_account_key = storage_account_key + + +class SystemData(Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. + Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + :type created_by_type: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the + resource. Possible values include: 'User', 'Application', + 'ManagedIdentity', 'Key' + :type last_modified_by_type: str or + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CreatedByType + :param last_modified_at: The type of identity that last modified the + resource. + :type last_modified_at: datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__(self, *, created_by: str=None, created_by_type=None, created_at=None, last_modified_by: str=None, last_modified_by_type=None, last_modified_at=None, **kwargs) -> None: + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UserAssignedIdentity(Model): + """User-assigned managed identity. + + :param principal_id: Azure Active Directory principal ID associated with + this identity. + :type principal_id: str + :param client_id: Client App Id associated with this identity. + :type client_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__(self, *, principal_id: str=None, client_id: str=None, **kwargs) -> None: + super(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = principal_id + self.client_id = client_id diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_paged_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_paged_models.py new file mode 100644 index 000000000000..e370d9a17f49 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_paged_models.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class DeploymentScriptPaged(Paged): + """ + A paging container for iterating over a list of :class:`DeploymentScript ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DeploymentScript]'} + } + + def __init__(self, *args, **kwargs): + + super(DeploymentScriptPaged, self).__init__(*args, **kwargs) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/__init__.py new file mode 100644 index 000000000000..3868bac365a6 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._deployment_scripts_operations import DeploymentScriptsOperations + +__all__ = [ + 'DeploymentScriptsOperations', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_deployment_scripts_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_deployment_scripts_operations.py new file mode 100644 index 000000000000..2651ddaa1f00 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_deployment_scripts_operations.py @@ -0,0 +1,600 @@ +# 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 DeploymentScriptsOperations(object): + """DeploymentScriptsOperations 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-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + + def _create_initial( + self, resource_group_name, script_name, deployment_script, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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(deployment_script, 'DeploymentScript') + + # 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]: + raise models.DeploymentScriptsErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentScript', response) + if response.status_code == 201: + deserialized = self._deserialize('DeploymentScript', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, script_name, deployment_script, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates a deployment script. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param script_name: Name of the deployment script. + :type script_name: str + :param deployment_script: Deployment script supplied to the operation. + :type deployment_script: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScript + :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 DeploymentScript or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScript] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScript]] + :raises: + :class:`DeploymentScriptsErrorException` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + script_name=script_name, + deployment_script=deployment_script, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DeploymentScript', 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}'} + + def update( + self, resource_group_name, script_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates deployment script tags with specified values. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param script_name: Name of the deployment script. + :type script_name: str + :param tags: Resource tags to be updated. + :type tags: dict[str, 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: DeploymentScript or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScript + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DeploymentScriptsErrorException` + """ + deployment_script = None + if tags is not None: + deployment_script = models.DeploymentScriptUpdateParameter(tags=tags) + + # Construct URL + url = self.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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 deployment_script is not None: + body_content = self._serialize.body(deployment_script, 'DeploymentScriptUpdateParameter') + else: + body_content = None + + # 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]: + raise models.DeploymentScriptsErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentScript', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}'} + + def get( + self, resource_group_name, script_name, custom_headers=None, raw=False, **operation_config): + """Gets a deployment script with a given name. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param script_name: Name of the deployment script. + :type script_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: DeploymentScript or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScript + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DeploymentScriptsErrorException` + """ + # 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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.DeploymentScriptsErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentScript', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}'} + + def delete( + self, resource_group_name, script_name, custom_headers=None, raw=False, **operation_config): + """Deletes a deployment script. When operation completes, status code 200 + returned without content. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param script_name: Name of the deployment script. + :type script_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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DeploymentScriptsErrorException` + """ + # 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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, 204]: + raise models.DeploymentScriptsErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Lists all deployment scripts for a given subscription. + + :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 DeploymentScript + :rtype: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScriptPaged[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScript] + :raises: + :class:`DeploymentScriptsErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, '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') + + 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.DeploymentScriptsErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeploymentScriptPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentScripts'} + + def get_logs( + self, resource_group_name, script_name, custom_headers=None, raw=False, **operation_config): + """Gets deployment script logs for a given deployment script name. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param script_name: Name of the deployment script. + :type script_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: ScriptLogsList or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptLogsList + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DeploymentScriptsErrorException` + """ + # Construct URL + url = self.get_logs.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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.DeploymentScriptsErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ScriptLogsList', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}/logs'} + + def get_logs_default( + self, resource_group_name, script_name, tail=None, custom_headers=None, raw=False, **operation_config): + """Gets deployment script logs for a given deployment script name. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param script_name: Name of the deployment script. + :type script_name: str + :param tail: The number of lines to show from the tail of the + deployment script log. Valid value is a positive number up to 1000. If + 'tail' is not provided, all available logs are shown up to container + instance log capacity of 4mb. + :type tail: int + :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: ScriptLog or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptLog + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DeploymentScriptsErrorException` + """ + # Construct URL + url = self.get_logs_default.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if tail is not None: + query_parameters['tail'] = self._serialize.query("tail", tail, 'int') + + # 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.DeploymentScriptsErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ScriptLog', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_logs_default.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}/logs/default'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists deployments scripts. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_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: An iterator like instance of DeploymentScript + :rtype: + ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScriptPaged[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScript] + :raises: + :class:`DeploymentScriptsErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + 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') + + 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.DeploymentScriptsErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeploymentScriptPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/version.py new file mode 100644 index 000000000000..90309975708c --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "2019-10-01-preview" + diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/__init__.py new file mode 100644 index 000000000000..08e241ee1ed8 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import DeploymentScriptsClientConfiguration +from ._deployment_scripts_client import DeploymentScriptsClient +__all__ = ['DeploymentScriptsClient', 'DeploymentScriptsClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_configuration.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_configuration.py new file mode 100644 index 000000000000..142be065a596 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_configuration.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class DeploymentScriptsClientConfiguration(AzureConfiguration): + """Configuration for DeploymentScriptsClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription Id which forms part of the URI for + every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(DeploymentScriptsClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-resource/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py new file mode 100644 index 000000000000..250ce9c916f7 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import DeploymentScriptsClientConfiguration +from .operations import DeploymentScriptsOperations +from . import models + + +class DeploymentScriptsClient(SDKClient): + """The APIs listed in this specification can be used to manage Deployment Scripts resource through the Azure Resource Manager. + + :ivar config: Configuration for client. + :vartype config: DeploymentScriptsClientConfiguration + + :ivar deployment_scripts: DeploymentScripts operations + :vartype deployment_scripts: azure.mgmt.resource.deploymentscripts.v2020_10_01.operations.DeploymentScriptsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription Id which forms part of the URI for + every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = DeploymentScriptsClientConfiguration(credentials, subscription_id, base_url) + super(DeploymentScriptsClient, 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-10-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.deployment_scripts = DeploymentScriptsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/__init__.py new file mode 100644 index 000000000000..6dd3003be147 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/__init__.py @@ -0,0 +1,79 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AzureCliScript + from ._models_py3 import AzurePowerShellScript + from ._models_py3 import AzureResourceBase + from ._models_py3 import ContainerConfiguration + from ._models_py3 import DeploymentScript + from ._models_py3 import DeploymentScriptsError, DeploymentScriptsErrorException + from ._models_py3 import DeploymentScriptUpdateParameter + from ._models_py3 import EnvironmentVariable + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import ManagedServiceIdentity + from ._models_py3 import ScriptLog + from ._models_py3 import ScriptLogsList + from ._models_py3 import ScriptStatus + from ._models_py3 import StorageAccountConfiguration + from ._models_py3 import SystemData + from ._models_py3 import UserAssignedIdentity +except (SyntaxError, ImportError): + from ._models import AzureCliScript + from ._models import AzurePowerShellScript + from ._models import AzureResourceBase + from ._models import ContainerConfiguration + from ._models import DeploymentScript + from ._models import DeploymentScriptsError, DeploymentScriptsErrorException + from ._models import DeploymentScriptUpdateParameter + from ._models import EnvironmentVariable + from ._models import ErrorAdditionalInfo + from ._models import ErrorResponse + from ._models import ManagedServiceIdentity + from ._models import ScriptLog + from ._models import ScriptLogsList + from ._models import ScriptStatus + from ._models import StorageAccountConfiguration + from ._models import SystemData + from ._models import UserAssignedIdentity +from ._paged_models import DeploymentScriptPaged +from ._deployment_scripts_client_enums import ( + ManagedServiceIdentityType, + CreatedByType, + CleanupOptions, + ScriptProvisioningState, +) + +__all__ = [ + 'AzureCliScript', + 'AzurePowerShellScript', + 'AzureResourceBase', + 'ContainerConfiguration', + 'DeploymentScript', + 'DeploymentScriptsError', 'DeploymentScriptsErrorException', + 'DeploymentScriptUpdateParameter', + 'EnvironmentVariable', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'ManagedServiceIdentity', + 'ScriptLog', + 'ScriptLogsList', + 'ScriptStatus', + 'StorageAccountConfiguration', + 'SystemData', + 'UserAssignedIdentity', + 'DeploymentScriptPaged', + 'ManagedServiceIdentityType', + 'CreatedByType', + 'CleanupOptions', + 'ScriptProvisioningState', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_deployment_scripts_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_deployment_scripts_client_enums.py new file mode 100644 index 000000000000..b59700cab06f --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_deployment_scripts_client_enums.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class ManagedServiceIdentityType(str, Enum): + + user_assigned = "UserAssigned" + + +class CreatedByType(str, Enum): + + user = "User" + application = "Application" + managed_identity = "ManagedIdentity" + key = "Key" + + +class CleanupOptions(str, Enum): + + always = "Always" + on_success = "OnSuccess" + on_expiration = "OnExpiration" + + +class ScriptProvisioningState(str, Enum): + + creating = "Creating" + provisioning_resources = "ProvisioningResources" + running = "Running" + succeeded = "Succeeded" + failed = "Failed" + canceled = "Canceled" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models.py new file mode 100644 index 000000000000..817c7c9e7076 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models.py @@ -0,0 +1,924 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AzureResourceBase(Model): + """Common properties for all Azure resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureResourceBase, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class DeploymentScript(AzureResourceBase): + """Deployment script object. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzurePowerShellScript, AzureCliScript + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param identity: Optional property. Managed identity to be used for this + deployment script. Currently, only user-assigned MSI is supported. + :type identity: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ManagedServiceIdentity + :param location: Required. The location of the ACI and the storage account + for the deployment script. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar system_data: The system metadata related to this resource. + :vartype system_data: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.SystemData + :param kind: Required. Constant filled by server. + :type kind: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'AzurePowerShell': 'AzurePowerShellScript', 'AzureCLI': 'AzureCliScript'} + } + + def __init__(self, **kwargs): + super(DeploymentScript, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.system_data = None + self.kind = None + self.kind = 'DeploymentScript' + + +class AzureCliScript(DeploymentScript): + """Object model for the Azure CLI script. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param identity: Optional property. Managed identity to be used for this + deployment script. Currently, only user-assigned MSI is supported. + :type identity: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ManagedServiceIdentity + :param location: Required. The location of the ACI and the storage account + for the deployment script. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar system_data: The system metadata related to this resource. + :vartype system_data: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.SystemData + :param kind: Required. Constant filled by server. + :type kind: str + :param container_settings: Container settings. + :type container_settings: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ContainerConfiguration + :param storage_account_settings: Storage Account settings. + :type storage_account_settings: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration + :param cleanup_preference: The clean up preference when the script + execution gets in a terminal state. Default setting is 'Always'. Possible + values include: 'Always', 'OnSuccess', 'OnExpiration' + :type cleanup_preference: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions + :ivar provisioning_state: State of the script execution. This only appears + in the response. Possible values include: 'Creating', + 'ProvisioningResources', 'Running', 'Succeeded', 'Failed', 'Canceled' + :vartype provisioning_state: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptProvisioningState + :ivar status: Contains the results of script execution. + :vartype status: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptStatus + :ivar outputs: List of script outputs. + :vartype outputs: dict[str, object] + :param primary_script_uri: Uri for the script. This is the entry point for + the external script. + :type primary_script_uri: str + :param supporting_script_uris: Supporting files for the external script. + :type supporting_script_uris: list[str] + :param script_content: Script body. + :type script_content: str + :param arguments: Command line arguments to pass to the script. Arguments + are separated by spaces. ex: -Name blue* -Location 'West US 2' + :type arguments: str + :param environment_variables: The environment variables to pass over to + the script. + :type environment_variables: + list[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.EnvironmentVariable] + :param force_update_tag: Gets or sets how the deployment script should be + forced to execute even if the script resource has not changed. Can be + current time stamp or a GUID. + :type force_update_tag: str + :param retention_interval: Required. Interval for which the service + retains the script resource after it reaches a terminal state. Resource + will be deleted when this duration expires. Duration is based on ISO 8601 + pattern (for example P7D means one week). + :type retention_interval: timedelta + :param timeout: Maximum allowed script execution time specified in ISO + 8601 format. Default value is PT1H + :type timeout: timedelta + :param az_cli_version: Required. Azure CLI module version to be used. + :type az_cli_version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'outputs': {'readonly': True}, + 'script_content': {'max_length': 32000}, + 'retention_interval': {'required': True}, + 'az_cli_version': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'container_settings': {'key': 'properties.containerSettings', 'type': 'ContainerConfiguration'}, + 'storage_account_settings': {'key': 'properties.storageAccountSettings', 'type': 'StorageAccountConfiguration'}, + 'cleanup_preference': {'key': 'properties.cleanupPreference', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'ScriptStatus'}, + 'outputs': {'key': 'properties.outputs', 'type': '{object}'}, + 'primary_script_uri': {'key': 'properties.primaryScriptUri', 'type': 'str'}, + 'supporting_script_uris': {'key': 'properties.supportingScriptUris', 'type': '[str]'}, + 'script_content': {'key': 'properties.scriptContent', 'type': 'str'}, + 'arguments': {'key': 'properties.arguments', 'type': 'str'}, + 'environment_variables': {'key': 'properties.environmentVariables', 'type': '[EnvironmentVariable]'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'retention_interval': {'key': 'properties.retentionInterval', 'type': 'duration'}, + 'timeout': {'key': 'properties.timeout', 'type': 'duration'}, + 'az_cli_version': {'key': 'properties.azCliVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureCliScript, self).__init__(**kwargs) + self.container_settings = kwargs.get('container_settings', None) + self.storage_account_settings = kwargs.get('storage_account_settings', None) + self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.provisioning_state = None + self.status = None + self.outputs = None + self.primary_script_uri = kwargs.get('primary_script_uri', None) + self.supporting_script_uris = kwargs.get('supporting_script_uris', None) + self.script_content = kwargs.get('script_content', None) + self.arguments = kwargs.get('arguments', None) + self.environment_variables = kwargs.get('environment_variables', None) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.retention_interval = kwargs.get('retention_interval', None) + self.timeout = kwargs.get('timeout', None) + self.az_cli_version = kwargs.get('az_cli_version', None) + self.kind = 'AzureCLI' + + +class AzurePowerShellScript(DeploymentScript): + """Object model for the Azure PowerShell script. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param identity: Optional property. Managed identity to be used for this + deployment script. Currently, only user-assigned MSI is supported. + :type identity: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ManagedServiceIdentity + :param location: Required. The location of the ACI and the storage account + for the deployment script. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar system_data: The system metadata related to this resource. + :vartype system_data: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.SystemData + :param kind: Required. Constant filled by server. + :type kind: str + :param container_settings: Container settings. + :type container_settings: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ContainerConfiguration + :param storage_account_settings: Storage Account settings. + :type storage_account_settings: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration + :param cleanup_preference: The clean up preference when the script + execution gets in a terminal state. Default setting is 'Always'. Possible + values include: 'Always', 'OnSuccess', 'OnExpiration' + :type cleanup_preference: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions + :ivar provisioning_state: State of the script execution. This only appears + in the response. Possible values include: 'Creating', + 'ProvisioningResources', 'Running', 'Succeeded', 'Failed', 'Canceled' + :vartype provisioning_state: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptProvisioningState + :ivar status: Contains the results of script execution. + :vartype status: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptStatus + :ivar outputs: List of script outputs. + :vartype outputs: dict[str, object] + :param primary_script_uri: Uri for the script. This is the entry point for + the external script. + :type primary_script_uri: str + :param supporting_script_uris: Supporting files for the external script. + :type supporting_script_uris: list[str] + :param script_content: Script body. + :type script_content: str + :param arguments: Command line arguments to pass to the script. Arguments + are separated by spaces. ex: -Name blue* -Location 'West US 2' + :type arguments: str + :param environment_variables: The environment variables to pass over to + the script. + :type environment_variables: + list[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.EnvironmentVariable] + :param force_update_tag: Gets or sets how the deployment script should be + forced to execute even if the script resource has not changed. Can be + current time stamp or a GUID. + :type force_update_tag: str + :param retention_interval: Required. Interval for which the service + retains the script resource after it reaches a terminal state. Resource + will be deleted when this duration expires. Duration is based on ISO 8601 + pattern (for example P7D means one week). + :type retention_interval: timedelta + :param timeout: Maximum allowed script execution time specified in ISO + 8601 format. Default value is PT1H + :type timeout: timedelta + :param az_power_shell_version: Required. Azure PowerShell module version + to be used. + :type az_power_shell_version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'outputs': {'readonly': True}, + 'script_content': {'max_length': 32000}, + 'retention_interval': {'required': True}, + 'az_power_shell_version': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'container_settings': {'key': 'properties.containerSettings', 'type': 'ContainerConfiguration'}, + 'storage_account_settings': {'key': 'properties.storageAccountSettings', 'type': 'StorageAccountConfiguration'}, + 'cleanup_preference': {'key': 'properties.cleanupPreference', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'ScriptStatus'}, + 'outputs': {'key': 'properties.outputs', 'type': '{object}'}, + 'primary_script_uri': {'key': 'properties.primaryScriptUri', 'type': 'str'}, + 'supporting_script_uris': {'key': 'properties.supportingScriptUris', 'type': '[str]'}, + 'script_content': {'key': 'properties.scriptContent', 'type': 'str'}, + 'arguments': {'key': 'properties.arguments', 'type': 'str'}, + 'environment_variables': {'key': 'properties.environmentVariables', 'type': '[EnvironmentVariable]'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'retention_interval': {'key': 'properties.retentionInterval', 'type': 'duration'}, + 'timeout': {'key': 'properties.timeout', 'type': 'duration'}, + 'az_power_shell_version': {'key': 'properties.azPowerShellVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzurePowerShellScript, self).__init__(**kwargs) + self.container_settings = kwargs.get('container_settings', None) + self.storage_account_settings = kwargs.get('storage_account_settings', None) + self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.provisioning_state = None + self.status = None + self.outputs = None + self.primary_script_uri = kwargs.get('primary_script_uri', None) + self.supporting_script_uris = kwargs.get('supporting_script_uris', None) + self.script_content = kwargs.get('script_content', None) + self.arguments = kwargs.get('arguments', None) + self.environment_variables = kwargs.get('environment_variables', None) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.retention_interval = kwargs.get('retention_interval', None) + self.timeout = kwargs.get('timeout', None) + self.az_power_shell_version = kwargs.get('az_power_shell_version', None) + self.kind = 'AzurePowerShell' + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ContainerConfiguration(Model): + """Settings to customize ACI container instance. + + :param container_group_name: Container group name, if not specified then + the name will get auto-generated. Not specifying a 'containerGroupName' + indicates the system to generate a unique name which might end up flagging + an Azure Policy as non-compliant. Use 'containerGroupName' when you have + an Azure Policy that expects a specific naming convention or when you want + to fully control the name. 'containerGroupName' property must be between 1 + and 63 characters long, must contain only lowercase letters, numbers, and + dashes and it cannot start or end with a dash and consecutive dashes are + not allowed. To specify a 'containerGroupName', add the following object + to properties: { "containerSettings": { "containerGroupName": + "contoso-container" } }. If you do not want to specify a + 'containerGroupName' then do not add 'containerSettings' property. + :type container_group_name: str + """ + + _validation = { + 'container_group_name': {'max_length': 63, 'min_length': 1}, + } + + _attribute_map = { + 'container_group_name': {'key': 'containerGroupName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ContainerConfiguration, self).__init__(**kwargs) + self.container_group_name = kwargs.get('container_group_name', None) + + +class DeploymentScriptPropertiesBase(Model): + """Common properties for the deployment script. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param container_settings: Container settings. + :type container_settings: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ContainerConfiguration + :param storage_account_settings: Storage Account settings. + :type storage_account_settings: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration + :param cleanup_preference: The clean up preference when the script + execution gets in a terminal state. Default setting is 'Always'. Possible + values include: 'Always', 'OnSuccess', 'OnExpiration' + :type cleanup_preference: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions + :ivar provisioning_state: State of the script execution. This only appears + in the response. Possible values include: 'Creating', + 'ProvisioningResources', 'Running', 'Succeeded', 'Failed', 'Canceled' + :vartype provisioning_state: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptProvisioningState + :ivar status: Contains the results of script execution. + :vartype status: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptStatus + :ivar outputs: List of script outputs. + :vartype outputs: dict[str, object] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'outputs': {'readonly': True}, + } + + _attribute_map = { + 'container_settings': {'key': 'containerSettings', 'type': 'ContainerConfiguration'}, + 'storage_account_settings': {'key': 'storageAccountSettings', 'type': 'StorageAccountConfiguration'}, + 'cleanup_preference': {'key': 'cleanupPreference', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ScriptStatus'}, + 'outputs': {'key': 'outputs', 'type': '{object}'}, + } + + def __init__(self, **kwargs): + super(DeploymentScriptPropertiesBase, self).__init__(**kwargs) + self.container_settings = kwargs.get('container_settings', None) + self.storage_account_settings = kwargs.get('storage_account_settings', None) + self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.provisioning_state = None + self.status = None + self.outputs = None + + +class DeploymentScriptsError(Model): + """Deployment scripts error response. + + :param error: + :type error: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(DeploymentScriptsError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class DeploymentScriptsErrorException(HttpOperationError): + """Server responsed with exception of type: 'DeploymentScriptsError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(DeploymentScriptsErrorException, self).__init__(deserialize, response, 'DeploymentScriptsError', *args) + + +class DeploymentScriptUpdateParameter(AzureResourceBase): + """Deployment script parameters to be updated. . + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param tags: Resource tags to be updated. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(DeploymentScriptUpdateParameter, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class EnvironmentVariable(Model): + """The environment variable to pass to the script in the container instance. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the environment variable. + :type name: str + :param value: The value of the environment variable. + :type value: str + :param secure_value: The value of the secure environment variable. + :type secure_value: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'secure_value': {'key': 'secureValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EnvironmentVariable, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + self.secure_value = kwargs.get('secure_value', None) + + +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 ErrorResponse(Model): + """The resource management error response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ManagedServiceIdentity(Model): + """Managed identity generic object. + + :param type: Type of the managed identity. Possible values include: + 'UserAssigned' + :type type: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ManagedServiceIdentityType + :param user_assigned_identities: The list of user-assigned managed + identities associated with the resource. Key is the Azure resource Id of + the managed identity. + :type user_assigned_identities: dict[str, + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.UserAssignedIdentity] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__(self, **kwargs): + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class ScriptConfigurationBase(Model): + """Common configuration settings for both Azure PowerShell and Azure CLI + scripts. + + All required parameters must be populated in order to send to Azure. + + :param primary_script_uri: Uri for the script. This is the entry point for + the external script. + :type primary_script_uri: str + :param supporting_script_uris: Supporting files for the external script. + :type supporting_script_uris: list[str] + :param script_content: Script body. + :type script_content: str + :param arguments: Command line arguments to pass to the script. Arguments + are separated by spaces. ex: -Name blue* -Location 'West US 2' + :type arguments: str + :param environment_variables: The environment variables to pass over to + the script. + :type environment_variables: + list[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.EnvironmentVariable] + :param force_update_tag: Gets or sets how the deployment script should be + forced to execute even if the script resource has not changed. Can be + current time stamp or a GUID. + :type force_update_tag: str + :param retention_interval: Required. Interval for which the service + retains the script resource after it reaches a terminal state. Resource + will be deleted when this duration expires. Duration is based on ISO 8601 + pattern (for example P7D means one week). + :type retention_interval: timedelta + :param timeout: Maximum allowed script execution time specified in ISO + 8601 format. Default value is PT1H + :type timeout: timedelta + """ + + _validation = { + 'script_content': {'max_length': 32000}, + 'retention_interval': {'required': True}, + } + + _attribute_map = { + 'primary_script_uri': {'key': 'primaryScriptUri', 'type': 'str'}, + 'supporting_script_uris': {'key': 'supportingScriptUris', 'type': '[str]'}, + 'script_content': {'key': 'scriptContent', 'type': 'str'}, + 'arguments': {'key': 'arguments', 'type': 'str'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '[EnvironmentVariable]'}, + 'force_update_tag': {'key': 'forceUpdateTag', 'type': 'str'}, + 'retention_interval': {'key': 'retentionInterval', 'type': 'duration'}, + 'timeout': {'key': 'timeout', 'type': 'duration'}, + } + + def __init__(self, **kwargs): + super(ScriptConfigurationBase, self).__init__(**kwargs) + self.primary_script_uri = kwargs.get('primary_script_uri', None) + self.supporting_script_uris = kwargs.get('supporting_script_uris', None) + self.script_content = kwargs.get('script_content', None) + self.arguments = kwargs.get('arguments', None) + self.environment_variables = kwargs.get('environment_variables', None) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.retention_interval = kwargs.get('retention_interval', None) + self.timeout = kwargs.get('timeout', None) + + +class ScriptLog(AzureResourceBase): + """Script execution log object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :ivar log: Script execution logs in text format. + :vartype log: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'log': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'log': {'key': 'properties.log', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ScriptLog, self).__init__(**kwargs) + self.log = None + + +class ScriptLogsList(Model): + """Deployment script execution logs. + + :param value: Deployment scripts logs. + :type value: + list[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptLog] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScriptLog]'}, + } + + def __init__(self, **kwargs): + super(ScriptLogsList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ScriptStatus(Model): + """Generic object modeling results of script execution. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar container_instance_id: ACI resource Id. + :vartype container_instance_id: str + :ivar storage_account_id: Storage account resource Id. + :vartype storage_account_id: str + :ivar start_time: Start time of the script execution. + :vartype start_time: datetime + :ivar end_time: End time of the script execution. + :vartype end_time: datetime + :ivar expiration_time: Time the deployment script resource will expire. + :vartype expiration_time: datetime + :param error: Error that is relayed from the script execution. + :type error: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ErrorResponse + """ + + _validation = { + 'container_instance_id': {'readonly': True}, + 'storage_account_id': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'expiration_time': {'readonly': True}, + } + + _attribute_map = { + 'container_instance_id': {'key': 'containerInstanceId', 'type': 'str'}, + 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'expiration_time': {'key': 'expirationTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(ScriptStatus, self).__init__(**kwargs) + self.container_instance_id = None + self.storage_account_id = None + self.start_time = None + self.end_time = None + self.expiration_time = None + self.error = kwargs.get('error', None) + + +class StorageAccountConfiguration(Model): + """Settings to use an existing storage account. Valid storage account kinds + are: Storage, StorageV2 and FileStorage. + + :param storage_account_name: The storage account name. + :type storage_account_name: str + :param storage_account_key: The storage account access key. + :type storage_account_key: str + """ + + _attribute_map = { + 'storage_account_name': {'key': 'storageAccountName', 'type': 'str'}, + 'storage_account_key': {'key': 'storageAccountKey', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(StorageAccountConfiguration, self).__init__(**kwargs) + self.storage_account_name = kwargs.get('storage_account_name', None) + self.storage_account_key = kwargs.get('storage_account_key', None) + + +class SystemData(Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. + Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + :type created_by_type: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the + resource. Possible values include: 'User', 'Application', + 'ManagedIdentity', 'Key' + :type last_modified_by_type: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CreatedByType + :param last_modified_at: The type of identity that last modified the + resource. + :type last_modified_at: datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class UserAssignedIdentity(Model): + """User-assigned managed identity. + + :param principal_id: Azure Active Directory principal ID associated with + this identity. + :type principal_id: str + :param client_id: Client App Id associated with this identity. + :type client_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.client_id = kwargs.get('client_id', None) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py new file mode 100644 index 000000000000..760ab3f125b4 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py @@ -0,0 +1,924 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AzureResourceBase(Model): + """Common properties for all Azure resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(AzureResourceBase, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class DeploymentScript(AzureResourceBase): + """Deployment script object. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzurePowerShellScript, AzureCliScript + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param identity: Optional property. Managed identity to be used for this + deployment script. Currently, only user-assigned MSI is supported. + :type identity: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ManagedServiceIdentity + :param location: Required. The location of the ACI and the storage account + for the deployment script. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar system_data: The system metadata related to this resource. + :vartype system_data: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.SystemData + :param kind: Required. Constant filled by server. + :type kind: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'AzurePowerShell': 'AzurePowerShellScript', 'AzureCLI': 'AzureCliScript'} + } + + def __init__(self, *, location: str, identity=None, tags=None, **kwargs) -> None: + super(DeploymentScript, self).__init__(**kwargs) + self.identity = identity + self.location = location + self.tags = tags + self.system_data = None + self.kind = None + self.kind = 'DeploymentScript' + + +class AzureCliScript(DeploymentScript): + """Object model for the Azure CLI script. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param identity: Optional property. Managed identity to be used for this + deployment script. Currently, only user-assigned MSI is supported. + :type identity: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ManagedServiceIdentity + :param location: Required. The location of the ACI and the storage account + for the deployment script. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar system_data: The system metadata related to this resource. + :vartype system_data: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.SystemData + :param kind: Required. Constant filled by server. + :type kind: str + :param container_settings: Container settings. + :type container_settings: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ContainerConfiguration + :param storage_account_settings: Storage Account settings. + :type storage_account_settings: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration + :param cleanup_preference: The clean up preference when the script + execution gets in a terminal state. Default setting is 'Always'. Possible + values include: 'Always', 'OnSuccess', 'OnExpiration' + :type cleanup_preference: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions + :ivar provisioning_state: State of the script execution. This only appears + in the response. Possible values include: 'Creating', + 'ProvisioningResources', 'Running', 'Succeeded', 'Failed', 'Canceled' + :vartype provisioning_state: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptProvisioningState + :ivar status: Contains the results of script execution. + :vartype status: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptStatus + :ivar outputs: List of script outputs. + :vartype outputs: dict[str, object] + :param primary_script_uri: Uri for the script. This is the entry point for + the external script. + :type primary_script_uri: str + :param supporting_script_uris: Supporting files for the external script. + :type supporting_script_uris: list[str] + :param script_content: Script body. + :type script_content: str + :param arguments: Command line arguments to pass to the script. Arguments + are separated by spaces. ex: -Name blue* -Location 'West US 2' + :type arguments: str + :param environment_variables: The environment variables to pass over to + the script. + :type environment_variables: + list[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.EnvironmentVariable] + :param force_update_tag: Gets or sets how the deployment script should be + forced to execute even if the script resource has not changed. Can be + current time stamp or a GUID. + :type force_update_tag: str + :param retention_interval: Required. Interval for which the service + retains the script resource after it reaches a terminal state. Resource + will be deleted when this duration expires. Duration is based on ISO 8601 + pattern (for example P7D means one week). + :type retention_interval: timedelta + :param timeout: Maximum allowed script execution time specified in ISO + 8601 format. Default value is PT1H + :type timeout: timedelta + :param az_cli_version: Required. Azure CLI module version to be used. + :type az_cli_version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'outputs': {'readonly': True}, + 'script_content': {'max_length': 32000}, + 'retention_interval': {'required': True}, + 'az_cli_version': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'container_settings': {'key': 'properties.containerSettings', 'type': 'ContainerConfiguration'}, + 'storage_account_settings': {'key': 'properties.storageAccountSettings', 'type': 'StorageAccountConfiguration'}, + 'cleanup_preference': {'key': 'properties.cleanupPreference', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'ScriptStatus'}, + 'outputs': {'key': 'properties.outputs', 'type': '{object}'}, + 'primary_script_uri': {'key': 'properties.primaryScriptUri', 'type': 'str'}, + 'supporting_script_uris': {'key': 'properties.supportingScriptUris', 'type': '[str]'}, + 'script_content': {'key': 'properties.scriptContent', 'type': 'str'}, + 'arguments': {'key': 'properties.arguments', 'type': 'str'}, + 'environment_variables': {'key': 'properties.environmentVariables', 'type': '[EnvironmentVariable]'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'retention_interval': {'key': 'properties.retentionInterval', 'type': 'duration'}, + 'timeout': {'key': 'properties.timeout', 'type': 'duration'}, + 'az_cli_version': {'key': 'properties.azCliVersion', 'type': 'str'}, + } + + def __init__(self, *, location: str, retention_interval, az_cli_version: str, identity=None, tags=None, container_settings=None, storage_account_settings=None, cleanup_preference=None, primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout=None, **kwargs) -> None: + super(AzureCliScript, self).__init__(identity=identity, location=location, tags=tags, **kwargs) + self.container_settings = container_settings + self.storage_account_settings = storage_account_settings + self.cleanup_preference = cleanup_preference + self.provisioning_state = None + self.status = None + self.outputs = None + self.primary_script_uri = primary_script_uri + self.supporting_script_uris = supporting_script_uris + self.script_content = script_content + self.arguments = arguments + self.environment_variables = environment_variables + self.force_update_tag = force_update_tag + self.retention_interval = retention_interval + self.timeout = timeout + self.az_cli_version = az_cli_version + self.kind = 'AzureCLI' + + +class AzurePowerShellScript(DeploymentScript): + """Object model for the Azure PowerShell script. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param identity: Optional property. Managed identity to be used for this + deployment script. Currently, only user-assigned MSI is supported. + :type identity: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ManagedServiceIdentity + :param location: Required. The location of the ACI and the storage account + for the deployment script. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar system_data: The system metadata related to this resource. + :vartype system_data: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.SystemData + :param kind: Required. Constant filled by server. + :type kind: str + :param container_settings: Container settings. + :type container_settings: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ContainerConfiguration + :param storage_account_settings: Storage Account settings. + :type storage_account_settings: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration + :param cleanup_preference: The clean up preference when the script + execution gets in a terminal state. Default setting is 'Always'. Possible + values include: 'Always', 'OnSuccess', 'OnExpiration' + :type cleanup_preference: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions + :ivar provisioning_state: State of the script execution. This only appears + in the response. Possible values include: 'Creating', + 'ProvisioningResources', 'Running', 'Succeeded', 'Failed', 'Canceled' + :vartype provisioning_state: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptProvisioningState + :ivar status: Contains the results of script execution. + :vartype status: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptStatus + :ivar outputs: List of script outputs. + :vartype outputs: dict[str, object] + :param primary_script_uri: Uri for the script. This is the entry point for + the external script. + :type primary_script_uri: str + :param supporting_script_uris: Supporting files for the external script. + :type supporting_script_uris: list[str] + :param script_content: Script body. + :type script_content: str + :param arguments: Command line arguments to pass to the script. Arguments + are separated by spaces. ex: -Name blue* -Location 'West US 2' + :type arguments: str + :param environment_variables: The environment variables to pass over to + the script. + :type environment_variables: + list[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.EnvironmentVariable] + :param force_update_tag: Gets or sets how the deployment script should be + forced to execute even if the script resource has not changed. Can be + current time stamp or a GUID. + :type force_update_tag: str + :param retention_interval: Required. Interval for which the service + retains the script resource after it reaches a terminal state. Resource + will be deleted when this duration expires. Duration is based on ISO 8601 + pattern (for example P7D means one week). + :type retention_interval: timedelta + :param timeout: Maximum allowed script execution time specified in ISO + 8601 format. Default value is PT1H + :type timeout: timedelta + :param az_power_shell_version: Required. Azure PowerShell module version + to be used. + :type az_power_shell_version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'outputs': {'readonly': True}, + 'script_content': {'max_length': 32000}, + 'retention_interval': {'required': True}, + 'az_power_shell_version': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'container_settings': {'key': 'properties.containerSettings', 'type': 'ContainerConfiguration'}, + 'storage_account_settings': {'key': 'properties.storageAccountSettings', 'type': 'StorageAccountConfiguration'}, + 'cleanup_preference': {'key': 'properties.cleanupPreference', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'ScriptStatus'}, + 'outputs': {'key': 'properties.outputs', 'type': '{object}'}, + 'primary_script_uri': {'key': 'properties.primaryScriptUri', 'type': 'str'}, + 'supporting_script_uris': {'key': 'properties.supportingScriptUris', 'type': '[str]'}, + 'script_content': {'key': 'properties.scriptContent', 'type': 'str'}, + 'arguments': {'key': 'properties.arguments', 'type': 'str'}, + 'environment_variables': {'key': 'properties.environmentVariables', 'type': '[EnvironmentVariable]'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'retention_interval': {'key': 'properties.retentionInterval', 'type': 'duration'}, + 'timeout': {'key': 'properties.timeout', 'type': 'duration'}, + 'az_power_shell_version': {'key': 'properties.azPowerShellVersion', 'type': 'str'}, + } + + def __init__(self, *, location: str, retention_interval, az_power_shell_version: str, identity=None, tags=None, container_settings=None, storage_account_settings=None, cleanup_preference=None, primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout=None, **kwargs) -> None: + super(AzurePowerShellScript, self).__init__(identity=identity, location=location, tags=tags, **kwargs) + self.container_settings = container_settings + self.storage_account_settings = storage_account_settings + self.cleanup_preference = cleanup_preference + self.provisioning_state = None + self.status = None + self.outputs = None + self.primary_script_uri = primary_script_uri + self.supporting_script_uris = supporting_script_uris + self.script_content = script_content + self.arguments = arguments + self.environment_variables = environment_variables + self.force_update_tag = force_update_tag + self.retention_interval = retention_interval + self.timeout = timeout + self.az_power_shell_version = az_power_shell_version + self.kind = 'AzurePowerShell' + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ContainerConfiguration(Model): + """Settings to customize ACI container instance. + + :param container_group_name: Container group name, if not specified then + the name will get auto-generated. Not specifying a 'containerGroupName' + indicates the system to generate a unique name which might end up flagging + an Azure Policy as non-compliant. Use 'containerGroupName' when you have + an Azure Policy that expects a specific naming convention or when you want + to fully control the name. 'containerGroupName' property must be between 1 + and 63 characters long, must contain only lowercase letters, numbers, and + dashes and it cannot start or end with a dash and consecutive dashes are + not allowed. To specify a 'containerGroupName', add the following object + to properties: { "containerSettings": { "containerGroupName": + "contoso-container" } }. If you do not want to specify a + 'containerGroupName' then do not add 'containerSettings' property. + :type container_group_name: str + """ + + _validation = { + 'container_group_name': {'max_length': 63, 'min_length': 1}, + } + + _attribute_map = { + 'container_group_name': {'key': 'containerGroupName', 'type': 'str'}, + } + + def __init__(self, *, container_group_name: str=None, **kwargs) -> None: + super(ContainerConfiguration, self).__init__(**kwargs) + self.container_group_name = container_group_name + + +class DeploymentScriptPropertiesBase(Model): + """Common properties for the deployment script. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param container_settings: Container settings. + :type container_settings: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ContainerConfiguration + :param storage_account_settings: Storage Account settings. + :type storage_account_settings: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration + :param cleanup_preference: The clean up preference when the script + execution gets in a terminal state. Default setting is 'Always'. Possible + values include: 'Always', 'OnSuccess', 'OnExpiration' + :type cleanup_preference: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions + :ivar provisioning_state: State of the script execution. This only appears + in the response. Possible values include: 'Creating', + 'ProvisioningResources', 'Running', 'Succeeded', 'Failed', 'Canceled' + :vartype provisioning_state: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptProvisioningState + :ivar status: Contains the results of script execution. + :vartype status: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptStatus + :ivar outputs: List of script outputs. + :vartype outputs: dict[str, object] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'outputs': {'readonly': True}, + } + + _attribute_map = { + 'container_settings': {'key': 'containerSettings', 'type': 'ContainerConfiguration'}, + 'storage_account_settings': {'key': 'storageAccountSettings', 'type': 'StorageAccountConfiguration'}, + 'cleanup_preference': {'key': 'cleanupPreference', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ScriptStatus'}, + 'outputs': {'key': 'outputs', 'type': '{object}'}, + } + + def __init__(self, *, container_settings=None, storage_account_settings=None, cleanup_preference=None, **kwargs) -> None: + super(DeploymentScriptPropertiesBase, self).__init__(**kwargs) + self.container_settings = container_settings + self.storage_account_settings = storage_account_settings + self.cleanup_preference = cleanup_preference + self.provisioning_state = None + self.status = None + self.outputs = None + + +class DeploymentScriptsError(Model): + """Deployment scripts error response. + + :param error: + :type error: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(DeploymentScriptsError, self).__init__(**kwargs) + self.error = error + + +class DeploymentScriptsErrorException(HttpOperationError): + """Server responsed with exception of type: 'DeploymentScriptsError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(DeploymentScriptsErrorException, self).__init__(deserialize, response, 'DeploymentScriptsError', *args) + + +class DeploymentScriptUpdateParameter(AzureResourceBase): + """Deployment script parameters to be updated. . + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :param tags: Resource tags to be updated. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(DeploymentScriptUpdateParameter, self).__init__(**kwargs) + self.tags = tags + + +class EnvironmentVariable(Model): + """The environment variable to pass to the script in the container instance. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the environment variable. + :type name: str + :param value: The value of the environment variable. + :type value: str + :param secure_value: The value of the secure environment variable. + :type secure_value: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'secure_value': {'key': 'secureValue', 'type': 'str'}, + } + + def __init__(self, *, name: str, value: str=None, secure_value: str=None, **kwargs) -> None: + super(EnvironmentVariable, self).__init__(**kwargs) + self.name = name + self.value = value + self.secure_value = secure_value + + +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 ErrorResponse(Model): + """The resource management error response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ManagedServiceIdentity(Model): + """Managed identity generic object. + + :param type: Type of the managed identity. Possible values include: + 'UserAssigned' + :type type: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ManagedServiceIdentityType + :param user_assigned_identities: The list of user-assigned managed + identities associated with the resource. Key is the Azure resource Id of + the managed identity. + :type user_assigned_identities: dict[str, + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.UserAssignedIdentity] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__(self, *, type=None, user_assigned_identities=None, **kwargs) -> None: + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ScriptConfigurationBase(Model): + """Common configuration settings for both Azure PowerShell and Azure CLI + scripts. + + All required parameters must be populated in order to send to Azure. + + :param primary_script_uri: Uri for the script. This is the entry point for + the external script. + :type primary_script_uri: str + :param supporting_script_uris: Supporting files for the external script. + :type supporting_script_uris: list[str] + :param script_content: Script body. + :type script_content: str + :param arguments: Command line arguments to pass to the script. Arguments + are separated by spaces. ex: -Name blue* -Location 'West US 2' + :type arguments: str + :param environment_variables: The environment variables to pass over to + the script. + :type environment_variables: + list[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.EnvironmentVariable] + :param force_update_tag: Gets or sets how the deployment script should be + forced to execute even if the script resource has not changed. Can be + current time stamp or a GUID. + :type force_update_tag: str + :param retention_interval: Required. Interval for which the service + retains the script resource after it reaches a terminal state. Resource + will be deleted when this duration expires. Duration is based on ISO 8601 + pattern (for example P7D means one week). + :type retention_interval: timedelta + :param timeout: Maximum allowed script execution time specified in ISO + 8601 format. Default value is PT1H + :type timeout: timedelta + """ + + _validation = { + 'script_content': {'max_length': 32000}, + 'retention_interval': {'required': True}, + } + + _attribute_map = { + 'primary_script_uri': {'key': 'primaryScriptUri', 'type': 'str'}, + 'supporting_script_uris': {'key': 'supportingScriptUris', 'type': '[str]'}, + 'script_content': {'key': 'scriptContent', 'type': 'str'}, + 'arguments': {'key': 'arguments', 'type': 'str'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '[EnvironmentVariable]'}, + 'force_update_tag': {'key': 'forceUpdateTag', 'type': 'str'}, + 'retention_interval': {'key': 'retentionInterval', 'type': 'duration'}, + 'timeout': {'key': 'timeout', 'type': 'duration'}, + } + + def __init__(self, *, retention_interval, primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout=None, **kwargs) -> None: + super(ScriptConfigurationBase, self).__init__(**kwargs) + self.primary_script_uri = primary_script_uri + self.supporting_script_uris = supporting_script_uris + self.script_content = script_content + self.arguments = arguments + self.environment_variables = environment_variables + self.force_update_tag = force_update_tag + self.retention_interval = retention_interval + self.timeout = timeout + + +class ScriptLog(AzureResourceBase): + """Script execution log object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :ivar log: Script execution logs in text format. + :vartype log: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'log': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'log': {'key': 'properties.log', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ScriptLog, self).__init__(**kwargs) + self.log = None + + +class ScriptLogsList(Model): + """Deployment script execution logs. + + :param value: Deployment scripts logs. + :type value: + list[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptLog] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScriptLog]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(ScriptLogsList, self).__init__(**kwargs) + self.value = value + + +class ScriptStatus(Model): + """Generic object modeling results of script execution. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar container_instance_id: ACI resource Id. + :vartype container_instance_id: str + :ivar storage_account_id: Storage account resource Id. + :vartype storage_account_id: str + :ivar start_time: Start time of the script execution. + :vartype start_time: datetime + :ivar end_time: End time of the script execution. + :vartype end_time: datetime + :ivar expiration_time: Time the deployment script resource will expire. + :vartype expiration_time: datetime + :param error: Error that is relayed from the script execution. + :type error: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ErrorResponse + """ + + _validation = { + 'container_instance_id': {'readonly': True}, + 'storage_account_id': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'expiration_time': {'readonly': True}, + } + + _attribute_map = { + 'container_instance_id': {'key': 'containerInstanceId', 'type': 'str'}, + 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'expiration_time': {'key': 'expirationTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ScriptStatus, self).__init__(**kwargs) + self.container_instance_id = None + self.storage_account_id = None + self.start_time = None + self.end_time = None + self.expiration_time = None + self.error = error + + +class StorageAccountConfiguration(Model): + """Settings to use an existing storage account. Valid storage account kinds + are: Storage, StorageV2 and FileStorage. + + :param storage_account_name: The storage account name. + :type storage_account_name: str + :param storage_account_key: The storage account access key. + :type storage_account_key: str + """ + + _attribute_map = { + 'storage_account_name': {'key': 'storageAccountName', 'type': 'str'}, + 'storage_account_key': {'key': 'storageAccountKey', 'type': 'str'}, + } + + def __init__(self, *, storage_account_name: str=None, storage_account_key: str=None, **kwargs) -> None: + super(StorageAccountConfiguration, self).__init__(**kwargs) + self.storage_account_name = storage_account_name + self.storage_account_key = storage_account_key + + +class SystemData(Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. + Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + :type created_by_type: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the + resource. Possible values include: 'User', 'Application', + 'ManagedIdentity', 'Key' + :type last_modified_by_type: str or + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CreatedByType + :param last_modified_at: The type of identity that last modified the + resource. + :type last_modified_at: datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__(self, *, created_by: str=None, created_by_type=None, created_at=None, last_modified_by: str=None, last_modified_by_type=None, last_modified_at=None, **kwargs) -> None: + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UserAssignedIdentity(Model): + """User-assigned managed identity. + + :param principal_id: Azure Active Directory principal ID associated with + this identity. + :type principal_id: str + :param client_id: Client App Id associated with this identity. + :type client_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__(self, *, principal_id: str=None, client_id: str=None, **kwargs) -> None: + super(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = principal_id + self.client_id = client_id diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_paged_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_paged_models.py new file mode 100644 index 000000000000..005ec1cb59e9 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_paged_models.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class DeploymentScriptPaged(Paged): + """ + A paging container for iterating over a list of :class:`DeploymentScript ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DeploymentScript]'} + } + + def __init__(self, *args, **kwargs): + + super(DeploymentScriptPaged, self).__init__(*args, **kwargs) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/__init__.py new file mode 100644 index 000000000000..3868bac365a6 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._deployment_scripts_operations import DeploymentScriptsOperations + +__all__ = [ + 'DeploymentScriptsOperations', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_deployment_scripts_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_deployment_scripts_operations.py new file mode 100644 index 000000000000..1c8f358dcfb8 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_deployment_scripts_operations.py @@ -0,0 +1,600 @@ +# 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 DeploymentScriptsOperations(object): + """DeploymentScriptsOperations 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: "2020-10-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-10-01" + + self.config = config + + + def _create_initial( + self, resource_group_name, script_name, deployment_script, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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(deployment_script, 'DeploymentScript') + + # 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]: + raise models.DeploymentScriptsErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentScript', response) + if response.status_code == 201: + deserialized = self._deserialize('DeploymentScript', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, script_name, deployment_script, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates a deployment script. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param script_name: Name of the deployment script. + :type script_name: str + :param deployment_script: Deployment script supplied to the operation. + :type deployment_script: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScript + :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 DeploymentScript or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScript] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScript]] + :raises: + :class:`DeploymentScriptsErrorException` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + script_name=script_name, + deployment_script=deployment_script, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DeploymentScript', 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}'} + + def update( + self, resource_group_name, script_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates deployment script tags with specified values. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param script_name: Name of the deployment script. + :type script_name: str + :param tags: Resource tags to be updated. + :type tags: dict[str, 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: DeploymentScript or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScript + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DeploymentScriptsErrorException` + """ + deployment_script = None + if tags is not None: + deployment_script = models.DeploymentScriptUpdateParameter(tags=tags) + + # Construct URL + url = self.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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 deployment_script is not None: + body_content = self._serialize.body(deployment_script, 'DeploymentScriptUpdateParameter') + else: + body_content = None + + # 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]: + raise models.DeploymentScriptsErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentScript', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}'} + + def get( + self, resource_group_name, script_name, custom_headers=None, raw=False, **operation_config): + """Gets a deployment script with a given name. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param script_name: Name of the deployment script. + :type script_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: DeploymentScript or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScript + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DeploymentScriptsErrorException` + """ + # 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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.DeploymentScriptsErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentScript', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}'} + + def delete( + self, resource_group_name, script_name, custom_headers=None, raw=False, **operation_config): + """Deletes a deployment script. When operation completes, status code 200 + returned without content. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param script_name: Name of the deployment script. + :type script_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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DeploymentScriptsErrorException` + """ + # 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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, 204]: + raise models.DeploymentScriptsErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Lists all deployment scripts for a given subscription. + + :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 DeploymentScript + :rtype: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScriptPaged[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScript] + :raises: + :class:`DeploymentScriptsErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, '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') + + 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.DeploymentScriptsErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeploymentScriptPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentScripts'} + + def get_logs( + self, resource_group_name, script_name, custom_headers=None, raw=False, **operation_config): + """Gets deployment script logs for a given deployment script name. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param script_name: Name of the deployment script. + :type script_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: ScriptLogsList or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptLogsList + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DeploymentScriptsErrorException` + """ + # Construct URL + url = self.get_logs.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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.DeploymentScriptsErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ScriptLogsList', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}/logs'} + + def get_logs_default( + self, resource_group_name, script_name, tail=None, custom_headers=None, raw=False, **operation_config): + """Gets deployment script logs for a given deployment script name. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param script_name: Name of the deployment script. + :type script_name: str + :param tail: The number of lines to show from the tail of the + deployment script log. Valid value is a positive number up to 1000. If + 'tail' is not provided, all available logs are shown up to container + instance log capacity of 4mb. + :type tail: int + :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: ScriptLog or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptLog or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DeploymentScriptsErrorException` + """ + # Construct URL + url = self.get_logs_default.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if tail is not None: + query_parameters['tail'] = self._serialize.query("tail", tail, 'int') + + # 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.DeploymentScriptsErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ScriptLog', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_logs_default.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}/logs/default'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists deployments scripts. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_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: An iterator like instance of DeploymentScript + :rtype: + ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScriptPaged[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScript] + :raises: + :class:`DeploymentScriptsErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + 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') + + 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.DeploymentScriptsErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeploymentScriptPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/version.py new file mode 100644 index 000000000000..f1684021ce87 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "2020-10-01" + diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py index c1761c597cd7..e8d9ea59d08e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py @@ -13,12 +13,13 @@ from msrest import Serializer, Deserializer from ._configuration import ApplicationClientConfiguration +from .operations import ApplicationClientOperationsMixin from .operations import ApplicationsOperations from .operations import ApplicationDefinitionsOperations from . import models -class ApplicationClient(SDKClient): +class ApplicationClient(ApplicationClientOperationsMixin, SDKClient): """ARM applications :ivar config: Configuration for client. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/__init__.py index fe77a86199f0..c0616bc4fc10 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/__init__.py @@ -18,6 +18,8 @@ from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import GenericResource from ._models_py3 import Identity + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay from ._models_py3 import Plan from ._models_py3 import PlanPatchable from ._models_py3 import Resource @@ -31,12 +33,15 @@ from ._models import ErrorResponse, ErrorResponseException from ._models import GenericResource from ._models import Identity + from ._models import Operation + from ._models import OperationDisplay from ._models import Plan from ._models import PlanPatchable from ._models import Resource from ._models import Sku from ._paged_models import ApplicationDefinitionPaged from ._paged_models import ApplicationPaged +from ._paged_models import OperationPaged from ._application_client_enums import ( ProvisioningState, ApplicationLockLevel, @@ -53,10 +58,13 @@ 'ErrorResponse', 'ErrorResponseException', 'GenericResource', 'Identity', + 'Operation', + 'OperationDisplay', 'Plan', 'PlanPatchable', 'Resource', 'Sku', + 'OperationPaged', 'ApplicationPaged', 'ApplicationDefinitionPaged', 'ProvisioningState', diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models.py index 3572d2988276..97ad73bb4c96 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models.py @@ -507,6 +507,52 @@ def __init__(self, **kwargs): self.type = kwargs.get('type', None) +class Operation(Model): + """Microsoft.Solutions operation. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: The object that represents the operation. + :type display: + ~azure.mgmt.resource.managedapplications.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Solutions + :type provider: str + :param resource: Resource on which the operation is performed: + Application, JitRequest, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + + class Plan(Model): """Plan for the managed application. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models_py3.py index af550cd14d37..a3e179df903c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models_py3.py @@ -507,6 +507,52 @@ def __init__(self, *, type=None, **kwargs) -> None: self.type = type +class Operation(Model): + """Microsoft.Solutions operation. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: The object that represents the operation. + :type display: + ~azure.mgmt.resource.managedapplications.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, *, name: str=None, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Solutions + :type provider: str + :param resource: Resource on which the operation is performed: + Application, JitRequest, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + + class Plan(Model): """Plan for the managed application. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_paged_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_paged_models.py index f043675463e2..ff3781b6aa06 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_paged_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_paged_models.py @@ -12,6 +12,19 @@ from msrest.paging import Paged +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) class ApplicationPaged(Paged): """ A paging container for iterating over a list of :class:`Application ` object diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/__init__.py index 60ebab061654..94b576e685a0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/__init__.py @@ -11,8 +11,10 @@ from ._applications_operations import ApplicationsOperations from ._application_definitions_operations import ApplicationDefinitionsOperations +from ._application_client_operations import ApplicationClientOperationsMixin __all__ = [ 'ApplicationsOperations', 'ApplicationDefinitionsOperations', + 'ApplicationClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_client_operations.py new file mode 100644 index 000000000000..737589352c73 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_client_operations.py @@ -0,0 +1,82 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.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 +import uuid + + +class ApplicationClientOperationsMixin(object): + + def list_operations( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available Microsoft.Solutions REST API operations. + + :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 Operation + :rtype: + ~azure.mgmt.resource.managedapplications.models.OperationPaged[~azure.mgmt.resource.managedapplications.models.Operation] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_operations.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, '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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_operations.metadata = {'url': '/providers/Microsoft.Solutions/operations'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_definitions_operations.py index 2dde22fe0576..a9bd8ba17aa5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_definitions_operations.py @@ -358,14 +358,15 @@ def internal_paging(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions'} def get_by_id( - self, application_definition_id, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, application_definition_name, custom_headers=None, raw=False, **operation_config): """Gets the managed application definition. - :param application_definition_id: The fully qualified ID of the - managed application definition, including the managed application name - and the managed application definition resource type. Use the format, - /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name} - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed + application definition. + :type application_definition_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 @@ -381,7 +382,9 @@ def get_by_id( # Construct URL url = self.get_by_id.metadata['url'] path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True) + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -415,15 +418,17 @@ def get_by_id( return client_raw_response return deserialized - get_by_id.metadata = {'url': '/{applicationDefinitionId}'} + get_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} def _delete_by_id_initial( - self, application_definition_id, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, application_definition_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.delete_by_id.metadata['url'] path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True) + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -452,14 +457,15 @@ def _delete_by_id_initial( return client_raw_response def delete_by_id( - self, application_definition_id, custom_headers=None, raw=False, polling=True, **operation_config): + self, resource_group_name, application_definition_name, custom_headers=None, raw=False, polling=True, **operation_config): """Deletes the managed application definition. - :param application_definition_id: The fully qualified ID of the - managed application definition, including the managed application name - and the managed application definition resource type. Use the format, - /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name} - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed + application definition. + :type application_definition_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 @@ -473,7 +479,8 @@ def delete_by_id( :class:`ErrorResponseException` """ raw_result = self._delete_by_id_initial( - application_definition_id=application_definition_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, custom_headers=custom_headers, raw=True, **operation_config @@ -491,15 +498,17 @@ def get_long_running_output(response): elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete_by_id.metadata = {'url': '/{applicationDefinitionId}'} + delete_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} def _create_or_update_by_id_initial( - self, application_definition_id, parameters, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, application_definition_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.create_or_update_by_id.metadata['url'] path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True) + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -542,14 +551,15 @@ def _create_or_update_by_id_initial( return deserialized def create_or_update_by_id( - self, application_definition_id, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + self, resource_group_name, application_definition_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): """Creates a new managed application definition. - :param application_definition_id: The fully qualified ID of the - managed application definition, including the managed application name - and the managed application definition resource type. Use the format, - /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name} - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed + application definition. + :type application_definition_name: str :param parameters: Parameters supplied to the create or update a managed application definition. :type parameters: @@ -569,7 +579,8 @@ def create_or_update_by_id( :class:`ErrorResponseException` """ raw_result = self._create_or_update_by_id_initial( - application_definition_id=application_definition_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, parameters=parameters, custom_headers=custom_headers, raw=True, @@ -592,4 +603,4 @@ def get_long_running_output(response): 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_by_id.metadata = {'url': '/{applicationDefinitionId}'} + create_or_update_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_applications_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_applications_operations.py index 200dc626853a..c278b7d086ed 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_applications_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_applications_operations.py @@ -297,7 +297,7 @@ def update( :param parameters: Parameters supplied to update an existing managed application. :type parameters: - ~azure.mgmt.resource.managedapplications.models.Application + ~azure.mgmt.resource.managedapplications.models.ApplicationPatchable :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -335,7 +335,7 @@ def update( # Construct body if parameters is not None: - body_content = self._serialize.body(parameters, 'Application') + body_content = self._serialize.body(parameters, 'ApplicationPatchable') else: body_content = None