diff --git a/sdk/datadog/azure-mgmt-datadog/CHANGELOG.md b/sdk/datadog/azure-mgmt-datadog/CHANGELOG.md index 01503f40fa61..b1549f70eb41 100644 --- a/sdk/datadog/azure-mgmt-datadog/CHANGELOG.md +++ b/sdk/datadog/azure-mgmt-datadog/CHANGELOG.md @@ -1,5 +1,32 @@ # Release History +## 1.0.0b3 (2021-03-02) + +**Features** + + - Model DatadogOrganizationProperties has a new parameter application_key + - Model DatadogOrganizationProperties has a new parameter redirect_uri + - Model DatadogOrganizationProperties has a new parameter api_key + - Model MonitoringTagRulesProperties has a new parameter provisioning_state + - Model DatadogSingleSignOnProperties has a new parameter provisioning_state + - Added operation MarketplaceAgreementsOperations.create_or_update + - Added operation MonitorsOperations.list_monitored_resources + - Added operation MonitorsOperations.refresh_set_password_link + - Added operation MonitorsOperations.get_default_key + - Added operation MonitorsOperations.set_default_key + - Added operation MonitorsOperations.list_api_keys + - Added operation MonitorsOperations.list_hosts + - Added operation MonitorsOperations.list_linked_resources + +**Breaking changes** + + - Removed operation MarketplaceAgreementsOperations.create + - Removed operation group RefreshSetPasswordOperations + - Removed operation group HostsOperations + - Removed operation group ApiKeysOperations + - Removed operation group MonitoredResourcesOperations + - Removed operation group LinkedResourcesOperations + ## 1.0.0b2 (2020-11-17) **Features** 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..afa30fc94835 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,13 +52,9 @@ "credential_key_header_name": null }, "operation_groups": { - "api_keys": "ApiKeysOperations", - "hosts": "HostsOperations", - "linked_resources": "LinkedResourcesOperations", - "monitored_resources": "MonitoredResourcesOperations", - "operations": "Operations", + "marketplace_agreements": "MarketplaceAgreementsOperations", "monitors": "MonitorsOperations", - "refresh_set_password": "RefreshSetPasswordOperations", + "operations": "Operations", "tag_rules": "TagRulesOperations", "single_sign_on_configurations": "SingleSignOnConfigurationsOperations" }, 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 cf1a8e3c5a49..c8ba724207c1 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 @@ -19,13 +19,8 @@ from ._configuration import MicrosoftDatadogClientConfiguration from .operations import MarketplaceAgreementsOperations -from .operations import ApiKeysOperations -from .operations import HostsOperations -from .operations import LinkedResourcesOperations -from .operations import MonitoredResourcesOperations -from .operations import Operations from .operations import MonitorsOperations -from .operations import RefreshSetPasswordOperations +from .operations import Operations from .operations import TagRulesOperations from .operations import SingleSignOnConfigurationsOperations from . import models @@ -36,20 +31,10 @@ class MicrosoftDatadogClient(object): :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 - :vartype hosts: microsoft_datadog_client.operations.HostsOperations - :ivar linked_resources: LinkedResourcesOperations operations - :vartype linked_resources: microsoft_datadog_client.operations.LinkedResourcesOperations - :ivar monitored_resources: MonitoredResourcesOperations operations - :vartype monitored_resources: microsoft_datadog_client.operations.MonitoredResourcesOperations - :ivar operations: Operations operations - :vartype operations: microsoft_datadog_client.operations.Operations :ivar monitors: MonitorsOperations operations :vartype monitors: microsoft_datadog_client.operations.MonitorsOperations - :ivar refresh_set_password: RefreshSetPasswordOperations operations - :vartype refresh_set_password: microsoft_datadog_client.operations.RefreshSetPasswordOperations + :ivar operations: Operations operations + :vartype operations: microsoft_datadog_client.operations.Operations :ivar tag_rules: TagRulesOperations operations :vartype tag_rules: microsoft_datadog_client.operations.TagRulesOperations :ivar single_sign_on_configurations: SingleSignOnConfigurationsOperations operations @@ -77,24 +62,13 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False 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( - self._client, self._config, self._serialize, self._deserialize) - self.linked_resources = LinkedResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitored_resources = MonitoredResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) self.monitors = MonitorsOperations( self._client, self._config, self._serialize, self._deserialize) - self.refresh_set_password = RefreshSetPasswordOperations( + self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) self.tag_rules = TagRulesOperations( self._client, self._config, self._serialize, self._deserialize) 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 dfa6ee022f15..20971492f129 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.0b2" +VERSION = "1.0.0b3" 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 cf4af7466bb3..0897bdbed9e4 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 @@ -17,13 +17,8 @@ from ._configuration import MicrosoftDatadogClientConfiguration from .operations import MarketplaceAgreementsOperations -from .operations import ApiKeysOperations -from .operations import HostsOperations -from .operations import LinkedResourcesOperations -from .operations import MonitoredResourcesOperations -from .operations import Operations from .operations import MonitorsOperations -from .operations import RefreshSetPasswordOperations +from .operations import Operations from .operations import TagRulesOperations from .operations import SingleSignOnConfigurationsOperations from .. import models @@ -34,20 +29,10 @@ class MicrosoftDatadogClient(object): :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 - :vartype hosts: microsoft_datadog_client.aio.operations.HostsOperations - :ivar linked_resources: LinkedResourcesOperations operations - :vartype linked_resources: microsoft_datadog_client.aio.operations.LinkedResourcesOperations - :ivar monitored_resources: MonitoredResourcesOperations operations - :vartype monitored_resources: microsoft_datadog_client.aio.operations.MonitoredResourcesOperations - :ivar operations: Operations operations - :vartype operations: microsoft_datadog_client.aio.operations.Operations :ivar monitors: MonitorsOperations operations :vartype monitors: microsoft_datadog_client.aio.operations.MonitorsOperations - :ivar refresh_set_password: RefreshSetPasswordOperations operations - :vartype refresh_set_password: microsoft_datadog_client.aio.operations.RefreshSetPasswordOperations + :ivar operations: Operations operations + :vartype operations: microsoft_datadog_client.aio.operations.Operations :ivar tag_rules: TagRulesOperations operations :vartype tag_rules: microsoft_datadog_client.aio.operations.TagRulesOperations :ivar single_sign_on_configurations: SingleSignOnConfigurationsOperations operations @@ -74,24 +59,13 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False 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( - self._client, self._config, self._serialize, self._deserialize) - self.linked_resources = LinkedResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitored_resources = MonitoredResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) self.monitors = MonitorsOperations( self._client, self._config, self._serialize, self._deserialize) - self.refresh_set_password = RefreshSetPasswordOperations( + self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) self.tag_rules = TagRulesOperations( self._client, self._config, self._serialize, self._deserialize) 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 0ba3af657d61..b2edc8eaf2df 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 @@ -7,25 +7,15 @@ # -------------------------------------------------------------------------- from ._marketplace_agreements_operations import MarketplaceAgreementsOperations -from ._api_keys_operations import ApiKeysOperations -from ._hosts_operations import HostsOperations -from ._linked_resources_operations import LinkedResourcesOperations -from ._monitored_resources_operations import MonitoredResourcesOperations -from ._operations import Operations from ._monitors_operations import MonitorsOperations -from ._refresh_set_password_operations import RefreshSetPasswordOperations +from ._operations import Operations from ._tag_rules_operations import TagRulesOperations from ._single_sign_on_configurations_operations import SingleSignOnConfigurationsOperations __all__ = [ 'MarketplaceAgreementsOperations', - 'ApiKeysOperations', - 'HostsOperations', - 'LinkedResourcesOperations', - 'MonitoredResourcesOperations', - 'Operations', 'MonitorsOperations', - 'RefreshSetPasswordOperations', + 'Operations', 'TagRulesOperations', 'SingleSignOnConfigurationsOperations', ] 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 index 1e8c6a698e63..a9328b39b149 100644 --- 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 @@ -59,6 +59,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -75,6 +76,7 @@ def prepare_request(next_link=None): url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) else: @@ -108,7 +110,7 @@ async def get_next(next_link=None): ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements'} # type: ignore - async def create( + async def create_or_update( self, body: Optional["_models.DatadogAgreementResource"] = None, **kwargs @@ -129,11 +131,12 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create.metadata['url'] # type: ignore + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } @@ -141,6 +144,7 @@ async def create( # Construct parameters query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] @@ -168,4 +172,4 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default'} # type: ignore + create_or_update.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 a8160db3993b..d51aed0c83ea 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 @@ -43,6 +43,450 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + def list_api_keys( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["_models.DatadogApiKeyListResponse"]: + """List the api keys for a given monitor resource. + + List the api keys for a given monitor resource. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogApiKeyListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogApiKeyListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + 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_api_keys.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(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('DatadogApiKeyListResponse', 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_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys'} # type: ignore + + async def get_default_key( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> "_models.DatadogApiKey": + """Get the default api key. + + Get the default api key. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogApiKey, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogApiKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogApiKey"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_default_key.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + 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('DatadogApiKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey'} # type: ignore + + async def set_default_key( + self, + resource_group_name: str, + monitor_name: str, + body: Optional["_models.DatadogApiKey"] = None, + **kwargs + ) -> None: + """Set the default api key. + + Set the default api key. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_datadog_client.models.DatadogApiKey + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.set_default_key.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'DatadogApiKey') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(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) + + if cls: + return cls(pipeline_response, None, {}) + + set_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey'} # type: ignore + + def list_hosts( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["_models.DatadogHostListResponse"]: + """List the hosts for a given monitor resource. + + List the hosts for a given monitor resource. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogHostListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogHostListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + 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_hosts.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(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('DatadogHostListResponse', 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_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts'} # type: ignore + + def list_linked_resources( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["_models.LinkedResourceListResponse"]: + """List all Azure resources associated to the same Datadog organization as the target resource. + + List all Azure resources associated to the same Datadog organization as the target resource. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LinkedResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + 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_linked_resources.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(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('LinkedResourceListResponse', 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_linked_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources'} # type: ignore + + def list_monitored_resources( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["_models.MonitoredResourceListResponse"]: + """List the resources currently being monitored by the Datadog monitor resource. + + List the resources currently being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoredResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.MonitoredResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoredResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + 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_monitored_resources.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(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('MonitoredResourceListResponse', 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_monitored_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources'} # type: ignore + def list( self, **kwargs @@ -567,3 +1011,65 @@ def get_long_running_output(pipeline_response): else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + async def refresh_set_password_link( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> "_models.DatadogSetPasswordLink": + """Refresh the set password link and return a latest one. + + Refresh the set password link and return a latest one. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogSetPasswordLink, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogSetPasswordLink + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogSetPasswordLink"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.refresh_set_password_link.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + 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('DatadogSetPasswordLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + refresh_set_password_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink'} # type: ignore 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 942b2ad730d4..8f569e2b1bb9 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 @@ -43,8 +43,10 @@ class MarketplaceSubscriptionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str time, the resource will go in Suspended state. """ + PROVISIONING = "Provisioning" ACTIVE = "Active" SUSPENDED = "Suspended" + UNSUBSCRIBED = "Unsubscribed" class MonitoringStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Flag specifying if the resource monitoring is enabled or disabled. 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 372965756240..3202a480f505 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 @@ -426,6 +426,12 @@ class DatadogOrganizationProperties(msrest.serialization.Model): :param linking_client_id: The client_id from an existing in exchange for an auth token to link organization. :type linking_client_id: str + :param redirect_uri: The redirect uri for linking. + :type redirect_uri: str + :param api_key: Api key associated to the Datadog organization. + :type api_key: str + :param application_key: Application key associated to the Datadog organization. + :type application_key: str :param enterprise_app_id: The Id of the Enterprise App used for Single sign on. :type enterprise_app_id: str """ @@ -440,6 +446,9 @@ class DatadogOrganizationProperties(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'linking_auth_code': {'key': 'linkingAuthCode', 'type': 'str'}, 'linking_client_id': {'key': 'linkingClientId', 'type': 'str'}, + 'redirect_uri': {'key': 'redirectUri', 'type': 'str'}, + 'api_key': {'key': 'apiKey', 'type': 'str'}, + 'application_key': {'key': 'applicationKey', 'type': 'str'}, 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, } @@ -452,6 +461,9 @@ def __init__( self.id = None self.linking_auth_code = kwargs.get('linking_auth_code', None) self.linking_client_id = kwargs.get('linking_client_id', None) + self.redirect_uri = kwargs.get('redirect_uri', None) + self.api_key = kwargs.get('api_key', None) + self.application_key = kwargs.get('application_key', None) self.enterprise_app_id = kwargs.get('enterprise_app_id', None) @@ -477,16 +489,26 @@ def __init__( class DatadogSingleSignOnProperties(msrest.serialization.Model): """DatadogSingleSignOnProperties. + Variables are only populated by the server, and will be ignored when sending a request. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState :param single_sign_on_state: Various states of the SSO resource. Possible values include: "Initial", "Enable", "Disable", "Existing". :type single_sign_on_state: str or ~microsoft_datadog_client.models.SingleSignOnStates :param enterprise_app_id: The Id of the Enterprise App used for Single sign-on. :type enterprise_app_id: str - :param single_sign_on_url: The login URL specific to this Datadog Organization. - :type single_sign_on_url: str + :ivar single_sign_on_url: The login URL specific to this Datadog Organization. + :vartype single_sign_on_url: str """ + _validation = { + 'single_sign_on_url': {'readonly': True}, + } + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'single_sign_on_state': {'key': 'singleSignOnState', 'type': 'str'}, 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, 'single_sign_on_url': {'key': 'singleSignOnUrl', 'type': 'str'}, @@ -497,9 +519,10 @@ def __init__( **kwargs ): super(DatadogSingleSignOnProperties, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) self.single_sign_on_state = kwargs.get('single_sign_on_state', None) self.enterprise_app_id = kwargs.get('enterprise_app_id', None) - self.single_sign_on_url = kwargs.get('single_sign_on_url', None) + self.single_sign_on_url = None class DatadogSingleSignOnResource(msrest.serialization.Model): @@ -882,6 +905,9 @@ def __init__( class MonitoringTagRulesProperties(msrest.serialization.Model): """Definition of the properties for a TagRules resource. + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState :param log_rules: Set of rules for sending logs for the Monitor resource. :type log_rules: ~microsoft_datadog_client.models.LogRules :param metric_rules: Set of rules for sending metrics for the Monitor resource. @@ -889,6 +915,7 @@ class MonitoringTagRulesProperties(msrest.serialization.Model): """ _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'log_rules': {'key': 'logRules', 'type': 'LogRules'}, 'metric_rules': {'key': 'metricRules', 'type': 'MetricRules'}, } @@ -898,6 +925,7 @@ def __init__( **kwargs ): super(MonitoringTagRulesProperties, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) self.log_rules = kwargs.get('log_rules', None) self.metric_rules = kwargs.get('metric_rules', None) @@ -911,12 +939,12 @@ class MonitorProperties(msrest.serialization.Model): "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". + Possible values include: "Enabled", "Disabled". Default value: "Enabled". :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :param marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of + :ivar marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state. Possible - values include: "Active", "Suspended". - :type marketplace_subscription_status: str or + values include: "Provisioning", "Active", "Suspended", "Unsubscribed". + :vartype marketplace_subscription_status: str or ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus :param datadog_organization_properties: Datadog organization properties. :type datadog_organization_properties: @@ -931,6 +959,7 @@ class MonitorProperties(msrest.serialization.Model): """ _validation = { + 'marketplace_subscription_status': {'readonly': True}, 'liftr_resource_category': {'readonly': True}, 'liftr_resource_preference': {'readonly': True}, } @@ -951,8 +980,8 @@ def __init__( ): super(MonitorProperties, self).__init__(**kwargs) self.provisioning_state = kwargs.get('provisioning_state', None) - self.monitoring_status = kwargs.get('monitoring_status', None) - self.marketplace_subscription_status = kwargs.get('marketplace_subscription_status', None) + self.monitoring_status = kwargs.get('monitoring_status', "Enabled") + self.marketplace_subscription_status = None self.datadog_organization_properties = kwargs.get('datadog_organization_properties', None) self.user_info = kwargs.get('user_info', None) self.liftr_resource_category = None @@ -963,7 +992,7 @@ class MonitorUpdateProperties(msrest.serialization.Model): """The set of properties that can be update in a PATCH request to a monitor resource. :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". + Possible values include: "Enabled", "Disabled". Default value: "Enabled". :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus """ @@ -976,7 +1005,7 @@ def __init__( **kwargs ): super(MonitorUpdateProperties, self).__init__(**kwargs) - self.monitoring_status = kwargs.get('monitoring_status', None) + self.monitoring_status = kwargs.get('monitoring_status', "Enabled") class OperationDisplay(msrest.serialization.Model): 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 791ec4923f90..72fa3ae29b9b 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 @@ -483,6 +483,12 @@ class DatadogOrganizationProperties(msrest.serialization.Model): :param linking_client_id: The client_id from an existing in exchange for an auth token to link organization. :type linking_client_id: str + :param redirect_uri: The redirect uri for linking. + :type redirect_uri: str + :param api_key: Api key associated to the Datadog organization. + :type api_key: str + :param application_key: Application key associated to the Datadog organization. + :type application_key: str :param enterprise_app_id: The Id of the Enterprise App used for Single sign on. :type enterprise_app_id: str """ @@ -497,6 +503,9 @@ class DatadogOrganizationProperties(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'linking_auth_code': {'key': 'linkingAuthCode', 'type': 'str'}, 'linking_client_id': {'key': 'linkingClientId', 'type': 'str'}, + 'redirect_uri': {'key': 'redirectUri', 'type': 'str'}, + 'api_key': {'key': 'apiKey', 'type': 'str'}, + 'application_key': {'key': 'applicationKey', 'type': 'str'}, 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, } @@ -505,6 +514,9 @@ def __init__( *, linking_auth_code: Optional[str] = None, linking_client_id: Optional[str] = None, + redirect_uri: Optional[str] = None, + api_key: Optional[str] = None, + application_key: Optional[str] = None, enterprise_app_id: Optional[str] = None, **kwargs ): @@ -513,6 +525,9 @@ def __init__( self.id = None self.linking_auth_code = linking_auth_code self.linking_client_id = linking_client_id + self.redirect_uri = redirect_uri + self.api_key = api_key + self.application_key = application_key self.enterprise_app_id = enterprise_app_id @@ -540,16 +555,26 @@ def __init__( class DatadogSingleSignOnProperties(msrest.serialization.Model): """DatadogSingleSignOnProperties. + Variables are only populated by the server, and will be ignored when sending a request. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState :param single_sign_on_state: Various states of the SSO resource. Possible values include: "Initial", "Enable", "Disable", "Existing". :type single_sign_on_state: str or ~microsoft_datadog_client.models.SingleSignOnStates :param enterprise_app_id: The Id of the Enterprise App used for Single sign-on. :type enterprise_app_id: str - :param single_sign_on_url: The login URL specific to this Datadog Organization. - :type single_sign_on_url: str + :ivar single_sign_on_url: The login URL specific to this Datadog Organization. + :vartype single_sign_on_url: str """ + _validation = { + 'single_sign_on_url': {'readonly': True}, + } + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'single_sign_on_state': {'key': 'singleSignOnState', 'type': 'str'}, 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, 'single_sign_on_url': {'key': 'singleSignOnUrl', 'type': 'str'}, @@ -558,15 +583,16 @@ class DatadogSingleSignOnProperties(msrest.serialization.Model): def __init__( self, *, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, single_sign_on_state: Optional[Union[str, "SingleSignOnStates"]] = None, enterprise_app_id: Optional[str] = None, - single_sign_on_url: Optional[str] = None, **kwargs ): super(DatadogSingleSignOnProperties, self).__init__(**kwargs) + self.provisioning_state = provisioning_state self.single_sign_on_state = single_sign_on_state self.enterprise_app_id = enterprise_app_id - self.single_sign_on_url = single_sign_on_url + self.single_sign_on_url = None class DatadogSingleSignOnResource(msrest.serialization.Model): @@ -991,6 +1017,9 @@ def __init__( class MonitoringTagRulesProperties(msrest.serialization.Model): """Definition of the properties for a TagRules resource. + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState :param log_rules: Set of rules for sending logs for the Monitor resource. :type log_rules: ~microsoft_datadog_client.models.LogRules :param metric_rules: Set of rules for sending metrics for the Monitor resource. @@ -998,6 +1027,7 @@ class MonitoringTagRulesProperties(msrest.serialization.Model): """ _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'log_rules': {'key': 'logRules', 'type': 'LogRules'}, 'metric_rules': {'key': 'metricRules', 'type': 'MetricRules'}, } @@ -1005,11 +1035,13 @@ class MonitoringTagRulesProperties(msrest.serialization.Model): def __init__( self, *, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, log_rules: Optional["LogRules"] = None, metric_rules: Optional["MetricRules"] = None, **kwargs ): super(MonitoringTagRulesProperties, self).__init__(**kwargs) + self.provisioning_state = provisioning_state self.log_rules = log_rules self.metric_rules = metric_rules @@ -1023,12 +1055,12 @@ class MonitorProperties(msrest.serialization.Model): "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". + Possible values include: "Enabled", "Disabled". Default value: "Enabled". :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :param marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of + :ivar marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state. Possible - values include: "Active", "Suspended". - :type marketplace_subscription_status: str or + values include: "Provisioning", "Active", "Suspended", "Unsubscribed". + :vartype marketplace_subscription_status: str or ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus :param datadog_organization_properties: Datadog organization properties. :type datadog_organization_properties: @@ -1043,6 +1075,7 @@ class MonitorProperties(msrest.serialization.Model): """ _validation = { + 'marketplace_subscription_status': {'readonly': True}, 'liftr_resource_category': {'readonly': True}, 'liftr_resource_preference': {'readonly': True}, } @@ -1061,8 +1094,7 @@ def __init__( self, *, provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, - monitoring_status: Optional[Union[str, "MonitoringStatus"]] = None, - marketplace_subscription_status: Optional[Union[str, "MarketplaceSubscriptionStatus"]] = None, + monitoring_status: Optional[Union[str, "MonitoringStatus"]] = "Enabled", datadog_organization_properties: Optional["DatadogOrganizationProperties"] = None, user_info: Optional["UserInfo"] = None, **kwargs @@ -1070,7 +1102,7 @@ def __init__( super(MonitorProperties, self).__init__(**kwargs) self.provisioning_state = provisioning_state self.monitoring_status = monitoring_status - self.marketplace_subscription_status = marketplace_subscription_status + self.marketplace_subscription_status = None self.datadog_organization_properties = datadog_organization_properties self.user_info = user_info self.liftr_resource_category = None @@ -1081,7 +1113,7 @@ class MonitorUpdateProperties(msrest.serialization.Model): """The set of properties that can be update in a PATCH request to a monitor resource. :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". + Possible values include: "Enabled", "Disabled". Default value: "Enabled". :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus """ @@ -1092,7 +1124,7 @@ class MonitorUpdateProperties(msrest.serialization.Model): def __init__( self, *, - monitoring_status: Optional[Union[str, "MonitoringStatus"]] = None, + monitoring_status: Optional[Union[str, "MonitoringStatus"]] = "Enabled", **kwargs ): super(MonitorUpdateProperties, self).__init__(**kwargs) 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 0ba3af657d61..b2edc8eaf2df 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 @@ -7,25 +7,15 @@ # -------------------------------------------------------------------------- from ._marketplace_agreements_operations import MarketplaceAgreementsOperations -from ._api_keys_operations import ApiKeysOperations -from ._hosts_operations import HostsOperations -from ._linked_resources_operations import LinkedResourcesOperations -from ._monitored_resources_operations import MonitoredResourcesOperations -from ._operations import Operations from ._monitors_operations import MonitorsOperations -from ._refresh_set_password_operations import RefreshSetPasswordOperations +from ._operations import Operations from ._tag_rules_operations import TagRulesOperations from ._single_sign_on_configurations_operations import SingleSignOnConfigurationsOperations __all__ = [ 'MarketplaceAgreementsOperations', - 'ApiKeysOperations', - 'HostsOperations', - 'LinkedResourcesOperations', - 'MonitoredResourcesOperations', - 'Operations', 'MonitorsOperations', - 'RefreshSetPasswordOperations', + 'Operations', 'TagRulesOperations', 'SingleSignOnConfigurationsOperations', ] 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 index 24c66f1a6c82..797ef0f74754 100644 --- 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 @@ -64,6 +64,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -80,6 +81,7 @@ def prepare_request(next_link=None): url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) else: @@ -113,7 +115,7 @@ def get_next(next_link=None): ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements'} # type: ignore - def create( + def create_or_update( self, body=None, # type: Optional["_models.DatadogAgreementResource"] **kwargs # type: Any @@ -135,11 +137,12 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create.metadata['url'] # type: ignore + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } @@ -147,6 +150,7 @@ def create( # Construct parameters query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] @@ -174,4 +178,4 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default'} # type: ignore + create_or_update.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 e89cfb6d323d..779425c6e3d9 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 @@ -47,6 +47,456 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + def list_api_keys( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DatadogApiKeyListResponse"] + """List the api keys for a given monitor resource. + + List the api keys for a given monitor resource. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogApiKeyListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogApiKeyListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + 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_api_keys.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(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('DatadogApiKeyListResponse', 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_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys'} # type: ignore + + def get_default_key( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DatadogApiKey" + """Get the default api key. + + Get the default api key. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogApiKey, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogApiKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogApiKey"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_default_key.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + 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('DatadogApiKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey'} # type: ignore + + def set_default_key( + self, + resource_group_name, # type: str + monitor_name, # type: str + body=None, # type: Optional["_models.DatadogApiKey"] + **kwargs # type: Any + ): + # type: (...) -> None + """Set the default api key. + + Set the default api key. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_datadog_client.models.DatadogApiKey + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.set_default_key.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'DatadogApiKey') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(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) + + if cls: + return cls(pipeline_response, None, {}) + + set_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey'} # type: ignore + + def list_hosts( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DatadogHostListResponse"] + """List the hosts for a given monitor resource. + + List the hosts for a given monitor resource. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogHostListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogHostListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + 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_hosts.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(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('DatadogHostListResponse', 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_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts'} # type: ignore + + def list_linked_resources( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.LinkedResourceListResponse"] + """List all Azure resources associated to the same Datadog organization as the target resource. + + List all Azure resources associated to the same Datadog organization as the target resource. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LinkedResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + 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_linked_resources.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(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('LinkedResourceListResponse', 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_linked_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources'} # type: ignore + + def list_monitored_resources( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.MonitoredResourceListResponse"] + """List the resources currently being monitored by the Datadog monitor resource. + + List the resources currently being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoredResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.MonitoredResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoredResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + 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_monitored_resources.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(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('MonitoredResourceListResponse', 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_monitored_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources'} # type: ignore + def list( self, **kwargs # type: Any @@ -579,3 +1029,66 @@ def get_long_running_output(pipeline_response): else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + def refresh_set_password_link( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DatadogSetPasswordLink" + """Refresh the set password link and return a latest one. + + Refresh the set password link and return a latest one. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogSetPasswordLink, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogSetPasswordLink + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogSetPasswordLink"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.refresh_set_password_link.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + 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('DatadogSetPasswordLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + refresh_set_password_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink'} # type: ignore