Skip to content

Commit

Permalink
CodeGen from PR 15718 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[Hub Generated] Review request for Microsoft.TimeSeriesInsights to add version preview/2021-03-31-preview (Azure#15718)

* Adds base for updating Microsoft.TimeSeriesInsights from version stable/2020-05-15 to version 2021-03-31-preview

* Updates readme

* Updates API version in new specs and examples

* Add private links resources

* Add examples

* Rename example

* Remove unused example

* fix lintdiff errors

* Fix more linting errors

* Use common privatelinks definitions

* Use common resource type definition

* Add suppression for R4009 lintdiff errors
  • Loading branch information
SDKAuto committed Sep 24, 2021
1 parent cc7e454 commit d895c49
Show file tree
Hide file tree
Showing 28 changed files with 2,548 additions and 281 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include _meta.json
recursive-include tests *.py *.yaml
include *.md
include azure/__init__.py
Expand Down
11 changes: 11 additions & 0 deletions sdk/timeseriesinsights/azure-mgmt-timeseriesinsights/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"autorest": "3.4.5",
"use": [
"@autorest/[email protected]",
"@autorest/[email protected]"
],
"commit": "e5b604e04e917bc2b0c9673449491b89edb09211",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/timeseriesinsights/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.4.5",
"readme": "specification/timeseriesinsights/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2020-05-15"
self.api_version = "2021-03-31-preview"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-timeseriesinsights/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"chosen_version": "2021-03-31-preview",
"total_api_version_list": ["2021-03-31-preview"],
"client": {
"name": "TimeSeriesInsightsClient",
"filename": "_time_series_insights_client",
"description": "Time Series Insights client.",
"base_url": "\u0027https://management.azure.com\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": true,
"client_side_validation": false,
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"TimeSeriesInsightsClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}",
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"TimeSeriesInsightsClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}"
},
"global_parameters": {
"sync": {
"credential": {
"signature": "credential, # type: \"TokenCredential\"",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials.TokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id, # type: str",
"description": "Azure Subscription ID.",
"docstring_type": "str",
"required": true
}
},
"async": {
"credential": {
"signature": "credential: \"AsyncTokenCredential\",",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id: str,",
"description": "Azure Subscription ID.",
"docstring_type": "str",
"required": true
}
},
"constant": {
},
"call": "credential, subscription_id",
"service_client_specific": {
"sync": {
"api_version": {
"signature": "api_version=None, # type: Optional[str]",
"description": "API version to use if no profile is provided, or if missing in profile.",
"docstring_type": "str",
"required": false
},
"base_url": {
"signature": "base_url=None, # type: Optional[str]",
"description": "Service URL",
"docstring_type": "str",
"required": false
},
"profile": {
"signature": "profile=KnownProfiles.default, # type: KnownProfiles",
"description": "A profile definition, from KnownProfiles to dict.",
"docstring_type": "azure.profiles.KnownProfiles",
"required": false
}
},
"async": {
"api_version": {
"signature": "api_version: Optional[str] = None,",
"description": "API version to use if no profile is provided, or if missing in profile.",
"docstring_type": "str",
"required": false
},
"base_url": {
"signature": "base_url: Optional[str] = None,",
"description": "Service URL",
"docstring_type": "str",
"required": false
},
"profile": {
"signature": "profile: KnownProfiles = KnownProfiles.default,",
"description": "A profile definition, from KnownProfiles to dict.",
"docstring_type": "azure.profiles.KnownProfiles",
"required": false
}
}
}
},
"config": {
"credential": true,
"credential_scopes": ["https://management.azure.com/.default"],
"credential_default_policy_type": "BearerTokenCredentialPolicy",
"credential_default_policy_type_has_async_version": true,
"credential_key_header_name": null,
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"operations": "Operations",
"environments": "EnvironmentsOperations",
"event_sources": "EventSourcesOperations",
"reference_data_sets": "ReferenceDataSetsOperations",
"access_policies": "AccessPoliciesOperations",
"private_endpoint_connections": "PrivateEndpointConnectionsOperations",
"private_link_resources": "PrivateLinkResourcesOperations"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
from typing import Any, Optional

from azure.core.credentials import TokenCredential
from azure.core.pipeline.transport import HttpRequest, HttpResponse

from ._configuration import TimeSeriesInsightsClientConfiguration
from .operations import Operations
from .operations import EnvironmentsOperations
from .operations import EventSourcesOperations
from .operations import ReferenceDataSetsOperations
from .operations import AccessPoliciesOperations
from .operations import PrivateEndpointConnectionsOperations
from .operations import PrivateLinkResourcesOperations
from . import models


Expand All @@ -39,6 +42,10 @@ class TimeSeriesInsightsClient(object):
:vartype reference_data_sets: azure.mgmt.timeseriesinsights.operations.ReferenceDataSetsOperations
:ivar access_policies: AccessPoliciesOperations operations
:vartype access_policies: azure.mgmt.timeseriesinsights.operations.AccessPoliciesOperations
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
:vartype private_endpoint_connections: azure.mgmt.timeseriesinsights.operations.PrivateEndpointConnectionsOperations
:ivar private_link_resources: PrivateLinkResourcesOperations operations
:vartype private_link_resources: azure.mgmt.timeseriesinsights.operations.PrivateLinkResourcesOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Azure Subscription ID.
Expand Down Expand Up @@ -75,6 +82,28 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize)
self.access_policies = AccessPoliciesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.private_link_resources = PrivateLinkResourcesOperations(
self._client, self._config, self._serialize, self._deserialize)

def _send_request(self, http_request, **kwargs):
# type: (HttpRequest, Any) -> HttpResponse
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse
"""
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

def close(self):
# type: () -> None
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.0"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2020-05-15"
self.api_version = "2021-03-31-preview"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-timeseriesinsights/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from typing import Any, Optional, TYPE_CHECKING

from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer

Expand All @@ -21,6 +22,8 @@
from .operations import EventSourcesOperations
from .operations import ReferenceDataSetsOperations
from .operations import AccessPoliciesOperations
from .operations import PrivateEndpointConnectionsOperations
from .operations import PrivateLinkResourcesOperations
from .. import models


Expand All @@ -37,6 +40,10 @@ class TimeSeriesInsightsClient(object):
:vartype reference_data_sets: azure.mgmt.timeseriesinsights.aio.operations.ReferenceDataSetsOperations
:ivar access_policies: AccessPoliciesOperations operations
:vartype access_policies: azure.mgmt.timeseriesinsights.aio.operations.AccessPoliciesOperations
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
:vartype private_endpoint_connections: azure.mgmt.timeseriesinsights.aio.operations.PrivateEndpointConnectionsOperations
:ivar private_link_resources: PrivateLinkResourcesOperations operations
:vartype private_link_resources: azure.mgmt.timeseriesinsights.aio.operations.PrivateLinkResourcesOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Azure Subscription ID.
Expand Down Expand Up @@ -72,6 +79,27 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize)
self.access_policies = AccessPoliciesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.private_link_resources = PrivateLinkResourcesOperations(
self._client, self._config, self._serialize, self._deserialize)

async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse:
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.AsyncHttpResponse
"""
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

async def close(self) -> None:
await self._client.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
from ._event_sources_operations import EventSourcesOperations
from ._reference_data_sets_operations import ReferenceDataSetsOperations
from ._access_policies_operations import AccessPoliciesOperations
from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
from ._private_link_resources_operations import PrivateLinkResourcesOperations

__all__ = [
'Operations',
'EnvironmentsOperations',
'EventSourcesOperations',
'ReferenceDataSetsOperations',
'AccessPoliciesOperations',
'PrivateEndpointConnectionsOperations',
'PrivateLinkResourcesOperations',
]
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async def create_or_update(
environment_name: str,
access_policy_name: str,
parameters: "_models.AccessPolicyCreateOrUpdateParameters",
**kwargs
**kwargs: Any
) -> "_models.AccessPolicyResource":
"""Create or update an access policy in the specified environment.
Expand All @@ -69,7 +69,7 @@ async def create_or_update(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-05-15"
api_version = "2021-03-31-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down Expand Up @@ -120,7 +120,7 @@ async def get(
resource_group_name: str,
environment_name: str,
access_policy_name: str,
**kwargs
**kwargs: Any
) -> "_models.AccessPolicyResource":
"""Gets the access policy with the specified name in the specified environment.
Expand All @@ -142,7 +142,7 @@ async def get(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-05-15"
api_version = "2021-03-31-preview"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -185,7 +185,7 @@ async def update(
environment_name: str,
access_policy_name: str,
access_policy_update_parameters: "_models.AccessPolicyUpdateParameters",
**kwargs
**kwargs: Any
) -> "_models.AccessPolicyResource":
"""Updates the access policy with the specified name in the specified subscription, resource
group, and environment.
Expand All @@ -211,7 +211,7 @@ async def update(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-05-15"
api_version = "2021-03-31-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down Expand Up @@ -258,7 +258,7 @@ async def delete(
resource_group_name: str,
environment_name: str,
access_policy_name: str,
**kwargs
**kwargs: Any
) -> None:
"""Deletes the access policy with the specified name in the specified subscription, resource
group, and environment.
Expand All @@ -281,7 +281,7 @@ async def delete(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-05-15"
api_version = "2021-03-31-preview"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -319,7 +319,7 @@ async def list_by_environment(
self,
resource_group_name: str,
environment_name: str,
**kwargs
**kwargs: Any
) -> "_models.AccessPolicyListResponse":
"""Lists all the available access policies associated with the environment.
Expand All @@ -338,7 +338,7 @@ async def list_by_environment(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-05-15"
api_version = "2021-03-31-preview"
accept = "application/json"

# Construct URL
Expand Down
Loading

0 comments on commit d895c49

Please sign in to comment.