Skip to content

Commit a7a7857

Browse files
author
SDKAuto
committed
CodeGen from PR 23876 in Azure/azure-rest-api-specs
Merge 4c3395b0b92868a360818957cf332cbe39776fb9 into c7daa3d35baaaabece0dbc6f731eadbe426973b9
1 parent 12142fd commit a7a7857

File tree

141 files changed

+16411
-3015
lines changed

Some content is hidden

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

141 files changed

+16411
-3015
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "87589a8b18e6dc791e0b49fadc74c5a513c5dd73",
2+
"commit": "e71b65b143202f3789ac021151104c8f0fb50d87",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"autorest": "3.9.2",
55
"use": [
6-
"@autorest/python@6.4.8",
6+
"@autorest/python@6.4.12",
77
"@autorest/modelerfour@4.24.3"
88
],
9-
"autorest_command": "autorest specification/mysql/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.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
10-
"readme": "specification/mysql/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.12 --use=@autorest/modelerfour@4.24.3 --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: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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 typing import Any, TYPE_CHECKING
10+
11+
from azure.core.configuration import Configuration
12+
from azure.core.pipeline import policies
13+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
14+
15+
from ._version import VERSION
16+
17+
if TYPE_CHECKING:
18+
# pylint: disable=unused-import,ungrouped-imports
19+
from azure.core.credentials import TokenCredential
20+
21+
22+
class CosmosDBForPostgreSQLConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
23+
"""Configuration for CosmosDBForPostgreSQL.
24+
25+
Note that all parameters used to create this instance are saved as instance
26+
attributes.
27+
28+
:param credential: Credential needed for the client to connect to Azure. Required.
29+
:type credential: ~azure.core.credentials.TokenCredential
30+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
31+
:type subscription_id: str
32+
:keyword api_version: Api Version. Default value is "2022-11-08". Note that overriding this
33+
default value may result in unsupported behavior.
34+
:paramtype api_version: str
35+
"""
36+
37+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
38+
super(CosmosDBForPostgreSQLConfiguration, self).__init__(**kwargs)
39+
api_version: str = kwargs.pop("api_version", "2022-11-08")
40+
41+
if credential is None:
42+
raise ValueError("Parameter 'credential' must not be None.")
43+
if subscription_id is None:
44+
raise ValueError("Parameter 'subscription_id' must not be None.")
45+
46+
self.credential = credential
47+
self.subscription_id = subscription_id
48+
self.api_version = api_version
49+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
50+
kwargs.setdefault("sdk_moniker", "mgmt-rdbms/{}".format(VERSION))
51+
self._configure(**kwargs)
52+
53+
def _configure(self, **kwargs: Any) -> None:
54+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
55+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
56+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
57+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
58+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
59+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
60+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
61+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
62+
self.authentication_policy = kwargs.get("authentication_policy")
63+
if self.credential and not self.authentication_policy:
64+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
65+
self.credential, *self.credential_scopes, **kwargs
66+
)
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)