Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ReleasePR track2_azure-mgmt-datadog] Update Swagger to allow Asynchronous Patch Action and add SKU in the Patch properties #15300

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -51,6 +52,7 @@
"credential_key_header_name": null
},
"operation_groups": {
"marketplace_agreements": "MarketplaceAgreementsOperations",
"api_keys": "ApiKeysOperations",
"hosts": "HostsOperations",
"linked_resources": "LinkedResourcesOperations",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -17,6 +18,7 @@
from ._single_sign_on_configurations_operations import SingleSignOnConfigurationsOperations

__all__ = [
'MarketplaceAgreementsOperations',
'ApiKeysOperations',
'HostsOperations',
'LinkedResourcesOperations',
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Loading