Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OperationListResult', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
list.metadata = {'url': '/providers/Microsoft.Subscription/operations'}
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(body, 'SubscriptionCreationParameters')
# Construct and send request
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200, 202]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
header_dict = {}
if response.status_code == 200:
deserialized = self._deserialize('SubscriptionCreationResult', response)
header_dict = {
'Location': 'str',
'Retry-After': 'int',
}
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
client_raw_response.add_headers(header_dict)
return client_raw_response
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OperationListResult', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
list.metadata = {'url': '/providers/Microsoft.Subscription/operations'}
def __init__(
self, credentials, base_url=None):
self.config = SubscriptionClientConfiguration(credentials, base_url)
super(SubscriptionClient, self).__init__(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.subscription_operation = SubscriptionOperationOperations(
self._client, self.config, self._serialize, self._deserialize)
self.subscription_factory = SubscriptionFactoryOperations(
self._client, self.config, self._serialize, self._deserialize)
self.subscriptions = SubscriptionsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.tenants = TenantsOperations(
self._client, self.config, self._serialize, self._deserialize)
def __init__(self, **kwargs):
super(Operation, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
self.display = kwargs.get('display', None)
def __init__(
self, credentials, base_url=None):
if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'
super(SubscriptionClientConfiguration, self).__init__(base_url)
self.add_user_agent('azure-mgmt-subscription/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')
self.credentials = credentials
def __init__(
self, credentials, base_url=None):
self.config = SubscriptionClientConfiguration(credentials, base_url)
super(SubscriptionClient, self).__init__(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.subscription_operation = SubscriptionOperationOperations(
self._client, self.config, self._serialize, self._deserialize)
self.subscription_factory = SubscriptionFactoryOperations(
self._client, self.config, self._serialize, self._deserialize)
self.subscriptions = SubscriptionsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.tenants = TenantsOperations(
self._client, self.config, self._serialize, self._deserialize)
def __init__(self, **kwargs):
super(Location, self).__init__(**kwargs)
self.id = None
self.subscription_id = None
self.name = None
self.display_name = None
self.latitude = None
self.longitude = None
def __init__(self, **kwargs):
super(SubscriptionCreationParameters, self).__init__(**kwargs)
self.display_name = kwargs.get('display_name', None)
self.billing_profile_id = kwargs.get('billing_profile_id', None)
self.sku_id = kwargs.get('sku_id', None)
self.cost_center = kwargs.get('cost_center', None)
self.owner = kwargs.get('owner', None)
self.additional_parameters = kwargs.get('additional_parameters', None)
def __init__(self, *, display_name: str=None, billing_profile_id: str=None, sku_id: str=None, cost_center: str=None, owner=None, additional_parameters=None, **kwargs) -> None:
super(SubscriptionCreationParameters, self).__init__(**kwargs)
self.display_name = display_name
self.billing_profile_id = billing_profile_id
self.sku_id = sku_id
self.cost_center = cost_center
self.owner = owner
self.additional_parameters = additional_parameters