Skip to content

Commit fcb3824

Browse files
author
SDKAuto
committed
CodeGen from PR 22955 in Azure/azure-rest-api-specs
Merge 0d6a5ffe0d18038dc186fc3421dce803dd548b95 into d82babc9bd0fa25260d04e52d841c2a6f59792c8
1 parent 3e6b1b7 commit fcb3824

File tree

120 files changed

+16727
-2141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+16727
-2141
lines changed

sdk/rdbms/azure-mgmt-rdbms/_meta.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "8739a0a2ac54b0d8f8c98da22ee6b446c53b09a7",
2+
"commit": "4842c1c559d410abaa33bb83de502aa126fecdd2",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"autorest": "3.9.2",
55
"use": [
6-
"@autorest/python@6.2.7",
6+
"@autorest/python@6.4.3",
77
"@autorest/[email protected]"
88
],
9-
"autorest_command": "autorest specification/postgresql/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
10-
"readme": "specification/postgresql/resource-manager/readme.md"
9+
"autorest_command": "autorest specification/postgresqlhsc/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.4.3 --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
10+
"readme": "specification/postgresqlhsc/resource-manager/readme.md"
1111
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from ._cosmos_db_for_postgre_sql import CosmosDBForPostgreSQL
10+
from ._version import VERSION
11+
12+
__version__ = VERSION
13+
14+
try:
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # pylint: disable=unused-wildcard-import
17+
except ImportError:
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
20+
21+
__all__ = [
22+
"CosmosDBForPostgreSQL",
23+
]
24+
__all__.extend([p for p in _patch_all if p not in __all__])
25+
26+
_patch_sdk()
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
import sys
10+
from typing import Any, TYPE_CHECKING
11+
12+
from azure.core.configuration import Configuration
13+
from azure.core.pipeline import policies
14+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
15+
16+
from ._version import VERSION
17+
18+
if sys.version_info >= (3, 8):
19+
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
20+
else:
21+
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
22+
23+
if TYPE_CHECKING:
24+
# pylint: disable=unused-import,ungrouped-imports
25+
from azure.core.credentials import TokenCredential
26+
27+
28+
class CosmosDBForPostgreSQLConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
29+
"""Configuration for CosmosDBForPostgreSQL.
30+
31+
Note that all parameters used to create this instance are saved as instance
32+
attributes.
33+
34+
:param credential: Credential needed for the client to connect to Azure. Required.
35+
:type credential: ~azure.core.credentials.TokenCredential
36+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
37+
:type subscription_id: str
38+
:keyword api_version: Api Version. Default value is "2022-11-08". Note that overriding this
39+
default value may result in unsupported behavior.
40+
:paramtype api_version: str
41+
"""
42+
43+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
44+
super(CosmosDBForPostgreSQLConfiguration, self).__init__(**kwargs)
45+
api_version: Literal["2022-11-08"] = kwargs.pop("api_version", "2022-11-08")
46+
47+
if credential is None:
48+
raise ValueError("Parameter 'credential' must not be None.")
49+
if subscription_id is None:
50+
raise ValueError("Parameter 'subscription_id' must not be None.")
51+
52+
self.credential = credential
53+
self.subscription_id = subscription_id
54+
self.api_version = api_version
55+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
56+
kwargs.setdefault("sdk_moniker", "mgmt-rdbms/{}".format(VERSION))
57+
self._configure(**kwargs)
58+
59+
def _configure(self, **kwargs: Any) -> None:
60+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
61+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
62+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
63+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
64+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
65+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
66+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
67+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
68+
self.authentication_policy = kwargs.get("authentication_policy")
69+
if self.credential and not self.authentication_policy:
70+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
71+
self.credential, *self.credential_scopes, **kwargs
72+
)
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from copy import deepcopy
10+
from typing import Any, TYPE_CHECKING
11+
12+
from azure.core.rest import HttpRequest, HttpResponse
13+
from azure.mgmt.core import ARMPipelineClient
14+
15+
from . import models as _models
16+
from ._configuration import CosmosDBForPostgreSQLConfiguration
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import (
19+
ClustersOperations,
20+
ConfigurationsOperations,
21+
FirewallRulesOperations,
22+
Operations,
23+
PrivateEndpointConnectionsOperations,
24+
PrivateLinkResourcesOperations,
25+
RolesOperations,
26+
ServersOperations,
27+
)
28+
29+
if TYPE_CHECKING:
30+
# pylint: disable=unused-import,ungrouped-imports
31+
from azure.core.credentials import TokenCredential
32+
33+
34+
class CosmosDBForPostgreSQL: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
35+
"""Azure Cosmos DB for PostgreSQL database service resource provider REST APIs.
36+
37+
:ivar clusters: ClustersOperations operations
38+
:vartype clusters: azure.mgmt.rdbms.postgresqlhsc.operations.ClustersOperations
39+
:ivar servers: ServersOperations operations
40+
:vartype servers: azure.mgmt.rdbms.postgresqlhsc.operations.ServersOperations
41+
:ivar configurations: ConfigurationsOperations operations
42+
:vartype configurations: azure.mgmt.rdbms.postgresqlhsc.operations.ConfigurationsOperations
43+
:ivar firewall_rules: FirewallRulesOperations operations
44+
:vartype firewall_rules: azure.mgmt.rdbms.postgresqlhsc.operations.FirewallRulesOperations
45+
:ivar roles: RolesOperations operations
46+
:vartype roles: azure.mgmt.rdbms.postgresqlhsc.operations.RolesOperations
47+
:ivar operations: Operations operations
48+
:vartype operations: azure.mgmt.rdbms.postgresqlhsc.operations.Operations
49+
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
50+
:vartype private_endpoint_connections:
51+
azure.mgmt.rdbms.postgresqlhsc.operations.PrivateEndpointConnectionsOperations
52+
:ivar private_link_resources: PrivateLinkResourcesOperations operations
53+
:vartype private_link_resources:
54+
azure.mgmt.rdbms.postgresqlhsc.operations.PrivateLinkResourcesOperations
55+
:param credential: Credential needed for the client to connect to Azure. Required.
56+
:type credential: ~azure.core.credentials.TokenCredential
57+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
58+
:type subscription_id: str
59+
:param base_url: Service URL. Default value is "https://management.azure.com".
60+
:type base_url: str
61+
:keyword api_version: Api Version. Default value is "2022-11-08". Note that overriding this
62+
default value may result in unsupported behavior.
63+
:paramtype api_version: str
64+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
65+
Retry-After header is present.
66+
"""
67+
68+
def __init__(
69+
self,
70+
credential: "TokenCredential",
71+
subscription_id: str,
72+
base_url: str = "https://management.azure.com",
73+
**kwargs: Any
74+
) -> None:
75+
self._config = CosmosDBForPostgreSQLConfiguration(
76+
credential=credential, subscription_id=subscription_id, **kwargs
77+
)
78+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
79+
80+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
81+
self._serialize = Serializer(client_models)
82+
self._deserialize = Deserializer(client_models)
83+
self._serialize.client_side_validation = False
84+
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
85+
self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize)
86+
self.configurations = ConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize)
87+
self.firewall_rules = FirewallRulesOperations(self._client, self._config, self._serialize, self._deserialize)
88+
self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize)
89+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
90+
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
91+
self._client, self._config, self._serialize, self._deserialize
92+
)
93+
self.private_link_resources = PrivateLinkResourcesOperations(
94+
self._client, self._config, self._serialize, self._deserialize
95+
)
96+
97+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
98+
"""Runs the network request through the client's chained policies.
99+
100+
>>> from azure.core.rest import HttpRequest
101+
>>> request = HttpRequest("GET", "https://www.example.org/")
102+
<HttpRequest [GET], url: 'https://www.example.org/'>
103+
>>> response = client._send_request(request)
104+
<HttpResponse: 200 OK>
105+
106+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
107+
108+
:param request: The network request you want to make. Required.
109+
:type request: ~azure.core.rest.HttpRequest
110+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
111+
:return: The response of your network call. Does not do error handling on your response.
112+
:rtype: ~azure.core.rest.HttpResponse
113+
"""
114+
115+
request_copy = deepcopy(request)
116+
request_copy.url = self._client.format_url(request_copy.url)
117+
return self._client.send_request(request_copy, **kwargs)
118+
119+
def close(self) -> None:
120+
self._client.close()
121+
122+
def __enter__(self) -> "CosmosDBForPostgreSQL":
123+
self._client.__enter__()
124+
return self
125+
126+
def __exit__(self, *exc_details: Any) -> None:
127+
self._client.__exit__(*exc_details)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ------------------------------------
2+
# Copyright (c) Microsoft Corporation.
3+
# Licensed under the MIT License.
4+
# ------------------------------------
5+
"""Customize generated code here.
6+
7+
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
8+
"""
9+
from typing import List
10+
11+
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
12+
13+
14+
def patch_sdk():
15+
"""Do not remove from this file.
16+
17+
`patch_sdk` is a last resort escape hatch that allows you to do customizations
18+
you can't accomplish using the techniques described in
19+
https://aka.ms/azsdk/python/dpcodegen/python/customize
20+
"""

0 commit comments

Comments
 (0)