diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/azure_machine_learning_workspaces.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/azure_machine_learning_workspaces.py index 7d5724562c62..9581e3a525e9 100644 --- a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/azure_machine_learning_workspaces.py +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/azure_machine_learning_workspaces.py @@ -16,6 +16,7 @@ from .operations.operations import Operations from .operations.workspaces_operations import WorkspacesOperations from .operations.machine_learning_compute_operations import MachineLearningComputeOperations +from .operations.quotas_operations import QuotasOperations from . import models @@ -63,6 +64,8 @@ class AzureMachineLearningWorkspaces(SDKClient): :vartype workspaces: azure.mgmt.machinelearningservices.operations.WorkspacesOperations :ivar machine_learning_compute: MachineLearningCompute operations :vartype machine_learning_compute: azure.mgmt.machinelearningservices.operations.MachineLearningComputeOperations + :ivar quotas: Quotas operations + :vartype quotas: azure.mgmt.machinelearningservices.operations.QuotasOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -89,3 +92,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.machine_learning_compute = MachineLearningComputeOperations( self._client, self.config, self._serialize, self._deserialize) + self.quotas = QuotasOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/__init__.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/__init__.py index e03d0d68a8a8..9cd0edaba4d8 100644 --- a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/__init__.py +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/__init__.py @@ -14,6 +14,12 @@ from .operation_py3 import Operation from .workspace_py3 import Workspace from .workspace_update_parameters_py3 import WorkspaceUpdateParameters + from .quota_base_properties_py3 import QuotaBaseProperties + from .quota_update_parameters_py3 import QuotaUpdateParameters + from .update_workspace_quotas_py3 import UpdateWorkspaceQuotas + from .update_workspace_quotas_result_py3 import UpdateWorkspaceQuotasResult + from .resource_name_py3 import ResourceName + from .resource_quota_py3 import ResourceQuota from .identity_py3 import Identity from .resource_py3 import Resource from .password_py3 import Password @@ -46,6 +52,12 @@ from .operation import Operation from .workspace import Workspace from .workspace_update_parameters import WorkspaceUpdateParameters + from .quota_base_properties import QuotaBaseProperties + from .quota_update_parameters import QuotaUpdateParameters + from .update_workspace_quotas import UpdateWorkspaceQuotas + from .update_workspace_quotas_result import UpdateWorkspaceQuotasResult + from .resource_name import ResourceName + from .resource_quota import ResourceQuota from .identity import Identity from .resource import Resource from .password import Password @@ -76,8 +88,10 @@ from .operation_paged import OperationPaged from .workspace_paged import WorkspacePaged from .compute_resource_paged import ComputeResourcePaged +from .resource_quota_paged import ResourceQuotaPaged from .azure_machine_learning_workspaces_enums import ( ProvisioningState, + Status, ResourceIdentityType, ComputeType, ) @@ -87,6 +101,12 @@ 'Operation', 'Workspace', 'WorkspaceUpdateParameters', + 'QuotaBaseProperties', + 'QuotaUpdateParameters', + 'UpdateWorkspaceQuotas', + 'UpdateWorkspaceQuotasResult', + 'ResourceName', + 'ResourceQuota', 'Identity', 'Resource', 'Password', @@ -117,7 +137,9 @@ 'OperationPaged', 'WorkspacePaged', 'ComputeResourcePaged', + 'ResourceQuotaPaged', 'ProvisioningState', + 'Status', 'ResourceIdentityType', 'ComputeType', ] diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/azure_machine_learning_workspaces_enums.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/azure_machine_learning_workspaces_enums.py index b36d430ec8dd..9852680388c6 100644 --- a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/azure_machine_learning_workspaces_enums.py +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/azure_machine_learning_workspaces_enums.py @@ -23,6 +23,13 @@ class ProvisioningState(str, Enum): canceled = "Canceled" +class Status(str, Enum): + + undefined = "Undefined" + success = "Success" + failure = "Failure" + + class ResourceIdentityType(str, Enum): system_assigned = "SystemAssigned" diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/quota_base_properties.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/quota_base_properties.py new file mode 100644 index 000000000000..6dd3cbb979d9 --- /dev/null +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/quota_base_properties.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class QuotaBaseProperties(Model): + """The properties for Quota update or retrieval. + + :param vm_family: Virtual Machine family name. The family name of the + virtual machine size. + :type vm_family: str + :param workspace_id: AML workspace Id. Fully qualified resource identifier + of the workspace. + :type workspace_id: str + :param quota: Quota. The workspace level quota. + :type quota: int + """ + + _attribute_map = { + 'vm_family': {'key': 'vmFamily', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'quota': {'key': 'quota', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(QuotaBaseProperties, self).__init__(**kwargs) + self.vm_family = kwargs.get('vm_family', None) + self.workspace_id = kwargs.get('workspace_id', None) + self.quota = kwargs.get('quota', None) diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/quota_base_properties_py3.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/quota_base_properties_py3.py new file mode 100644 index 000000000000..ca61db95ed5b --- /dev/null +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/quota_base_properties_py3.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class QuotaBaseProperties(Model): + """The properties for Quota update or retrieval. + + :param vm_family: Virtual Machine family name. The family name of the + virtual machine size. + :type vm_family: str + :param workspace_id: AML workspace Id. Fully qualified resource identifier + of the workspace. + :type workspace_id: str + :param quota: Quota. The workspace level quota. + :type quota: int + """ + + _attribute_map = { + 'vm_family': {'key': 'vmFamily', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'quota': {'key': 'quota', 'type': 'int'}, + } + + def __init__(self, *, vm_family: str=None, workspace_id: str=None, quota: int=None, **kwargs) -> None: + super(QuotaBaseProperties, self).__init__(**kwargs) + self.vm_family = vm_family + self.workspace_id = workspace_id + self.quota = quota diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/quota_update_parameters.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/quota_update_parameters.py new file mode 100644 index 000000000000..2b2c0e15de51 --- /dev/null +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/quota_update_parameters.py @@ -0,0 +1,36 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class QuotaUpdateParameters(Model): + """Quota update parameters. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list for update quota. + :vartype value: + list[~azure.mgmt.machinelearningservices.models.QuotaBaseProperties] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QuotaBaseProperties]'}, + } + + def __init__(self, **kwargs): + super(QuotaUpdateParameters, self).__init__(**kwargs) + self.value = None diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/quota_update_parameters_py3.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/quota_update_parameters_py3.py new file mode 100644 index 000000000000..6e3e3281886a --- /dev/null +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/quota_update_parameters_py3.py @@ -0,0 +1,36 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class QuotaUpdateParameters(Model): + """Quota update parameters. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list for update quota. + :vartype value: + list[~azure.mgmt.machinelearningservices.models.QuotaBaseProperties] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QuotaBaseProperties]'}, + } + + def __init__(self, **kwargs) -> None: + super(QuotaUpdateParameters, self).__init__(**kwargs) + self.value = None diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_name.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_name.py new file mode 100644 index 000000000000..4b496528afc7 --- /dev/null +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_name.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ResourceName(Model): + """The Resource Name. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str + """ + + _validation = { + 'value': {'readonly': True}, + 'localized_value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourceName, self).__init__(**kwargs) + self.value = None + self.localized_value = None diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_name_py3.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_name_py3.py new file mode 100644 index 000000000000..7468a8b97a4f --- /dev/null +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_name_py3.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ResourceName(Model): + """The Resource Name. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str + """ + + _validation = { + 'value': {'readonly': True}, + 'localized_value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ResourceName, self).__init__(**kwargs) + self.value = None + self.localized_value = None diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_quota.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_quota.py new file mode 100644 index 000000000000..5e877e0b129a --- /dev/null +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_quota.py @@ -0,0 +1,55 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ResourceQuota(Model): + """The quota assigned to a resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Specifies the resource ID. + :vartype id: str + :ivar type: Specifies the resource type. + :vartype type: str + :ivar name: Name of the resource. + :vartype name: ~azure.mgmt.machinelearningservices.models.ResourceName + :ivar quota: Quota. Quota assigned to the resource. + :vartype quota: int + :ivar unit: The units used to represent the quota. + :vartype unit: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'quota': {'readonly': True}, + 'unit': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'ResourceName'}, + 'quota': {'key': 'quota', 'type': 'int'}, + 'unit': {'key': 'unit', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourceQuota, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.quota = None + self.unit = None diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_quota_paged.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_quota_paged.py new file mode 100644 index 000000000000..74be9f097ff3 --- /dev/null +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_quota_paged.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 ResourceQuotaPaged(Paged): + """ + A paging container for iterating over a list of :class:`ResourceQuota ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ResourceQuota]'} + } + + def __init__(self, *args, **kwargs): + + super(ResourceQuotaPaged, self).__init__(*args, **kwargs) diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_quota_py3.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_quota_py3.py new file mode 100644 index 000000000000..c8d8c6f84152 --- /dev/null +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/resource_quota_py3.py @@ -0,0 +1,55 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ResourceQuota(Model): + """The quota assigned to a resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Specifies the resource ID. + :vartype id: str + :ivar type: Specifies the resource type. + :vartype type: str + :ivar name: Name of the resource. + :vartype name: ~azure.mgmt.machinelearningservices.models.ResourceName + :ivar quota: Quota. Quota assigned to the resource. + :vartype quota: int + :ivar unit: The units used to represent the quota. + :vartype unit: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'quota': {'readonly': True}, + 'unit': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'ResourceName'}, + 'quota': {'key': 'quota', 'type': 'int'}, + 'unit': {'key': 'unit', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ResourceQuota, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.quota = None + self.unit = None diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/update_workspace_quotas.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/update_workspace_quotas.py new file mode 100644 index 000000000000..018d12d6a881 --- /dev/null +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/update_workspace_quotas.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class UpdateWorkspaceQuotas(Model): + """The properties for update Quota response. + + :param vm_family: Virtual Machine family name. The family name of the + virtual machine size. + :type vm_family: str + :param workspace_id: AML workspace Id. Fully qualified resource identifier + of the workspace. + :type workspace_id: str + :param quota: Quota. Quota. + :type quota: int + :param status: Update Workspace Quota Status. Status of update workspace + quota. Possible values include: 'Undefined', 'Success', 'Failure' + :type status: str or ~azure.mgmt.machinelearningservices.models.Status + """ + + _attribute_map = { + 'vm_family': {'key': 'vmFamily', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'quota': {'key': 'quota', 'type': 'int'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UpdateWorkspaceQuotas, self).__init__(**kwargs) + self.vm_family = kwargs.get('vm_family', None) + self.workspace_id = kwargs.get('workspace_id', None) + self.quota = kwargs.get('quota', None) + self.status = kwargs.get('status', None) diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/update_workspace_quotas_py3.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/update_workspace_quotas_py3.py new file mode 100644 index 000000000000..5685809e6f88 --- /dev/null +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/update_workspace_quotas_py3.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class UpdateWorkspaceQuotas(Model): + """The properties for update Quota response. + + :param vm_family: Virtual Machine family name. The family name of the + virtual machine size. + :type vm_family: str + :param workspace_id: AML workspace Id. Fully qualified resource identifier + of the workspace. + :type workspace_id: str + :param quota: Quota. Quota. + :type quota: int + :param status: Update Workspace Quota Status. Status of update workspace + quota. Possible values include: 'Undefined', 'Success', 'Failure' + :type status: str or ~azure.mgmt.machinelearningservices.models.Status + """ + + _attribute_map = { + 'vm_family': {'key': 'vmFamily', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'quota': {'key': 'quota', 'type': 'int'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, *, vm_family: str=None, workspace_id: str=None, quota: int=None, status=None, **kwargs) -> None: + super(UpdateWorkspaceQuotas, self).__init__(**kwargs) + self.vm_family = vm_family + self.workspace_id = workspace_id + self.quota = quota + self.status = status diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/update_workspace_quotas_result.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/update_workspace_quotas_result.py new file mode 100644 index 000000000000..440b75d02d8b --- /dev/null +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/update_workspace_quotas_result.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class UpdateWorkspaceQuotasResult(Model): + """The result of update workspace quota. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of workspace quota update result. + :vartype value: + list[~azure.mgmt.machinelearningservices.models.UpdateWorkspaceQuotas] + :ivar next_link: The URI to fetch the next page of workspace quota update + result. Call ListNext() with this to fetch the next page of Workspace + Quota update result. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UpdateWorkspaceQuotas]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UpdateWorkspaceQuotasResult, self).__init__(**kwargs) + self.value = None + self.next_link = None diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/update_workspace_quotas_result_py3.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/update_workspace_quotas_result_py3.py new file mode 100644 index 000000000000..89382427e1d1 --- /dev/null +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/update_workspace_quotas_result_py3.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class UpdateWorkspaceQuotasResult(Model): + """The result of update workspace quota. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of workspace quota update result. + :vartype value: + list[~azure.mgmt.machinelearningservices.models.UpdateWorkspaceQuotas] + :ivar next_link: The URI to fetch the next page of workspace quota update + result. Call ListNext() with this to fetch the next page of Workspace + Quota update result. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UpdateWorkspaceQuotas]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(UpdateWorkspaceQuotasResult, self).__init__(**kwargs) + self.value = None + self.next_link = None diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/__init__.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/__init__.py index 97f27ec5c277..2af8e8907aba 100644 --- a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/__init__.py +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/__init__.py @@ -12,9 +12,11 @@ from .operations import Operations from .workspaces_operations import WorkspacesOperations from .machine_learning_compute_operations import MachineLearningComputeOperations +from .quotas_operations import QuotasOperations __all__ = [ 'Operations', 'WorkspacesOperations', 'MachineLearningComputeOperations', + 'QuotasOperations', ] diff --git a/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/quotas_operations.py b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/quotas_operations.py new file mode 100644 index 000000000000..29f9cc3c7a85 --- /dev/null +++ b/sdk/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/quotas_operations.py @@ -0,0 +1,202 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class QuotasOperations(object): + """QuotasOperations operations. + + :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: Version of Azure Machine Learning resource provider API. Constant value: "2018-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-03-01-preview" + + self.config = config + + + def _update_initial( + self, location, custom_headers=None, raw=False, **operation_config): + parameters = None + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + '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') + + # 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(parameters, 'QuotaUpdateParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.MachineLearningServiceErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('UpdateWorkspaceQuotasResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, location, custom_headers=None, raw=False, polling=True, **operation_config): + """Update quota for each VM family in workspace. + + :param location: The location for update quota is queried. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + UpdateWorkspaceQuotasResult or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.machinelearningservices.models.UpdateWorkspaceQuotasResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.machinelearningservices.models.UpdateWorkspaceQuotasResult]] + :raises: + :class:`MachineLearningServiceErrorException` + """ + raw_result = self._update_initial( + location=location, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('UpdateWorkspaceQuotasResult', 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) + update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/updateQuotas'} + + def list( + self, location, custom_headers=None, raw=False, **operation_config): + """Gets the currently assigned Workspace Quotas based on VMFamily. + + :param location: The location for which resource usage is queried. + :type location: 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 ResourceQuota + :rtype: + ~azure.mgmt.machinelearningservices.models.ResourceQuotaPaged[~azure.mgmt.machinelearningservices.models.ResourceQuota] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str', 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) + 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 + deserialized = models.ResourceQuotaPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ResourceQuotaPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/Quotas'}