本文整理汇总了Python中msrest.service_client.ServiceClient.send方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceClient.send方法的具体用法?Python ServiceClient.send怎么用?Python ServiceClient.send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msrest.service_client.ServiceClient
的用法示例。
在下文中一共展示了ServiceClient.send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AutoRestReportServiceForAzure
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [as 别名]
class AutoRestReportServiceForAzure(object):
"""Test Infrastructure for AutoRest
:param config: Configuration for client.
:type config: AutoRestReportServiceForAzureConfiguration
"""
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 get_report(
self, custom_headers={}, raw=False, **operation_config):
"""
Get test coverage report
:param dict custom_headers: headers that will be added to the request
:param boolean raw: returns the direct response alongside the
deserialized response
:rtype: dict or msrest.pipeline.ClientRawResponse
"""
# Construct URL
url = '/report/azure'
# 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('{int}', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
示例2: AutoRestReportService
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [as 别名]
class AutoRestReportService(object):
"""Test Infrastructure for AutoRest
:param config: Configuration for client.
:type config: AutoRestReportServiceConfiguration
"""
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 get_report(
self, custom_headers={}, raw=False, **operation_config):
"""
Get test coverage report
: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: dict
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/report'
# 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
if response.status_code == 200:
deserialized = self._deserialize('{int}', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
示例3: AutoRestReportServiceForAzure
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [as 别名]
class AutoRestReportServiceForAzure(object):
"""Test Infrastructure for AutoRest
:ivar config: Configuration for client.
:vartype config: AutoRestReportServiceForAzureConfiguration
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param accept_language: Gets or sets the preferred language for the
response.
:type accept_language: str
:param long_running_operation_retry_timeout: Gets or sets the retry
timeout in seconds for Long Running Operations. Default value is 30.
:type long_running_operation_retry_timeout: int
:param generate_client_request_id: When set to true a unique
x-ms-client-request-id value is generated and included in each request.
Default is true.
:type generate_client_request_id: bool
:param str base_url: Service URL
:param str filepath: Existing config
"""
def __init__(
self, credentials, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None):
self.config = AutoRestReportServiceForAzureConfiguration(credentials, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath)
self._client = ServiceClient(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)
def get_report(
self, custom_headers=None, raw=False, **operation_config):
"""Get test coverage report.
: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: dict
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/report/azure'
# 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('{int}', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
示例4: AutoRestReportServiceForAzure
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [as 别名]
class AutoRestReportServiceForAzure(object):
"""Test Infrastructure for AutoRest
:ivar config: Configuration for client.
:vartype config: AutoRestReportServiceForAzureConfiguration
: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 = AutoRestReportServiceForAzureConfiguration(credentials, 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 = '1.0.0'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
def get_report(
self, custom_headers=None, raw=False, **operation_config):
"""Get test coverage report.
: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: dict or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if
raw=true
:rtype: dict or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
:raises:
:class:`ErrorException<fixtures.acceptancetestsazurereport.models.ErrorException>`
"""
# Construct URL
url = '/report/azure'
# 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('{int}', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
示例5: SwaggerPetstore
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [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')
#.........这里部分代码省略.........
示例6: NetworkManagementClient
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [as 别名]
#.........这里部分代码省略.........
self._client, self.config, self._serialize, self._deserialize)
self.network_watchers = NetworkWatchersOperations(
self._client, self.config, self._serialize, self._deserialize)
self.packet_captures = PacketCapturesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.public_ip_addresses = PublicIPAddressesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.route_filters = RouteFiltersOperations(
self._client, self.config, self._serialize, self._deserialize)
self.route_filter_rules = RouteFilterRulesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.route_tables = RouteTablesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.routes = RoutesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.bgp_service_communities = BgpServiceCommunitiesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.usages = UsagesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_networks = VirtualNetworksOperations(
self._client, self.config, self._serialize, self._deserialize)
self.subnets = SubnetsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_network_peerings = VirtualNetworkPeeringsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_network_gateways = VirtualNetworkGatewaysOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_network_gateway_connections = VirtualNetworkGatewayConnectionsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.local_network_gateways = LocalNetworkGatewaysOperations(
self._client, self.config, self._serialize, self._deserialize)
def check_dns_name_availability(
self, location, domain_name_label, custom_headers=None, raw=False, **operation_config):
"""Checks whether a domain name in the cloudapp.azure.com zone is
available for use.
:param location: The location of the domain name.
:type location: str
:param domain_name_label: The domain name to be verified. It must
conform to the following regular expression:
^[a-z][a-z0-9-]{1,61}[a-z0-9]$.
:type domain_name_label: 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: DnsNameAvailabilityResult or ClientRawResponse if raw=true
:rtype:
~azure.mgmt.network.v2017_09_01.models.DnsNameAvailabilityResult or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
api_version = "2017-09-01"
# Construct URL
url = '/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability'
path_format_arguments = {
'location': self._serialize.url("location", location, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['domainNameLabel'] = self._serialize.query("domain_name_label", domain_name_label, 'str')
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 and send request
request = self._client.get(url, query_parameters)
response = self._client.send(request, header_parameters, stream=False, **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('DnsNameAvailabilityResult', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
示例7: AutoRestResourceFlatteningTestService
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [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
#.........这里部分代码省略.........
示例8: NetworkManagementClient
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [as 别名]
#.........这里部分代码省略.........
self.public_ip_addresses = PublicIPAddressesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.network_security_groups = NetworkSecurityGroupsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.security_rules = SecurityRulesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.load_balancers = LoadBalancersOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_networks = VirtualNetworksOperations(
self._client, self.config, self._serialize, self._deserialize)
self.subnets = SubnetsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_network_peerings = VirtualNetworkPeeringsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.network_interfaces = NetworkInterfacesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.usages = UsagesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_network_gateways = VirtualNetworkGatewaysOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_network_gateway_connections = VirtualNetworkGatewayConnectionsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.local_network_gateways = LocalNetworkGatewaysOperations(
self._client, self.config, self._serialize, self._deserialize)
self.express_route_circuit_authorizations = ExpressRouteCircuitAuthorizationsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.express_route_circuit_peerings = ExpressRouteCircuitPeeringsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.express_route_circuits = ExpressRouteCircuitsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.express_route_service_providers = ExpressRouteServiceProvidersOperations(
self._client, self.config, self._serialize, self._deserialize)
def check_dns_name_availability(
self, location, domain_name_label=None, custom_headers=None, raw=False, **operation_config):
"""Checks whether a domain name in the cloudapp.net zone is available for
use.
:param location: The location of the domain name.
:type location: str
:param domain_name_label: The domain name to be verified. It must
conform to the following regular expression:
^[a-z][a-z0-9-]{1,61}[a-z0-9]$.
:type domain_name_label: 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: :class:`DnsNameAvailabilityResult
<azure.mgmt.network.models.DnsNameAvailabilityResult>`
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
api_version = "2016-09-01"
# Construct URL
url = '/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability'
path_format_arguments = {
'location': self._serialize.url("location", location, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
if domain_name_label is not None:
query_parameters['domainNameLabel'] = self._serialize.query("domain_name_label", domain_name_label, 'str')
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 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]:
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('DnsNameAvailabilityResult', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
示例9: AutoRestValidationTest
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [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
#.........这里部分代码省略.........
示例10: SqlManagementClient
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [as 别名]
class SqlManagementClient(object):
"""The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases.
:ivar config: Configuration for client.
:vartype config: SqlManagementClientConfiguration
:ivar servers: Servers operations
:vartype servers: .operations.ServersOperations
:ivar databases: Databases operations
:vartype databases: .operations.DatabasesOperations
:ivar import_export_operations: ImportExportOperations operations
:vartype import_export_operations: .operations.ImportExportOperations
:ivar elastic_pools: ElasticPools operations
:vartype elastic_pools: .operations.ElasticPoolsOperations
:ivar recommended_elastic_pools: RecommendedElasticPools operations
:vartype recommended_elastic_pools: .operations.RecommendedElasticPoolsOperations
: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: The subscription ID that identifies an Azure
subscription.
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, credentials, subscription_id, base_url=None):
self.config = SqlManagementClientConfiguration(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._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.servers = ServersOperations(
self._client, self.config, self._serialize, self._deserialize)
self.databases = DatabasesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.import_export_operations = ImportExportOperations(
self._client, self.config, self._serialize, self._deserialize)
self.elastic_pools = ElasticPoolsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.recommended_elastic_pools = RecommendedElasticPoolsOperations(
self._client, self.config, self._serialize, self._deserialize)
def list_operations(
self, custom_headers=None, raw=False, **operation_config):
"""Lists all of the available SQL Rest API operations.
: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:`OperationListResult
<azure.mgmt.sql.models.OperationListResult>`
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
api_version = "2014-04-01"
# Construct URL
url = '/providers/Microsoft.Sql/operations'
# 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 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]:
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('OperationListResult', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
示例11: AzureReservationAPI
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [as 别名]
class AzureReservationAPI(object):
"""This API describe Azure Reservation
:ivar config: Configuration for client.
:vartype config: AzureReservationAPIConfiguration
:ivar reservation_order: ReservationOrder operations
:vartype reservation_order: reservations.operations.ReservationOrderOperations
:ivar reservation: Reservation operations
:vartype reservation: reservations.operations.ReservationOperations
:ivar operation: Operation operations
:vartype operation: reservations.operations.OperationOperations
: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 = AzureReservationAPIConfiguration(credentials, 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-11-01'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.reservation_order = ReservationOrderOperations(
self._client, self.config, self._serialize, self._deserialize)
self.reservation = ReservationOperations(
self._client, self.config, self._serialize, self._deserialize)
self.operation = OperationOperations(
self._client, self.config, self._serialize, self._deserialize)
def get_catalog(
self, subscription_id, custom_headers=None, raw=False, **operation_config):
"""Get the regions and skus that are available for RI purchase for the
specified Azure subscription.
:param subscription_id: Id of the subscription
:type subscription_id: 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: list of :class:`Catalog <reservations.models.Catalog>` or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if
raw=true
:rtype: list of :class:`Catalog <reservations.models.Catalog>` or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
:raises: :class:`ErrorException<reservations.models.ErrorException>`
"""
# Construct URL
url = '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs'
path_format_arguments = {
'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str')
}
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['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('[Catalog]', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def get_applied_reservation_list(
self, subscription_id, custom_headers=None, raw=False, **operation_config):
"""Get list of applicable `Reservation`s.
Get applicable `Reservation`s that are applied to this subscription.
#.........这里部分代码省略.........
示例12: WebSiteManagementClient
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [as 别名]
#.........这里部分代码省略.........
Gets publishing 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 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]:
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 update_publishing_user(
self, user_details, custom_headers=None, raw=False, **operation_config):
"""Updates publishing user.
Updates publishing user.
: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
示例13: TextAnalyticsAPI
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [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: LogicManagementClient
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [as 别名]
#.........这里部分代码省略.........
:param subscription_id: The subscription id.
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, credentials, subscription_id, base_url=None):
self.config = LogicManagementClientConfiguration(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 = '2016-06-01'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.workflows = WorkflowsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.workflow_versions = WorkflowVersionsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.workflow_triggers = WorkflowTriggersOperations(
self._client, self.config, self._serialize, self._deserialize)
self.workflow_trigger_histories = WorkflowTriggerHistoriesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.workflow_runs = WorkflowRunsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.workflow_run_actions = WorkflowRunActionsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.integration_accounts = IntegrationAccountsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.schemas = SchemasOperations(
self._client, self.config, self._serialize, self._deserialize)
self.maps = MapsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.partners = PartnersOperations(
self._client, self.config, self._serialize, self._deserialize)
self.agreements = AgreementsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.certificates = CertificatesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.sessions = SessionsOperations(
self._client, self.config, self._serialize, self._deserialize)
def list_operations(
self, custom_headers=None, raw=False, **operation_config):
"""Lists all of the available Logic REST API operations.
: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:`OperationPaged
<azure.mgmt.logic.models.OperationPaged>`
:raises:
:class:`ErrorResponseException<azure.mgmt.logic.models.ErrorResponseException>`
"""
def internal_paging(next_link=None, raw=False):
if not next_link:
# Construct URL
url = '/providers/Microsoft.Logic/operations'
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
else:
url = next_link
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.ErrorResponseException(self._deserialize, response)
return response
# Deserialize response
deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies)
if raw:
header_dict = {}
client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response
return deserialized
示例15: CdnManagementClient
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import send [as 别名]
#.........这里部分代码省略.........
: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>`
"""
def internal_paging(next_link=None, raw=False):