openmeter 1.0.0a2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openmeter/__init__.py +28 -0
- openmeter/_client.py +31 -0
- openmeter/_commit.py +1 -0
- openmeter/_generated/__init__.py +26 -0
- openmeter/_generated/_client.py +254 -0
- openmeter/_generated/_configuration.py +33 -0
- openmeter/_generated/_patch.py +18 -0
- openmeter/_generated/_utils/__init__.py +0 -0
- openmeter/_generated/_utils/model_base.py +1231 -0
- openmeter/_generated/_utils/serialization.py +2024 -0
- openmeter/_generated/_version.py +3 -0
- openmeter/_generated/aio/__init__.py +23 -0
- openmeter/_generated/aio/_client.py +256 -0
- openmeter/_generated/aio/_configuration.py +33 -0
- openmeter/_generated/aio/_patch.py +18 -0
- openmeter/_generated/aio/operations/__init__.py +93 -0
- openmeter/_generated/aio/operations/_operations.py +19903 -0
- openmeter/_generated/aio/operations/_patch.py +18 -0
- openmeter/_generated/models/__init__.py +742 -0
- openmeter/_generated/models/_enums.py +714 -0
- openmeter/_generated/models/_models.py +15400 -0
- openmeter/_generated/models/_patch.py +18 -0
- openmeter/_generated/operations/__init__.py +93 -0
- openmeter/_generated/operations/_operations.py +24038 -0
- openmeter/_generated/operations/_patch.py +18 -0
- openmeter/_types.py +88 -0
- openmeter/_version.py +1 -0
- openmeter/aio/__init__.py +23 -0
- openmeter/aio/_client.py +31 -0
- openmeter/aio/operations/__init__.py +29 -0
- openmeter/models/__init__.py +30 -0
- openmeter/operations/__init__.py +29 -0
- openmeter/py.typed +1 -0
- openmeter-1.0.0a2.dist-info/METADATA +354 -0
- openmeter-1.0.0a2.dist-info/RECORD +36 -0
- openmeter-1.0.0a2.dist-info/WHEEL +4 -0
openmeter/__init__.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# pylint: disable=wrong-import-position
|
|
3
|
+
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
from ._generated._patch import * # pylint: disable=unused-wildcard-import
|
|
8
|
+
|
|
9
|
+
from ._client import Client # type: ignore
|
|
10
|
+
from ._version import VERSION
|
|
11
|
+
from ._commit import COMMIT
|
|
12
|
+
|
|
13
|
+
__version__ = VERSION
|
|
14
|
+
__commit__ = COMMIT
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
from ._generated._patch import __all__ as _patch_all
|
|
18
|
+
from ._generated._patch import *
|
|
19
|
+
except ImportError:
|
|
20
|
+
_patch_all = []
|
|
21
|
+
from ._generated._patch import patch_sdk as _patch_sdk
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"Client",
|
|
25
|
+
]
|
|
26
|
+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
|
|
27
|
+
|
|
28
|
+
_patch_sdk()
|
openmeter/_client.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
|
|
3
|
+
from typing import Any, Optional
|
|
4
|
+
from typing_extensions import Self
|
|
5
|
+
|
|
6
|
+
from corehttp.credentials import ServiceKeyCredential
|
|
7
|
+
from corehttp.runtime import policies
|
|
8
|
+
|
|
9
|
+
from ._generated._client import OpenMeterClient
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Client(OpenMeterClient):
|
|
13
|
+
def __init__(
|
|
14
|
+
self,
|
|
15
|
+
endpoint: str = "https://openmeter.cloud",
|
|
16
|
+
token: Optional[str] = None,
|
|
17
|
+
**kwargs: Any,
|
|
18
|
+
) -> None:
|
|
19
|
+
if token and not kwargs.get("authentication_policy"):
|
|
20
|
+
credential = ServiceKeyCredential(token)
|
|
21
|
+
kwargs["authentication_policy"] = policies.ServiceKeyCredentialPolicy(
|
|
22
|
+
credential, "Authorization", prefix="Bearer"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
super().__init__(endpoint=endpoint, **kwargs)
|
|
26
|
+
|
|
27
|
+
def __enter__(self) -> Self:
|
|
28
|
+
return super().__enter__()
|
|
29
|
+
|
|
30
|
+
def __exit__(self, *exc_details: Any) -> None:
|
|
31
|
+
return super().__exit__(*exc_details)
|
openmeter/_commit.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
COMMIT = "6655c2b0b14a"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# pylint: disable=wrong-import-position
|
|
3
|
+
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
from ._patch import * # pylint: disable=unused-wildcard-import
|
|
8
|
+
|
|
9
|
+
from ._client import OpenMeterClient # type: ignore
|
|
10
|
+
from ._version import VERSION
|
|
11
|
+
|
|
12
|
+
__version__ = VERSION
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
from ._patch import __all__ as _patch_all
|
|
16
|
+
from ._patch import *
|
|
17
|
+
except ImportError:
|
|
18
|
+
_patch_all = []
|
|
19
|
+
from ._patch import patch_sdk as _patch_sdk
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
"OpenMeterClient",
|
|
23
|
+
]
|
|
24
|
+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
|
|
25
|
+
|
|
26
|
+
_patch_sdk()
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
|
|
3
|
+
from copy import deepcopy
|
|
4
|
+
from typing import Any
|
|
5
|
+
from typing_extensions import Self
|
|
6
|
+
|
|
7
|
+
from corehttp.rest import HttpRequest, HttpResponse
|
|
8
|
+
from corehttp.runtime import PipelineClient, policies
|
|
9
|
+
|
|
10
|
+
from ._configuration import OpenMeterClientConfiguration
|
|
11
|
+
from ._utils.serialization import Deserializer, Serializer
|
|
12
|
+
from .operations import (
|
|
13
|
+
AddonsOperations,
|
|
14
|
+
AppCustomInvoicingOperations,
|
|
15
|
+
AppStripeOperations,
|
|
16
|
+
AppsOperations,
|
|
17
|
+
BillingProfilesOperations,
|
|
18
|
+
CurrenciesOperations,
|
|
19
|
+
CustomerAppsOperations,
|
|
20
|
+
CustomerEntitlementOperations,
|
|
21
|
+
CustomerEntitlementV2Operations,
|
|
22
|
+
CustomerEntitlementsV2Operations,
|
|
23
|
+
CustomerInvoiceOperations,
|
|
24
|
+
CustomerOperations,
|
|
25
|
+
CustomerOverridesOperations,
|
|
26
|
+
CustomerStripeOperations,
|
|
27
|
+
CustomersOperations,
|
|
28
|
+
DebugOperations,
|
|
29
|
+
EntitlementsOperations,
|
|
30
|
+
EntitlementsV2Operations,
|
|
31
|
+
EventsOperations,
|
|
32
|
+
EventsV2Operations,
|
|
33
|
+
FeaturesOperations,
|
|
34
|
+
GrantsOperations,
|
|
35
|
+
GrantsV2Operations,
|
|
36
|
+
InvoiceOperations,
|
|
37
|
+
InvoicesOperations,
|
|
38
|
+
MarketplaceOperations,
|
|
39
|
+
MetersOperations,
|
|
40
|
+
NotificationChannelsOperations,
|
|
41
|
+
NotificationEventsOperations,
|
|
42
|
+
NotificationRulesOperations,
|
|
43
|
+
PlanAddonsOperations,
|
|
44
|
+
PlansOperations,
|
|
45
|
+
PortalOperations,
|
|
46
|
+
ProgressOperations,
|
|
47
|
+
SubjectsOperations,
|
|
48
|
+
SubscriptionAddonsOperations,
|
|
49
|
+
SubscriptionsOperations,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class OpenMeterClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
|
|
54
|
+
"""OpenMeter is a cloud native usage metering service.
|
|
55
|
+
The OpenMeter API allows you to ingest events, query meter usage, and manage resources.
|
|
56
|
+
|
|
57
|
+
:ivar portal: PortalOperations operations
|
|
58
|
+
:vartype portal: openmeter.operations.PortalOperations
|
|
59
|
+
:ivar apps: AppsOperations operations
|
|
60
|
+
:vartype apps: openmeter.operations.AppsOperations
|
|
61
|
+
:ivar app_stripe: AppStripeOperations operations
|
|
62
|
+
:vartype app_stripe: openmeter.operations.AppStripeOperations
|
|
63
|
+
:ivar customer_apps: CustomerAppsOperations operations
|
|
64
|
+
:vartype customer_apps: openmeter.operations.CustomerAppsOperations
|
|
65
|
+
:ivar customers: CustomersOperations operations
|
|
66
|
+
:vartype customers: openmeter.operations.CustomersOperations
|
|
67
|
+
:ivar features: FeaturesOperations operations
|
|
68
|
+
:vartype features: openmeter.operations.FeaturesOperations
|
|
69
|
+
:ivar plans: PlansOperations operations
|
|
70
|
+
:vartype plans: openmeter.operations.PlansOperations
|
|
71
|
+
:ivar plan_addons: PlanAddonsOperations operations
|
|
72
|
+
:vartype plan_addons: openmeter.operations.PlanAddonsOperations
|
|
73
|
+
:ivar addons: AddonsOperations operations
|
|
74
|
+
:vartype addons: openmeter.operations.AddonsOperations
|
|
75
|
+
:ivar subscriptions: SubscriptionsOperations operations
|
|
76
|
+
:vartype subscriptions: openmeter.operations.SubscriptionsOperations
|
|
77
|
+
:ivar subscription_addons: SubscriptionAddonsOperations operations
|
|
78
|
+
:vartype subscription_addons: openmeter.operations.SubscriptionAddonsOperations
|
|
79
|
+
:ivar entitlements: EntitlementsOperations operations
|
|
80
|
+
:vartype entitlements: openmeter.operations.EntitlementsOperations
|
|
81
|
+
:ivar grants: GrantsOperations operations
|
|
82
|
+
:vartype grants: openmeter.operations.GrantsOperations
|
|
83
|
+
:ivar subjects: SubjectsOperations operations
|
|
84
|
+
:vartype subjects: openmeter.operations.SubjectsOperations
|
|
85
|
+
:ivar customer: CustomerOperations operations
|
|
86
|
+
:vartype customer: openmeter.operations.CustomerOperations
|
|
87
|
+
:ivar customer_entitlement: CustomerEntitlementOperations operations
|
|
88
|
+
:vartype customer_entitlement: openmeter.operations.CustomerEntitlementOperations
|
|
89
|
+
:ivar customer_stripe: CustomerStripeOperations operations
|
|
90
|
+
:vartype customer_stripe: openmeter.operations.CustomerStripeOperations
|
|
91
|
+
:ivar marketplace: MarketplaceOperations operations
|
|
92
|
+
:vartype marketplace: openmeter.operations.MarketplaceOperations
|
|
93
|
+
:ivar app_custom_invoicing: AppCustomInvoicingOperations operations
|
|
94
|
+
:vartype app_custom_invoicing: openmeter.operations.AppCustomInvoicingOperations
|
|
95
|
+
:ivar events: EventsOperations operations
|
|
96
|
+
:vartype events: openmeter.operations.EventsOperations
|
|
97
|
+
:ivar events_v2: EventsV2Operations operations
|
|
98
|
+
:vartype events_v2: openmeter.operations.EventsV2Operations
|
|
99
|
+
:ivar meters: MetersOperations operations
|
|
100
|
+
:vartype meters: openmeter.operations.MetersOperations
|
|
101
|
+
:ivar subjects: SubjectsOperations operations
|
|
102
|
+
:vartype subjects: openmeter.operations.SubjectsOperations
|
|
103
|
+
:ivar debug: DebugOperations operations
|
|
104
|
+
:vartype debug: openmeter.operations.DebugOperations
|
|
105
|
+
:ivar notification_channels: NotificationChannelsOperations operations
|
|
106
|
+
:vartype notification_channels: openmeter.operations.NotificationChannelsOperations
|
|
107
|
+
:ivar notification_rules: NotificationRulesOperations operations
|
|
108
|
+
:vartype notification_rules: openmeter.operations.NotificationRulesOperations
|
|
109
|
+
:ivar notification_events: NotificationEventsOperations operations
|
|
110
|
+
:vartype notification_events: openmeter.operations.NotificationEventsOperations
|
|
111
|
+
:ivar entitlements_v2: EntitlementsV2Operations operations
|
|
112
|
+
:vartype entitlements_v2: openmeter.operations.EntitlementsV2Operations
|
|
113
|
+
:ivar customer_entitlements_v2: CustomerEntitlementsV2Operations operations
|
|
114
|
+
:vartype customer_entitlements_v2: openmeter.operations.CustomerEntitlementsV2Operations
|
|
115
|
+
:ivar customer_entitlement_v2: CustomerEntitlementV2Operations operations
|
|
116
|
+
:vartype customer_entitlement_v2: openmeter.operations.CustomerEntitlementV2Operations
|
|
117
|
+
:ivar grants_v2: GrantsV2Operations operations
|
|
118
|
+
:vartype grants_v2: openmeter.operations.GrantsV2Operations
|
|
119
|
+
:ivar billing_profiles: BillingProfilesOperations operations
|
|
120
|
+
:vartype billing_profiles: openmeter.operations.BillingProfilesOperations
|
|
121
|
+
:ivar customer_overrides: CustomerOverridesOperations operations
|
|
122
|
+
:vartype customer_overrides: openmeter.operations.CustomerOverridesOperations
|
|
123
|
+
:ivar invoices: InvoicesOperations operations
|
|
124
|
+
:vartype invoices: openmeter.operations.InvoicesOperations
|
|
125
|
+
:ivar invoice: InvoiceOperations operations
|
|
126
|
+
:vartype invoice: openmeter.operations.InvoiceOperations
|
|
127
|
+
:ivar customer_invoice: CustomerInvoiceOperations operations
|
|
128
|
+
:vartype customer_invoice: openmeter.operations.CustomerInvoiceOperations
|
|
129
|
+
:ivar progress: ProgressOperations operations
|
|
130
|
+
:vartype progress: openmeter.operations.ProgressOperations
|
|
131
|
+
:ivar currencies: CurrenciesOperations operations
|
|
132
|
+
:vartype currencies: openmeter.operations.CurrenciesOperations
|
|
133
|
+
:keyword endpoint: Service host. Default value is "https://127.0.0.1".
|
|
134
|
+
:paramtype endpoint: str
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
def __init__( # pylint: disable=missing-client-constructor-parameter-credential
|
|
138
|
+
self, *, endpoint: str = "https://127.0.0.1", **kwargs: Any
|
|
139
|
+
) -> None:
|
|
140
|
+
_endpoint = "{endpoint}"
|
|
141
|
+
self._config = OpenMeterClientConfiguration(endpoint=endpoint, **kwargs)
|
|
142
|
+
|
|
143
|
+
_policies = kwargs.pop("policies", None)
|
|
144
|
+
if _policies is None:
|
|
145
|
+
_policies = [
|
|
146
|
+
self._config.headers_policy,
|
|
147
|
+
self._config.user_agent_policy,
|
|
148
|
+
self._config.proxy_policy,
|
|
149
|
+
policies.ContentDecodePolicy(**kwargs),
|
|
150
|
+
self._config.retry_policy,
|
|
151
|
+
self._config.authentication_policy,
|
|
152
|
+
self._config.logging_policy,
|
|
153
|
+
]
|
|
154
|
+
self._client: PipelineClient = PipelineClient(endpoint=_endpoint, policies=_policies, **kwargs)
|
|
155
|
+
|
|
156
|
+
self._serialize = Serializer()
|
|
157
|
+
self._deserialize = Deserializer()
|
|
158
|
+
self._serialize.client_side_validation = False
|
|
159
|
+
self.portal = PortalOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
160
|
+
self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
161
|
+
self.app_stripe = AppStripeOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
162
|
+
self.customer_apps = CustomerAppsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
163
|
+
self.customers = CustomersOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
164
|
+
self.features = FeaturesOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
165
|
+
self.plans = PlansOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
166
|
+
self.plan_addons = PlanAddonsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
167
|
+
self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
168
|
+
self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
169
|
+
self.subscription_addons = SubscriptionAddonsOperations(
|
|
170
|
+
self._client, self._config, self._serialize, self._deserialize
|
|
171
|
+
)
|
|
172
|
+
self.entitlements = EntitlementsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
173
|
+
self.grants = GrantsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
174
|
+
self.subjects = SubjectsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
175
|
+
self.customer = CustomerOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
176
|
+
self.customer_entitlement = CustomerEntitlementOperations(
|
|
177
|
+
self._client, self._config, self._serialize, self._deserialize
|
|
178
|
+
)
|
|
179
|
+
self.customer_stripe = CustomerStripeOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
180
|
+
self.marketplace = MarketplaceOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
181
|
+
self.app_custom_invoicing = AppCustomInvoicingOperations(
|
|
182
|
+
self._client, self._config, self._serialize, self._deserialize
|
|
183
|
+
)
|
|
184
|
+
self.events = EventsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
185
|
+
self.events_v2 = EventsV2Operations(self._client, self._config, self._serialize, self._deserialize)
|
|
186
|
+
self.meters = MetersOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
187
|
+
self.subjects = SubjectsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
188
|
+
self.debug = DebugOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
189
|
+
self.notification_channels = NotificationChannelsOperations(
|
|
190
|
+
self._client, self._config, self._serialize, self._deserialize
|
|
191
|
+
)
|
|
192
|
+
self.notification_rules = NotificationRulesOperations(
|
|
193
|
+
self._client, self._config, self._serialize, self._deserialize
|
|
194
|
+
)
|
|
195
|
+
self.notification_events = NotificationEventsOperations(
|
|
196
|
+
self._client, self._config, self._serialize, self._deserialize
|
|
197
|
+
)
|
|
198
|
+
self.entitlements_v2 = EntitlementsV2Operations(self._client, self._config, self._serialize, self._deserialize)
|
|
199
|
+
self.customer_entitlements_v2 = CustomerEntitlementsV2Operations(
|
|
200
|
+
self._client, self._config, self._serialize, self._deserialize
|
|
201
|
+
)
|
|
202
|
+
self.customer_entitlement_v2 = CustomerEntitlementV2Operations(
|
|
203
|
+
self._client, self._config, self._serialize, self._deserialize
|
|
204
|
+
)
|
|
205
|
+
self.grants_v2 = GrantsV2Operations(self._client, self._config, self._serialize, self._deserialize)
|
|
206
|
+
self.billing_profiles = BillingProfilesOperations(
|
|
207
|
+
self._client, self._config, self._serialize, self._deserialize
|
|
208
|
+
)
|
|
209
|
+
self.customer_overrides = CustomerOverridesOperations(
|
|
210
|
+
self._client, self._config, self._serialize, self._deserialize
|
|
211
|
+
)
|
|
212
|
+
self.invoices = InvoicesOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
213
|
+
self.invoice = InvoiceOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
214
|
+
self.customer_invoice = CustomerInvoiceOperations(
|
|
215
|
+
self._client, self._config, self._serialize, self._deserialize
|
|
216
|
+
)
|
|
217
|
+
self.progress = ProgressOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
218
|
+
self.currencies = CurrenciesOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
219
|
+
|
|
220
|
+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
|
|
221
|
+
"""Runs the network request through the client's chained policies.
|
|
222
|
+
|
|
223
|
+
>>> from corehttp.rest import HttpRequest
|
|
224
|
+
>>> request = HttpRequest("GET", "https://www.example.org/")
|
|
225
|
+
<HttpRequest [GET], url: 'https://www.example.org/'>
|
|
226
|
+
>>> response = client.send_request(request)
|
|
227
|
+
<HttpResponse: 200 OK>
|
|
228
|
+
|
|
229
|
+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
|
|
230
|
+
|
|
231
|
+
:param request: The network request you want to make. Required.
|
|
232
|
+
:type request: ~corehttp.rest.HttpRequest
|
|
233
|
+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
|
|
234
|
+
:return: The response of your network call. Does not do error handling on your response.
|
|
235
|
+
:rtype: ~corehttp.rest.HttpResponse
|
|
236
|
+
"""
|
|
237
|
+
|
|
238
|
+
request_copy = deepcopy(request)
|
|
239
|
+
path_format_arguments = {
|
|
240
|
+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
|
|
244
|
+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
|
|
245
|
+
|
|
246
|
+
def close(self) -> None:
|
|
247
|
+
self._client.close()
|
|
248
|
+
|
|
249
|
+
def __enter__(self) -> Self:
|
|
250
|
+
self._client.__enter__()
|
|
251
|
+
return self
|
|
252
|
+
|
|
253
|
+
def __exit__(self, *exc_details: Any) -> None:
|
|
254
|
+
self._client.__exit__(*exc_details)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from corehttp.runtime import policies
|
|
6
|
+
|
|
7
|
+
from ._version import VERSION
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class OpenMeterClientConfiguration:
|
|
11
|
+
"""Configuration for OpenMeterClient.
|
|
12
|
+
|
|
13
|
+
Note that all parameters used to create this instance are saved as instance
|
|
14
|
+
attributes.
|
|
15
|
+
|
|
16
|
+
:param endpoint: Service host. Default value is "https://127.0.0.1".
|
|
17
|
+
:type endpoint: str
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __init__(self, endpoint: str = "https://127.0.0.1", **kwargs: Any) -> None:
|
|
21
|
+
|
|
22
|
+
self.endpoint = endpoint
|
|
23
|
+
kwargs.setdefault("sdk_moniker", "openmeter/{}".format(VERSION))
|
|
24
|
+
self.polling_interval = kwargs.get("polling_interval", 30)
|
|
25
|
+
self._configure(**kwargs)
|
|
26
|
+
|
|
27
|
+
def _configure(self, **kwargs: Any) -> None:
|
|
28
|
+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
|
|
29
|
+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
|
|
30
|
+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
|
|
31
|
+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
|
|
32
|
+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
|
|
33
|
+
self.authentication_policy = kwargs.get("authentication_policy")
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
|
|
3
|
+
"""Customize generated code here.
|
|
4
|
+
|
|
5
|
+
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
__all__: list[str] = [] # Add all objects you want publicly available to users at this package level
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def patch_sdk():
|
|
13
|
+
"""Do not remove from this file.
|
|
14
|
+
|
|
15
|
+
`patch_sdk` is a last resort escape hatch that allows you to do customizations
|
|
16
|
+
you can't accomplish using the techniques described in
|
|
17
|
+
https://aka.ms/azsdk/python/dpcodegen/python/customize
|
|
18
|
+
"""
|
|
File without changes
|