本文整理汇总了Python中msrest.Serializer.body方法的典型用法代码示例。如果您正苦于以下问题:Python Serializer.body方法的具体用法?Python Serializer.body怎么用?Python Serializer.body使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msrest.Serializer
的用法示例。
在下文中一共展示了Serializer.body方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CdnManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
class CdnManagementClient(object):
"""Use these APIs to manage Azure CDN resources through the Azure Resource Manager. You must make sure that requests made to these resources are secure.
:ivar config: Configuration for client.
:vartype config: CdnManagementClientConfiguration
:ivar profiles: Profiles operations
:vartype profiles: azure.mgmt.cdn.operations.ProfilesOperations
:ivar endpoints: Endpoints operations
:vartype endpoints: azure.mgmt.cdn.operations.EndpointsOperations
:ivar origins: Origins operations
:vartype origins: azure.mgmt.cdn.operations.OriginsOperations
:ivar custom_domains: CustomDomains operations
:vartype custom_domains: azure.mgmt.cdn.operations.CustomDomainsOperations
:ivar resource_usage: ResourceUsage operations
:vartype resource_usage: azure.mgmt.cdn.operations.ResourceUsageOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.cdn.operations.Operations
:ivar edge_nodes: EdgeNodes operations
:vartype edge_nodes: azure.mgmt.cdn.operations.EdgeNodesOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, credentials, subscription_id, base_url=None):
self.config = CdnManagementClientConfiguration(credentials, subscription_id, base_url)
self._client = ServiceClient(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2017-04-02'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.profiles = ProfilesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.endpoints = EndpointsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.origins = OriginsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.custom_domains = CustomDomainsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.resource_usage = ResourceUsageOperations(
self._client, self.config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.edge_nodes = EdgeNodesOperations(
self._client, self.config, self._serialize, self._deserialize)
def check_name_availability(
self, name, custom_headers=None, raw=False, **operation_config):
"""Check the availability of a resource name. This is needed for resources
where name is globally unique, such as a CDN endpoint.
:param name: The resource name to validate.
:type name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: CheckNameAvailabilityOutput or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.cdn.models.ErrorResponseException>`
"""
check_name_availability_input = models.CheckNameAvailabilityInput(name=name)
# Construct URL
url = self.check_name_availability.metadata['url']
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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(check_name_availability_input, 'CheckNameAvailabilityInput')
# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, stream=False, **operation_config)
#.........这里部分代码省略.........
示例2: AutoRestValidationTest
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
class AutoRestValidationTest(object):
"""Test Infrastructure for AutoRest. No server backend exists for these tests.
:param config: Configuration for client.
:type config: AutoRestValidationTestConfiguration
"""
def __init__(self, config):
self._client = ServiceClient(None, config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer()
self._deserialize = Deserializer(client_models)
self.config = config
def validation_of_method_parameters(
self, resource_group_name, id, custom_headers={}, raw=False, **operation_config):
"""
Validates input parameters on the method. See swagger for details.
:param resource_group_name: Required string between 3 and 10 chars
with pattern [a-zA-Z0-9]+.
:type resource_group_name: str
:param id: Required int multiple of 10 from 100 to 1000.
:type id: int
:param dict custom_headers: headers that will be added to the request
:param boolean raw: returns the direct response alongside the
deserialized response
:rtype: Product or msrest.pipeline.ClientRawResponse
"""
# Construct URL
url = '/fakepath/{subscriptionId}/{resourceGroupName}/{id}'
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'id': self._serialize.url("id", id, 'int')
}
url = url.format(**path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['apiVersion'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [200]:
raise models.ErrorException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('Product', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def validation_of_body(
self, resource_group_name, id, body=None, custom_headers={}, raw=False, **operation_config):
"""
Validates body parameters on the method. See swagger for details.
:param resource_group_name: Required string between 3 and 10 chars
with pattern [a-zA-Z0-9]+.
:type resource_group_name: str
:param id: Required int multiple of 10 from 100 to 1000.
:type id: int
:param body:
:type body: Product or None
:param dict custom_headers: headers that will be added to the request
:param boolean raw: returns the direct response alongside the
deserialized response
:rtype: Product or msrest.pipeline.ClientRawResponse
"""
# Construct URL
url = '/fakepath/{subscriptionId}/{resourceGroupName}/{id}'
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'id': self._serialize.url("id", id, 'int')
}
url = url.format(**path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['apiVersion'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
# Construct headers
#.........这里部分代码省略.........
示例3: ResourceGraphClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
class ResourceGraphClient(SDKClient):
"""Azure Resource Graph API Reference
:ivar config: Configuration for client.
:vartype config: ResourceGraphClientConfiguration
:ivar operations: Operations operations
:vartype operations: azure.mgmt.resourcegraph.operations.Operations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param str base_url: Service URL
"""
def __init__(
self, credentials, base_url=None):
self.config = ResourceGraphClientConfiguration(credentials, base_url)
super(ResourceGraphClient, self).__init__(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2018-09-01-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
def resources(
self, query, custom_headers=None, raw=False, **operation_config):
"""Queries the resources managed by Azure Resource Manager for all
subscriptions specified in the request.
:param query: Request specifying query and its options.
:type query: ~azure.mgmt.resourcegraph.models.QueryRequest
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: QueryResponse or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.resourcegraph.models.QueryResponse or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.resourcegraph.models.ErrorResponseException>`
"""
# Construct URL
url = self.resources.metadata['url']
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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(query, 'QueryRequest')
# 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]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('QueryResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
resources.metadata = {'url': '/providers/Microsoft.ResourceGraph/resources'}
示例4: AnomalyDetectorClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
class AnomalyDetectorClient(SDKClient):
"""The Anomaly Detector API detects anomalies automatically in time series data. It supports two functionalities, one is for detecting the whole series with model trained by the timeseries, another is detecting last point with model trained by points before. By using this service, business customers can discover incidents and establish a logic flow for root cause analysis.
:ivar config: Configuration for client.
:vartype config: AnomalyDetectorClientConfiguration
:param endpoint: Supported Cognitive Services endpoints (protocol and
hostname, for example: https://westus2.api.cognitive.microsoft.com).
:type endpoint: str
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""
def __init__(
self, endpoint, credentials):
self.config = AnomalyDetectorClientConfiguration(endpoint, credentials)
super(AnomalyDetectorClient, self).__init__(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '1.0'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
def entire_detect(
self, body, custom_headers=None, raw=False, **operation_config):
"""Detect anomalies for the entire series in batch.
This operation generates a model using an entire series, each point is
detected with the same model. With this method, points before and after
a certain point are used to determine whether it is an anomaly. The
entire detection can give user an overall status of the time series.
:param body: Time series points and period if needed. Advanced model
parameters can also be set in the request.
:type body: ~azure.cognitiveservices.anomalydetector.models.Request
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: EntireDetectResponse or ClientRawResponse if raw=true
:rtype:
~azure.cognitiveservices.anomalydetector.models.EntireDetectResponse
or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`APIErrorException<azure.cognitiveservices.anomalydetector.models.APIErrorException>`
"""
# Construct URL
url = self.entire_detect.metadata['url']
path_format_arguments = {
'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
body_content = self._serialize.body(body, 'Request')
# 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]:
raise models.APIErrorException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('EntireDetectResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
entire_detect.metadata = {'url': '/timeseries/entire/detect'}
def last_detect(
self, body, custom_headers=None, raw=False, **operation_config):
"""Detect anomaly status of the latest point in time series.
This operation generates a model using points before the latest one.
With this method, only historical points are used to determine whether
the target point is an anomaly. The latest point detecting operation
matches the scenario of real-time monitoring of business metrics.
:param body: Time series points and period if needed. Advanced model
parameters can also be set in the request.
#.........这里部分代码省略.........
示例5: AutoRestResourceFlatteningTestService
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
class AutoRestResourceFlatteningTestService(object):
"""Resource Flattening for AutoRest
:param config: Configuration for client.
:type config: AutoRestResourceFlatteningTestServiceConfiguration
"""
def __init__(self, config):
self._client = ServiceClient(config.credentials, config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer()
self._deserialize = Deserializer(client_models)
self.config = config
def put_array(
self, resource_array=None, custom_headers={}, raw=False, **operation_config):
"""
Put External Resource as an Array
:param resource_array: External Resource as an Array to put
:type resource_array: list or None
:param dict custom_headers: headers that will be added to the request
:param boolean raw: returns the direct response alongside the
deserialized response
:rtype: None or msrest.pipeline.ClientRawResponse
"""
# Construct URL
url = '/azure/resource-flatten/array'
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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
if resource_array is not None:
body_content = self._serialize.body(resource_array, '[Resource]')
else:
body_content = None
# Construct and send request
request = self._client.put(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, **operation_config)
if response.status_code not in [200]:
raise models.ErrorException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
def get_array(
self, custom_headers={}, raw=False, **operation_config):
"""
Get External Resource as an Array
:param dict custom_headers: headers that will be added to the request
:param boolean raw: returns the direct response alongside the
deserialized response
:rtype: list or msrest.pipeline.ClientRawResponse
"""
# Construct URL
url = '/azure/resource-flatten/array'
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [200]:
raise models.ErrorException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('[FlattenedProduct]', response)
#.........这里部分代码省略.........
示例6: SwaggerPetstore
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
class SwaggerPetstore(object):
"""This is a sample server Petstore server. You can find out more about Swagger at <a href="http://swagger.io">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key "special-key" to test the authorization filters
:ivar config: Configuration for client.
:vartype config: SwaggerPetstoreConfiguration
:param str base_url: Service URL
:param str filepath: Existing config
"""
def __init__(
self, base_url=None, filepath=None):
self.config = SwaggerPetstoreConfiguration(base_url, filepath)
self._client = ServiceClient(None, 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)
def add_pet_using_byte_array(
self, body=None, custom_headers=None, raw=False, **operation_config):
"""Fake endpoint to test byte array in body parameter for adding a new
pet to the store.
:param body: Pet object in the form of byte array
:type body: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: None
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/pet'
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
if body is not None:
body_content = self._serialize.body(body, 'str')
else:
body_content = None
# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, **operation_config)
if response.status_code not in [405]:
raise HttpOperationError(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
def add_pet(
self, body=None, custom_headers=None, raw=False, **operation_config):
"""Add a new pet to the store.
Adds a new pet to the store. You may receive an HTTP invalid input if
your pet is invalid.
:param body: Pet object that needs to be added to the store
:type body: :class:`Pet <Petstore.models.Pet>`
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: None
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/pet'
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
if body is not None:
body_content = self._serialize.body(body, 'Pet')
#.........这里部分代码省略.........
示例7: ManagementGroupsAPI
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
class ManagementGroupsAPI(SDKClient):
"""The Azure Management Groups API enables consolidation of multiple subscriptions/resources into an organizational hierarchy and centrally manage access control, policies, alerting and reporting for those resources.
:ivar config: Configuration for client.
:vartype config: ManagementGroupsAPIConfiguration
:ivar management_groups: ManagementGroups operations
:vartype management_groups: azure.mgmt.managementgroups.operations.ManagementGroupsOperations
:ivar management_group_subscriptions: ManagementGroupSubscriptions operations
:vartype management_group_subscriptions: azure.mgmt.managementgroups.operations.ManagementGroupSubscriptionsOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.managementgroups.operations.Operations
:ivar entities: Entities operations
:vartype entities: azure.mgmt.managementgroups.operations.EntitiesOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param str base_url: Service URL
"""
def __init__(
self, credentials, base_url=None):
self.config = ManagementGroupsAPIConfiguration(credentials, base_url)
super(ManagementGroupsAPI, self).__init__(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2018-03-01-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.management_groups = ManagementGroupsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.management_group_subscriptions = ManagementGroupSubscriptionsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.entities = EntitiesOperations(
self._client, self.config, self._serialize, self._deserialize)
def check_name_availability(
self, check_name_availability_request, custom_headers=None, raw=False, **operation_config):
"""Checks if the specified management group name is valid and unique.
:param check_name_availability_request: Management group name
availability check parameters.
:type check_name_availability_request:
~azure.mgmt.managementgroups.models.CheckNameAvailabilityRequest
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: CheckNameAvailabilityResult or ClientRawResponse if raw=true
:rtype:
~azure.mgmt.managementgroups.models.CheckNameAvailabilityResult or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.managementgroups.models.ErrorResponseException>`
"""
# Construct URL
url = self.check_name_availability.metadata['url']
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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(check_name_availability_request, 'CheckNameAvailabilityRequest')
# 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]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('CheckNameAvailabilityResult', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
check_name_availability.metadata = {'url': '/providers/Microsoft.Management/checkNameAvailability'}
#.........这里部分代码省略.........
示例8: CdnManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
#.........这里部分代码省略.........
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: :class:`CheckNameAvailabilityOutput
<azure.mgmt.cdn.models.CheckNameAvailabilityOutput>`
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
:raises:
:class:`ErrorResponseException<azure.mgmt.cdn.models.ErrorResponseException>`
"""
check_name_availability_input = models.CheckNameAvailabilityInput(name=name)
# Construct URL
url = "/providers/Microsoft.Cdn/checkNameAvailability"
# Construct parameters
query_parameters = {}
query_parameters["api-version"] = self._serialize.query(
"self.config.api_version", self.config.api_version, "str"
)
# Construct headers
header_parameters = {}
header_parameters["Content-Type"] = "application/json; charset=utf-8"
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(check_name_availability_input, "CheckNameAvailabilityInput")
# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(request, header_parameters, body_content, **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("CheckNameAvailabilityOutput", response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def check_resource_usage(self, custom_headers=None, raw=False, **operation_config):
"""Check the quota and actual usage of the CDN profiles under the given
subscription.
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: :class:`ResourceUsagePaged
<azure.mgmt.cdn.models.ResourceUsagePaged>`
:raises:
:class:`ErrorResponseException<azure.mgmt.cdn.models.ErrorResponseException>`
示例9: MixedRealityClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
class MixedRealityClient(SDKClient):
"""Mixed Reality Client
:ivar config: Configuration for client.
:vartype config: MixedRealityClientConfiguration
:ivar operations: Operations operations
:vartype operations: azure.mgmt.mixedreality.operations.Operations
:ivar spatial_anchors_accounts: SpatialAnchorsAccounts operations
:vartype spatial_anchors_accounts: azure.mgmt.mixedreality.operations.SpatialAnchorsAccountsOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure subscription ID.
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, credentials, subscription_id, base_url=None):
self.config = MixedRealityClientConfiguration(credentials, subscription_id, base_url)
super(MixedRealityClient, self).__init__(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2019-02-28-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.spatial_anchors_accounts = SpatialAnchorsAccountsOperations(
self._client, self.config, self._serialize, self._deserialize)
def check_name_availability_local(
self, location, name, type, custom_headers=None, raw=False, **operation_config):
"""Check Name Availability for global uniqueness.
:param location: The location in which uniqueness will be verified.
:type location: str
:param name: Resource Name To Verify
:type name: str
:param type: Fully qualified resource type which includes provider
namespace
:type type: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: CheckNameAvailabilityResponse or ClientRawResponse if
raw=true
:rtype: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityResponse
or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.mixedreality.models.ErrorResponseException>`
"""
check_name_availability = models.CheckNameAvailabilityRequest(name=name, type=type)
# Construct URL
url = self.check_name_availability_local.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'location': self._serialize.url("location", location, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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(check_name_availability, 'CheckNameAvailabilityRequest')
# 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]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('CheckNameAvailabilityResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
#.........这里部分代码省略.........
示例10: LogAnalyticsDataClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
class LogAnalyticsDataClient(SDKClient):
"""Log Analytics Data Plane Client
:ivar config: Configuration for client.
:vartype config: LogAnalyticsDataClientConfiguration
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
:param str base_url: Service URL
"""
def __init__(
self, credentials, base_url=None):
self.config = LogAnalyticsDataClientConfiguration(credentials, base_url)
super(LogAnalyticsDataClient, self).__init__(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = 'v1'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
def query(
self, workspace_id, body, custom_headers=None, raw=False, **operation_config):
"""Execute an Analytics query.
Executes an Analytics query for data.
[Here](https://dev.loganalytics.io/documentation/Using-the-API) is an
example for using POST with an Analytics query.
:param workspace_id: ID of the workspace. This is Workspace ID from
the Properties blade in the Azure portal.
:type workspace_id: str
:param body: The Analytics query. Learn more about the [Analytics
query
syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/)
:type body: ~azure.loganalytics.models.QueryBody
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: QueryResults or ClientRawResponse if raw=true
:rtype: ~azure.loganalytics.models.QueryResults or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.loganalytics.models.ErrorResponseException>`
"""
# Construct URL
url = self.query.metadata['url']
path_format_arguments = {
'workspaceId': self._serialize.url("workspace_id", workspace_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
body_content = self._serialize.body(body, 'QueryBody')
# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, 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('QueryResults', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
query.metadata = {'url': '/workspaces/{workspaceId}/query'}
示例11: AutoRestValidationTest
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
class AutoRestValidationTest(object):
"""Test Infrastructure for AutoRest. No server backend exists for these tests.
:ivar config: Configuration for client.
:vartype config: AutoRestValidationTestConfiguration
:param subscription_id: Subscription ID.
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, subscription_id, base_url=None):
self.config = AutoRestValidationTestConfiguration(subscription_id, base_url)
self._client = ServiceClient(None, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '1.0.0'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
def validation_of_method_parameters(
self, resource_group_name, id, custom_headers=None, raw=False, **operation_config):
"""Validates input parameters on the method. See swagger for details.
:param resource_group_name: Required string between 3 and 10 chars
with pattern [a-zA-Z0-9]+.
:type resource_group_name: str
:param id: Required int multiple of 10 from 100 to 1000.
:type id: int
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: :class:`Product
<fixtures.acceptancetestsvalidation.models.Product>` or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if
raw=true
:rtype: :class:`Product
<fixtures.acceptancetestsvalidation.models.Product>` or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
:raises:
:class:`ErrorException<fixtures.acceptancetestsvalidation.models.ErrorException>`
"""
# Construct URL
url = '/fakepath/{subscriptionId}/{resourceGroupName}/{id}'
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9]+'),
'id': self._serialize.url("id", id, 'int', maximum=1000, minimum=100, multiple=10)
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['apiVersion'] = self._serialize.query("self.api_version", self.api_version, 'str', pattern=r'\d{2}-\d{2}-\d{4}')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [200]:
raise models.ErrorException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('Product', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def validation_of_body(
self, resource_group_name, id, body=None, custom_headers=None, raw=False, **operation_config):
"""Validates body parameters on the method. See swagger for details.
:param resource_group_name: Required string between 3 and 10 chars
with pattern [a-zA-Z0-9]+.
:type resource_group_name: str
:param id: Required int multiple of 10 from 100 to 1000.
:type id: int
:param body:
:type body: :class:`Product
<fixtures.acceptancetestsvalidation.models.Product>`
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
#.........这里部分代码省略.........
示例12: WebSiteManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
#.........这里部分代码省略.........
:param user_details: Details of publishing user
:type user_details: ~azure.mgmt.web.models.User
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: User or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.web.models.User or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
api_version = "2016-03-01"
# Construct URL
url = '/providers/Microsoft.Web/publishingUsers/web'
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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(user_details, 'User')
# Construct and send request
request = self._client.put(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('User', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def list_source_controls(
self, custom_headers=None, raw=False, **operation_config):
"""Gets the source controls available for Azure websites.
Gets the source controls available for Azure websites.
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
示例13: TextAnalyticsAPI
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
class TextAnalyticsAPI(object):
"""The Text Analytics API is a suite of text analytics web services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. No training data is needed to use this API; just bring your text data. This API uses advanced natural language processing techniques to deliver best in class predictions. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview
:ivar config: Configuration for client.
:vartype config: TextAnalyticsAPIConfiguration
:param azure_region: Supported Azure regions for Cognitive Services
endpoints. Possible values include: 'westus', 'westeurope',
'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus',
'southcentralus', 'northeurope', 'eastasia', 'australiaeast',
'brazilsouth'
:type azure_region: str or
~azure.cognitiveservices.language.textanalytics.models.AzureRegions
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""
def __init__(
self, azure_region, credentials):
self.config = TextAnalyticsAPIConfiguration(azure_region, credentials)
self._client = ServiceClient(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = 'v2.0'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
def key_phrases(
self, documents=None, custom_headers=None, raw=False, **operation_config):
"""The API returns a list of strings denoting the key talking points in
the input text.
We employ techniques from Microsoft Office's sophisticated Natural
Language Processing toolkit. See the <a
href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
Analytics Documentation</a> for details about the languages that are
supported by key phrase extraction.
:param documents:
:type documents:
list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput]
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: KeyPhraseBatchResult or ClientRawResponse if raw=true
:rtype:
~azure.cognitiveservices.language.textanalytics.models.KeyPhraseBatchResult
or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.cognitiveservices.language.textanalytics.models.ErrorResponseException>`
"""
input = models.MultiLanguageBatchInput(documents=documents)
# Construct URL
url = '/v2.0/keyPhrases'
path_format_arguments = {
'AzureRegion': self._serialize.url("self.config.azure_region", self.config.azure_region, 'AzureRegions', skip_quote=True)
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
body_content = self._serialize.body(input, 'MultiLanguageBatchInput')
# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, 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('KeyPhraseBatchResult', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def detect_language(
self, documents=None, custom_headers=None, raw=False, **operation_config):
"""The API returns the detected language and a numeric score between 0 and
1.
#.........这里部分代码省略.........
示例14: FormRecognizerClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
class FormRecognizerClient(SDKClient):
"""Extracts information from forms and images into structured data based on a model created by a set of representative training forms.
:ivar config: Configuration for client.
:vartype config: FormRecognizerClientConfiguration
:param endpoint: Supported Cognitive Services endpoints (protocol and
hostname, for example: https://westus2.api.cognitive.microsoft.com).
:type endpoint: str
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""
def __init__(
self, endpoint, credentials):
self.config = FormRecognizerClientConfiguration(endpoint, credentials)
super(FormRecognizerClient, self).__init__(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '1.0-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
def train_custom_model(
self, source, custom_headers=None, raw=False, **operation_config):
"""Train Model.
The train request must include a source parameter that is either an
externally accessible Azure Storage blob container Uri (preferably a
Shared Access Signature Uri) or valid path to a data folder in a
locally mounted drive. When local paths are specified, they must follow
the Linux/Unix path format and be an absolute path rooted to the input
mount configuration
setting value e.g., if '{Mounts:Input}' configuration setting value is
'/input' then a valid source path would be '/input/contosodataset'. All
data to be trained are expected to be under the source. Models are
trained using documents that are of the following content type -
'application/pdf', 'image/jpeg' and 'image/png'."
Other content is ignored when training a model.
:param source: Get or set source path.
:type source: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: TrainResult or ClientRawResponse if raw=true
:rtype: ~azure.cognitiveservices.formrecognizer.models.TrainResult or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.cognitiveservices.formrecognizer.models.ErrorResponseException>`
"""
train_request = models.TrainRequest(source=source)
# Construct URL
url = self.train_custom_model.metadata['url']
path_format_arguments = {
'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
body_content = self._serialize.body(train_request, 'TrainRequest')
# 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]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('TrainResult', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
train_custom_model.metadata = {'url': '/custom/train'}
def get_extracted_keys(
self, id, custom_headers=None, raw=False, **operation_config):
"""Get Keys.
#.........这里部分代码省略.........
示例15: AutoRestResourceFlatteningTestService
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import body [as 别名]
class AutoRestResourceFlatteningTestService(object):
"""Resource Flattening for AutoRest
:param config: Configuration for client.
:type config: AutoRestResourceFlatteningTestServiceConfiguration
"""
def __init__(self, config):
self._client = ServiceClient(None, config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer()
self._deserialize = Deserializer(client_models)
self.config = config
def put_array(
self, resource_array=None, custom_headers={}, raw=False, **operation_config):
"""
Put External Resource as an Array
:param resource_array: External Resource as an Array to put
:type resource_array: list of :class:`Resource
<fixtures.acceptancetestsmodelflattening.models.Resource>`
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: None
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/model-flatten/array'
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
if resource_array is not None:
body_content = self._serialize.body(resource_array, '[Resource]')
else:
body_content = None
# Construct and send request
request = self._client.put(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, **operation_config)
if response.status_code not in [200]:
raise models.ErrorException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
def get_array(
self, custom_headers={}, raw=False, **operation_config):
"""
Get External Resource as an Array
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: list of :class:`FlattenedProduct
<fixtures.acceptancetestsmodelflattening.models.FlattenedProduct>`
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/model-flatten/array'
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [200]:
raise models.ErrorException(self._deserialize, response)
deserialized = None
#.........这里部分代码省略.........