From f9f4a16276796d95e8581ee5b7f97df57fe090bc Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 13 Nov 2020 01:22:32 +0000 Subject: [PATCH] CodeGen from PR 11639 in Azure/azure-rest-api-specs add openapi-subtype (#11639) --- .../azure/mgmt/datadog/_metadata.json | 16 +- .../mgmt/datadog/_microsoft_datadog_client.py | 5 + .../azure/mgmt/datadog/_version.py | 2 +- .../datadog/aio/_microsoft_datadog_client.py | 5 + .../mgmt/datadog/aio/operations/__init__.py | 2 + .../_marketplace_agreements_operations.py | 171 +++++++++++++++++ .../aio/operations/_monitors_operations.py | 16 +- ...ingle_sign_on_configurations_operations.py | 13 +- .../aio/operations/_tag_rules_operations.py | 4 +- .../azure/mgmt/datadog/models/__init__.py | 9 + .../models/_microsoft_datadog_client_enums.py | 2 + .../azure/mgmt/datadog/models/_models.py | 120 +++++++++++- .../azure/mgmt/datadog/models/_models_py3.py | 135 ++++++++++++- .../azure/mgmt/datadog/operations/__init__.py | 2 + .../_marketplace_agreements_operations.py | 177 ++++++++++++++++++ .../operations/_monitors_operations.py | 16 +- ...ingle_sign_on_configurations_operations.py | 13 +- .../operations/_tag_rules_operations.py | 4 +- 18 files changed, 680 insertions(+), 32 deletions(-) create mode 100644 sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_marketplace_agreements_operations.py create mode 100644 sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_marketplace_agreements_operations.py diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_metadata.json b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_metadata.json index 20306082db5d..674c1d3d9270 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_metadata.json +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The Microsoft Azure subscription ID.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The Microsoft Azure subscription ID.", "docstring_type": "str", "required": true @@ -51,6 +52,7 @@ "credential_key_header_name": null }, "operation_groups": { + "marketplace_agreements": "MarketplaceAgreementsOperations", "api_keys": "ApiKeysOperations", "hosts": "HostsOperations", "linked_resources": "LinkedResourcesOperations", diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_microsoft_datadog_client.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_microsoft_datadog_client.py index f6237ab0e3f5..177e85e10556 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_microsoft_datadog_client.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_microsoft_datadog_client.py @@ -18,6 +18,7 @@ from azure.core.credentials import TokenCredential from ._configuration import MicrosoftDatadogClientConfiguration +from .operations import MarketplaceAgreementsOperations from .operations import ApiKeysOperations from .operations import HostsOperations from .operations import LinkedResourcesOperations @@ -33,6 +34,8 @@ class MicrosoftDatadogClient(object): """MicrosoftDatadogClient. + :ivar marketplace_agreements: MarketplaceAgreementsOperations operations + :vartype marketplace_agreements: microsoft_datadog_client.operations.MarketplaceAgreementsOperations :ivar api_keys: ApiKeysOperations operations :vartype api_keys: microsoft_datadog_client.operations.ApiKeysOperations :ivar hosts: HostsOperations operations @@ -76,6 +79,8 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + self.marketplace_agreements = MarketplaceAgreementsOperations( + self._client, self._config, self._serialize, self._deserialize) self.api_keys = ApiKeysOperations( self._client, self._config, self._serialize, self._deserialize) self.hosts = HostsOperations( diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_version.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_version.py index e5754a47ce68..c47f66669f1b 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_version.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "1.0.0" diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_microsoft_datadog_client.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_microsoft_datadog_client.py index 10f86c0df476..6e4ded3c6ae9 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_microsoft_datadog_client.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_microsoft_datadog_client.py @@ -16,6 +16,7 @@ from azure.core.credentials_async import AsyncTokenCredential from ._configuration import MicrosoftDatadogClientConfiguration +from .operations import MarketplaceAgreementsOperations from .operations import ApiKeysOperations from .operations import HostsOperations from .operations import LinkedResourcesOperations @@ -31,6 +32,8 @@ class MicrosoftDatadogClient(object): """MicrosoftDatadogClient. + :ivar marketplace_agreements: MarketplaceAgreementsOperations operations + :vartype marketplace_agreements: microsoft_datadog_client.aio.operations.MarketplaceAgreementsOperations :ivar api_keys: ApiKeysOperations operations :vartype api_keys: microsoft_datadog_client.aio.operations.ApiKeysOperations :ivar hosts: HostsOperations operations @@ -73,6 +76,8 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + self.marketplace_agreements = MarketplaceAgreementsOperations( + self._client, self._config, self._serialize, self._deserialize) self.api_keys = ApiKeysOperations( self._client, self._config, self._serialize, self._deserialize) self.hosts = HostsOperations( diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/__init__.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/__init__.py index 2938c7321a2a..0ba3af657d61 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/__init__.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/__init__.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._marketplace_agreements_operations import MarketplaceAgreementsOperations from ._api_keys_operations import ApiKeysOperations from ._hosts_operations import HostsOperations from ._linked_resources_operations import LinkedResourcesOperations @@ -17,6 +18,7 @@ from ._single_sign_on_configurations_operations import SingleSignOnConfigurationsOperations __all__ = [ + 'MarketplaceAgreementsOperations', 'ApiKeysOperations', 'HostsOperations', 'LinkedResourcesOperations', diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_marketplace_agreements_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_marketplace_agreements_operations.py new file mode 100644 index 000000000000..1e1c28a4fee8 --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_marketplace_agreements_operations.py @@ -0,0 +1,171 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MarketplaceAgreementsOperations: + """MarketplaceAgreementsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_datadog_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.DatadogAgreementResourceListResponse"]: + """List Datadog marketplace agreements in the subscription. + + List Datadog marketplace agreements in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogAgreementResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogAgreementResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogAgreementResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogAgreementResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements'} # type: ignore + + async def create( + self, + body: Optional["models.DatadogAgreementResource"] = None, + **kwargs + ) -> "models.DatadogAgreementResource": + """Create Datadog marketplace agreement in the subscription. + + Create Datadog marketplace agreement in the subscription. + + :param body: + :type body: ~microsoft_datadog_client.models.DatadogAgreementResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogAgreementResource, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogAgreementResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogAgreementResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogAgreementResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogAgreementResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default'} # type: ignore diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitors_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitors_operations.py index 5562ab3f4984..38d9bb40c6fe 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitors_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitors_operations.py @@ -363,7 +363,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + 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'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -542,7 +548,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_single_sign_on_configurations_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_single_sign_on_configurations_operations.py index a7b725c5252c..2f5b2171bd08 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_single_sign_on_configurations_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_single_sign_on_configurations_operations.py @@ -201,7 +201,7 @@ async def begin_create_or_update( :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param configuration_name: + :param configuration_name: Configuration name. :type configuration_name: str :param body: :type body: ~microsoft_datadog_client.models.DatadogSingleSignOnResource @@ -242,7 +242,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + 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'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -272,7 +279,7 @@ async def get( :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param configuration_name: + :param configuration_name: Configuration name. :type configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DatadogSingleSignOnResource, or the result of cls(response) diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_tag_rules_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_tag_rules_operations.py index 29a0438256e5..85fc67c18b92 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_tag_rules_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_tag_rules_operations.py @@ -136,7 +136,7 @@ async def create_or_update( :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param rule_set_name: + :param rule_set_name: Rule set name. :type rule_set_name: str :param body: :type body: ~microsoft_datadog_client.models.MonitoringTagRules @@ -212,7 +212,7 @@ async def get( :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param rule_set_name: + :param rule_set_name: Rule set name. :type rule_set_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: MonitoringTagRules, or the result of cls(response) diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/__init__.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/__init__.py index 277bef145c15..214693e7ae48 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/__init__.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import DatadogAgreementProperties + from ._models_py3 import DatadogAgreementResource + from ._models_py3 import DatadogAgreementResourceListResponse from ._models_py3 import DatadogApiKey from ._models_py3 import DatadogApiKeyListResponse from ._models_py3 import DatadogHost @@ -43,6 +46,9 @@ from ._models_py3 import ResourceSku from ._models_py3 import UserInfo except (SyntaxError, ImportError): + from ._models import DatadogAgreementProperties # type: ignore + from ._models import DatadogAgreementResource # type: ignore + from ._models import DatadogAgreementResourceListResponse # type: ignore from ._models import DatadogApiKey # type: ignore from ._models import DatadogApiKeyListResponse # type: ignore from ._models import DatadogHost # type: ignore @@ -90,6 +96,9 @@ ) __all__ = [ + 'DatadogAgreementProperties', + 'DatadogAgreementResource', + 'DatadogAgreementResourceListResponse', 'DatadogApiKey', 'DatadogApiKeyListResponse', 'DatadogHost', diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_microsoft_datadog_client_enums.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_microsoft_datadog_client_enums.py index 7e344646af02..942b2ad730d4 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_microsoft_datadog_client_enums.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_microsoft_datadog_client_enums.py @@ -32,6 +32,8 @@ class LiftrResourceCategories(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum MONITOR_LOGS = "MonitorLogs" class ManagedIdentityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Identity type + """ SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models.py index d28175f29d35..372965756240 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models.py @@ -10,6 +10,116 @@ import msrest.serialization +class DatadogAgreementProperties(msrest.serialization.Model): + """Terms properties. + + :param publisher: Publisher identifier string. + :type publisher: str + :param product: Product identifier string. + :type product: str + :param plan: Plan identifier string. + :type plan: str + :param license_text_link: Link to HTML with Microsoft and Publisher terms. + :type license_text_link: str + :param privacy_policy_link: Link to the privacy policy of the publisher. + :type privacy_policy_link: str + :param retrieve_datetime: Date and time in UTC of when the terms were accepted. This is empty + if Accepted is false. + :type retrieve_datetime: ~datetime.datetime + :param signature: Terms signature. + :type signature: str + :param accepted: If any version of the terms have been accepted, otherwise false. + :type accepted: bool + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'plan': {'key': 'plan', 'type': 'str'}, + 'license_text_link': {'key': 'licenseTextLink', 'type': 'str'}, + 'privacy_policy_link': {'key': 'privacyPolicyLink', 'type': 'str'}, + 'retrieve_datetime': {'key': 'retrieveDatetime', 'type': 'iso-8601'}, + 'signature': {'key': 'signature', 'type': 'str'}, + 'accepted': {'key': 'accepted', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(DatadogAgreementProperties, self).__init__(**kwargs) + self.publisher = kwargs.get('publisher', None) + self.product = kwargs.get('product', None) + self.plan = kwargs.get('plan', None) + self.license_text_link = kwargs.get('license_text_link', None) + self.privacy_policy_link = kwargs.get('privacy_policy_link', None) + self.retrieve_datetime = kwargs.get('retrieve_datetime', None) + self.signature = kwargs.get('signature', None) + self.accepted = kwargs.get('accepted', None) + + +class DatadogAgreementResource(msrest.serialization.Model): + """DatadogAgreementResource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: ARM id of the resource. + :vartype id: str + :ivar name: Name of the agreement. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param properties: Represents the properties of the resource. + :type properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DatadogAgreementProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(DatadogAgreementResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs.get('properties', None) + + +class DatadogAgreementResourceListResponse(msrest.serialization.Model): + """Response of a list operation. + + :param value: Results of a list operation. + :type value: list[~microsoft_datadog_client.models.DatadogAgreementResource] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DatadogAgreementResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatadogAgreementResourceListResponse, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + class DatadogApiKey(msrest.serialization.Model): """DatadogApiKey. @@ -303,7 +413,7 @@ def __init__( class DatadogOrganizationProperties(msrest.serialization.Model): - """DatadogOrganizationProperties. + """Datadog organization properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -522,7 +632,7 @@ class IdentityProperties(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: Possible values include: "SystemAssigned", "UserAssigned". + :param type: Identity type. Possible values include: "SystemAssigned", "UserAssigned". :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes """ @@ -808,10 +918,10 @@ class MonitorProperties(msrest.serialization.Model): values include: "Active", "Suspended". :type marketplace_subscription_status: str or ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: + :param datadog_organization_properties: Datadog organization properties. :type datadog_organization_properties: ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: + :param user_info: User info. :type user_info: ~microsoft_datadog_client.models.UserInfo :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". :vartype liftr_resource_category: str or @@ -995,7 +1105,7 @@ def __init__( class UserInfo(msrest.serialization.Model): - """UserInfo. + """User info. :param name: Name of the user. :type name: str diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models_py3.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models_py3.py index 274ea73299f8..791ec4923f90 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models_py3.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models_py3.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime from typing import Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError @@ -14,6 +15,130 @@ from ._microsoft_datadog_client_enums import * +class DatadogAgreementProperties(msrest.serialization.Model): + """Terms properties. + + :param publisher: Publisher identifier string. + :type publisher: str + :param product: Product identifier string. + :type product: str + :param plan: Plan identifier string. + :type plan: str + :param license_text_link: Link to HTML with Microsoft and Publisher terms. + :type license_text_link: str + :param privacy_policy_link: Link to the privacy policy of the publisher. + :type privacy_policy_link: str + :param retrieve_datetime: Date and time in UTC of when the terms were accepted. This is empty + if Accepted is false. + :type retrieve_datetime: ~datetime.datetime + :param signature: Terms signature. + :type signature: str + :param accepted: If any version of the terms have been accepted, otherwise false. + :type accepted: bool + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'plan': {'key': 'plan', 'type': 'str'}, + 'license_text_link': {'key': 'licenseTextLink', 'type': 'str'}, + 'privacy_policy_link': {'key': 'privacyPolicyLink', 'type': 'str'}, + 'retrieve_datetime': {'key': 'retrieveDatetime', 'type': 'iso-8601'}, + 'signature': {'key': 'signature', 'type': 'str'}, + 'accepted': {'key': 'accepted', 'type': 'bool'}, + } + + def __init__( + self, + *, + publisher: Optional[str] = None, + product: Optional[str] = None, + plan: Optional[str] = None, + license_text_link: Optional[str] = None, + privacy_policy_link: Optional[str] = None, + retrieve_datetime: Optional[datetime.datetime] = None, + signature: Optional[str] = None, + accepted: Optional[bool] = None, + **kwargs + ): + super(DatadogAgreementProperties, self).__init__(**kwargs) + self.publisher = publisher + self.product = product + self.plan = plan + self.license_text_link = license_text_link + self.privacy_policy_link = privacy_policy_link + self.retrieve_datetime = retrieve_datetime + self.signature = signature + self.accepted = accepted + + +class DatadogAgreementResource(msrest.serialization.Model): + """DatadogAgreementResource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: ARM id of the resource. + :vartype id: str + :ivar name: Name of the agreement. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param properties: Represents the properties of the resource. + :type properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DatadogAgreementProperties'}, + } + + def __init__( + self, + *, + properties: Optional["DatadogAgreementProperties"] = None, + **kwargs + ): + super(DatadogAgreementResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class DatadogAgreementResourceListResponse(msrest.serialization.Model): + """Response of a list operation. + + :param value: Results of a list operation. + :type value: list[~microsoft_datadog_client.models.DatadogAgreementResource] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DatadogAgreementResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DatadogAgreementResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DatadogAgreementResourceListResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + class DatadogApiKey(msrest.serialization.Model): """DatadogApiKey. @@ -345,7 +470,7 @@ def __init__( class DatadogOrganizationProperties(msrest.serialization.Model): - """DatadogOrganizationProperties. + """Datadog organization properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -588,7 +713,7 @@ class IdentityProperties(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: Possible values include: "SystemAssigned", "UserAssigned". + :param type: Identity type. Possible values include: "SystemAssigned", "UserAssigned". :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes """ @@ -905,10 +1030,10 @@ class MonitorProperties(msrest.serialization.Model): values include: "Active", "Suspended". :type marketplace_subscription_status: str or ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: + :param datadog_organization_properties: Datadog organization properties. :type datadog_organization_properties: ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: + :param user_info: User info. :type user_info: ~microsoft_datadog_client.models.UserInfo :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". :vartype liftr_resource_category: str or @@ -1116,7 +1241,7 @@ def __init__( class UserInfo(msrest.serialization.Model): - """UserInfo. + """User info. :param name: Name of the user. :type name: str diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/__init__.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/__init__.py index 2938c7321a2a..0ba3af657d61 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/__init__.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/__init__.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._marketplace_agreements_operations import MarketplaceAgreementsOperations from ._api_keys_operations import ApiKeysOperations from ._hosts_operations import HostsOperations from ._linked_resources_operations import LinkedResourcesOperations @@ -17,6 +18,7 @@ from ._single_sign_on_configurations_operations import SingleSignOnConfigurationsOperations __all__ = [ + 'MarketplaceAgreementsOperations', 'ApiKeysOperations', 'HostsOperations', 'LinkedResourcesOperations', diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_marketplace_agreements_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_marketplace_agreements_operations.py new file mode 100644 index 000000000000..98524a2f429f --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_marketplace_agreements_operations.py @@ -0,0 +1,177 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class MarketplaceAgreementsOperations(object): + """MarketplaceAgreementsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_datadog_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DatadogAgreementResourceListResponse"] + """List Datadog marketplace agreements in the subscription. + + List Datadog marketplace agreements in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogAgreementResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogAgreementResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogAgreementResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogAgreementResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements'} # type: ignore + + def create( + self, + body=None, # type: Optional["models.DatadogAgreementResource"] + **kwargs # type: Any + ): + # type: (...) -> "models.DatadogAgreementResource" + """Create Datadog marketplace agreement in the subscription. + + Create Datadog marketplace agreement in the subscription. + + :param body: + :type body: ~microsoft_datadog_client.models.DatadogAgreementResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogAgreementResource, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogAgreementResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogAgreementResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogAgreementResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogAgreementResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default'} # type: ignore diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitors_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitors_operations.py index c4d6b2fee4e8..1af7fb7db152 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitors_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitors_operations.py @@ -372,7 +372,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + 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'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -554,7 +560,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_single_sign_on_configurations_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_single_sign_on_configurations_operations.py index ee09e20bfa2d..6fcde9516f58 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_single_sign_on_configurations_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_single_sign_on_configurations_operations.py @@ -208,7 +208,7 @@ def begin_create_or_update( :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param configuration_name: + :param configuration_name: Configuration name. :type configuration_name: str :param body: :type body: ~microsoft_datadog_client.models.DatadogSingleSignOnResource @@ -249,7 +249,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + 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'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -280,7 +287,7 @@ def get( :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param configuration_name: + :param configuration_name: Configuration name. :type configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DatadogSingleSignOnResource, or the result of cls(response) diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_tag_rules_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_tag_rules_operations.py index e37c2d75dfb9..599229bd4946 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_tag_rules_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_tag_rules_operations.py @@ -142,7 +142,7 @@ def create_or_update( :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param rule_set_name: + :param rule_set_name: Rule set name. :type rule_set_name: str :param body: :type body: ~microsoft_datadog_client.models.MonitoringTagRules @@ -219,7 +219,7 @@ def get( :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param rule_set_name: + :param rule_set_name: Rule set name. :type rule_set_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: MonitoringTagRules, or the result of cls(response)