本文整理汇总了Python中msrest.Serializer.url方法的典型用法代码示例。如果您正苦于以下问题:Python Serializer.url方法的具体用法?Python Serializer.url怎么用?Python Serializer.url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msrest.Serializer
的用法示例。
在下文中一共展示了Serializer.url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AutoRestValidationTest
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [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
#.........这里部分代码省略.........
示例2: PredictionEndpoint
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [as 别名]
class PredictionEndpoint(object):
"""PredictionEndpoint
:ivar config: Configuration for client.
:vartype config: PredictionEndpointConfiguration
:param api_key:
:type api_key: str
:param str base_url: Service URL
"""
def __init__(
self, api_key, base_url=None):
self.config = PredictionEndpointConfiguration(api_key, 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.1'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
def predict_image_url(
self, project_id, iteration_id=None, application=None, url=None, custom_headers=None, raw=False, **operation_config):
"""Predict an image url and saves the result.
:param project_id: The project id
:type project_id: str
:param iteration_id: Optional. Specifies the id of a particular
iteration to evaluate against.
The default iteration for the project will be used when not specified
:type iteration_id: str
:param application: Optional. Specifies the name of application using
the endpoint
:type application: str
:param url:
:type url: 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: ImagePredictionResultModel or ClientRawResponse if raw=true
:rtype:
~azure.cognitiveservices.vision.customvision.prediction.models.ImagePredictionResultModel
or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
"""
image_url = models.ImageUrl(url=url)
# Construct URL
url = '/{projectId}/url'
path_format_arguments = {
'projectId': self._serialize.url("project_id", project_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
if iteration_id is not None:
query_parameters['iterationId'] = self._serialize.query("iteration_id", iteration_id, 'str')
if application is not None:
query_parameters['application'] = self._serialize.query("application", application, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
header_parameters['Prediction-Key'] = self._serialize.header("self.config.api_key", self.config.api_key, 'str')
# Construct body
body_content = self._serialize.body(image_url, 'ImageUrl')
# 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 HttpOperationError(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ImagePredictionResultModel', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def predict_image(
self, project_id, image_data, iteration_id=None, application=None, custom_headers=None, raw=False, **operation_config):
"""Predict an image and saves the result.
:param project_id: The project id
#.........这里部分代码省略.........
示例3: NetworkManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [as 别名]
#.........这里部分代码省略.........
:vartype virtual_network_taps: azure.mgmt.network.v2018_08_01.operations.VirtualNetworkTapsOperations
:ivar virtual_network_gateways: VirtualNetworkGateways operations
:vartype virtual_network_gateways: azure.mgmt.network.v2018_08_01.operations.VirtualNetworkGatewaysOperations
:ivar virtual_network_gateway_connections: VirtualNetworkGatewayConnections operations
:vartype virtual_network_gateway_connections: azure.mgmt.network.v2018_08_01.operations.VirtualNetworkGatewayConnectionsOperations
:ivar local_network_gateways: LocalNetworkGateways operations
:vartype local_network_gateways: azure.mgmt.network.v2018_08_01.operations.LocalNetworkGatewaysOperations
:ivar virtual_wans: VirtualWans operations
:vartype virtual_wans: azure.mgmt.network.v2018_08_01.operations.VirtualWansOperations
:ivar vpn_sites: VpnSites operations
:vartype vpn_sites: azure.mgmt.network.v2018_08_01.operations.VpnSitesOperations
:ivar vpn_sites_configuration: VpnSitesConfiguration operations
:vartype vpn_sites_configuration: azure.mgmt.network.v2018_08_01.operations.VpnSitesConfigurationOperations
:ivar virtual_hubs: VirtualHubs operations
:vartype virtual_hubs: azure.mgmt.network.v2018_08_01.operations.VirtualHubsOperations
:ivar hub_virtual_network_connections: HubVirtualNetworkConnections operations
:vartype hub_virtual_network_connections: azure.mgmt.network.v2018_08_01.operations.HubVirtualNetworkConnectionsOperations
:ivar vpn_gateways: VpnGateways operations
:vartype vpn_gateways: azure.mgmt.network.v2018_08_01.operations.VpnGatewaysOperations
:ivar vpn_connections: VpnConnections operations
:vartype vpn_connections: azure.mgmt.network.v2018_08_01.operations.VpnConnectionsOperations
:ivar p2s_vpn_server_configurations: P2sVpnServerConfigurations operations
:vartype p2s_vpn_server_configurations: azure.mgmt.network.v2018_08_01.operations.P2sVpnServerConfigurationsOperations
:ivar p2s_vpn_gateways: P2sVpnGateways operations
:vartype p2s_vpn_gateways: azure.mgmt.network.v2018_08_01.operations.P2sVpnGatewaysOperations
: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 credentials which uniquely
identify the Microsoft Azure subscription. The subscription ID forms part
of the URI for every service call.
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, credentials, subscription_id, base_url=None):
self.config = NetworkManagementClientConfiguration(credentials, subscription_id, base_url)
super(NetworkManagementClient, self).__init__(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.application_gateways = ApplicationGatewaysOperations(
self._client, self.config, self._serialize, self._deserialize)
self.application_security_groups = ApplicationSecurityGroupsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.available_delegations = AvailableDelegationsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.available_resource_group_delegations = AvailableResourceGroupDelegationsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.azure_firewalls = AzureFirewallsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.azure_firewall_fqdn_tags = AzureFirewallFqdnTagsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.ddos_protection_plans = DdosProtectionPlansOperations(
self._client, self.config, self._serialize, self._deserialize)
self.available_endpoint_services = AvailableEndpointServicesOperations(
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)
示例4: SwaggerPetstore
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [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')
#.........这里部分代码省略.........
示例5: IntuneResourceManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [as 别名]
class IntuneResourceManagementClient(object):
"""Microsoft.Intune Resource provider Api features in the swagger-2.0 specification
:ivar config: Configuration for client.
:vartype config: IntuneResourceManagementClientConfiguration
:ivar ios: Ios operations
:vartype ios: .operations.IosOperations
:ivar android: Android operations
:vartype android: .operations.AndroidOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param api_version: Service Api Version.
:type api_version: str
: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, api_version='2015-01-14-preview', accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None):
self.config = IntuneResourceManagementClientConfiguration(credentials, api_version, 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)
self.ios = IosOperations(
self._client, self.config, self._serialize, self._deserialize)
self.android = AndroidOperations(
self._client, self.config, self._serialize, self._deserialize)
def get_locations(
self, custom_headers=None, raw=False, **operation_config):
"""Returns location for user tenant.
: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:`LocationPaged
<azure.mgmt.intune.models.LocationPaged>`
"""
def internal_paging(next_link=None, raw=False):
if not next_link:
# Construct URL
url = '/providers/Microsoft.Intune/locations'
# 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.ErrorException(self._deserialize, response)
return response
# Deserialize response
deserialized = models.LocationPaged(internal_paging, self._deserialize.dependencies)
if raw:
header_dict = {}
client_raw_response = models.LocationPaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response
return deserialized
#.........这里部分代码省略.........
示例6: AutoRestResourceFlatteningTestService
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [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
#.........这里部分代码省略.........
示例7: FrontDoorManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [as 别名]
class FrontDoorManagementClient(SDKClient):
"""FrontDoor Client
:ivar config: Configuration for client.
:vartype config: FrontDoorManagementClientConfiguration
:ivar front_doors: FrontDoors operations
:vartype front_doors: azure.mgmt.frontdoor.operations.FrontDoorsOperations
:ivar routing_rules: RoutingRules operations
:vartype routing_rules: azure.mgmt.frontdoor.operations.RoutingRulesOperations
:ivar health_probe_settings: HealthProbeSettings operations
:vartype health_probe_settings: azure.mgmt.frontdoor.operations.HealthProbeSettingsOperations
:ivar load_balancing_settings: LoadBalancingSettings operations
:vartype load_balancing_settings: azure.mgmt.frontdoor.operations.LoadBalancingSettingsOperations
:ivar backend_pools: BackendPools operations
:vartype backend_pools: azure.mgmt.frontdoor.operations.BackendPoolsOperations
:ivar frontend_endpoints: FrontendEndpoints operations
:vartype frontend_endpoints: azure.mgmt.frontdoor.operations.FrontendEndpointsOperations
:ivar endpoints: Endpoints operations
:vartype endpoints: azure.mgmt.frontdoor.operations.EndpointsOperations
:ivar policies: Policies operations
:vartype policies: azure.mgmt.frontdoor.operations.PoliciesOperations
: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 credentials which uniquely
identify the Microsoft Azure subscription. The subscription ID forms part
of the URI for every service call.
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, credentials, subscription_id, base_url=None):
self.config = FrontDoorManagementClientConfiguration(credentials, subscription_id, base_url)
super(FrontDoorManagementClient, self).__init__(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.front_doors = FrontDoorsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.routing_rules = RoutingRulesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.health_probe_settings = HealthProbeSettingsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.load_balancing_settings = LoadBalancingSettingsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.backend_pools = BackendPoolsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.frontend_endpoints = FrontendEndpointsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.endpoints = EndpointsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.policies = PoliciesOperations(
self._client, self.config, self._serialize, self._deserialize)
def check_front_door_name_availability(
self, name, type, custom_headers=None, raw=False, **operation_config):
"""Check the availability of a Front Door resource name.
:param name: The resource name to validate.
:type name: str
:param type: The type of the resource whose name is to be validated.
Possible values include: 'Microsoft.Network/frontDoors',
'Microsoft.Network/frontDoors/frontendEndpoints'
:type type: str or ~azure.mgmt.frontdoor.models.ResourceType
: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.frontdoor.models.CheckNameAvailabilityOutput or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.frontdoor.models.ErrorResponseException>`
"""
check_front_door_name_availability_input = models.CheckNameAvailabilityInput(name=name, type=type)
api_version = "2018-08-01"
# Construct URL
url = self.check_front_door_name_availability.metadata['url']
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("api_version", 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)
#.........这里部分代码省略.........
示例8: LogAnalyticsDataClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [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'}
示例9: AzureReservationAPI
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [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.
#.........这里部分代码省略.........
示例10: AzureNetAppFilesManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [as 别名]
class AzureNetAppFilesManagementClient(SDKClient):
"""Microsoft NetApp Azure Resource Provider specification
:ivar config: Configuration for client.
:vartype config: AzureNetAppFilesManagementClientConfiguration
:ivar operations: Operations operations
:vartype operations: azure.mgmt.netapp.operations.Operations
:ivar accounts: Accounts operations
:vartype accounts: azure.mgmt.netapp.operations.AccountsOperations
:ivar pools: Pools operations
:vartype pools: azure.mgmt.netapp.operations.PoolsOperations
:ivar volumes: Volumes operations
:vartype volumes: azure.mgmt.netapp.operations.VolumesOperations
:ivar mount_targets: MountTargets operations
:vartype mount_targets: azure.mgmt.netapp.operations.MountTargetsOperations
:ivar snapshots: Snapshots operations
:vartype snapshots: azure.mgmt.netapp.operations.SnapshotsOperations
: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: Subscription credentials which uniquely identify
Microsoft Azure subscription. The subscription ID forms part of the URI
for every service call.
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, credentials, subscription_id, base_url=None):
self.config = AzureNetAppFilesManagementClientConfiguration(credentials, subscription_id, base_url)
super(AzureNetAppFilesManagementClient, 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-05-01'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.accounts = AccountsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.pools = PoolsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.volumes = VolumesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.mount_targets = MountTargetsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.snapshots = SnapshotsOperations(
self._client, self.config, self._serialize, self._deserialize)
def check_name_availability(
self, location, custom_headers=None, raw=False, **operation_config):
"""Check resource name availability.
Check if a resource name is available.
:param location: The location
:type location: 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: ResourceNameAvailability or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.netapp.models.ResourceNameAvailability or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.check_name_availability.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')
}
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'
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.post(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
#.........这里部分代码省略.........
示例11: WebSiteManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [as 别名]
class WebSiteManagementClient(object):
"""WebSite Management Client
:ivar config: Configuration for client.
:vartype config: WebSiteManagementClientConfiguration
:ivar app_service_certificate_orders: AppServiceCertificateOrders operations
:vartype app_service_certificate_orders: azure.mgmt.web.operations.AppServiceCertificateOrdersOperations
:ivar domains: Domains operations
:vartype domains: azure.mgmt.web.operations.DomainsOperations
:ivar top_level_domains: TopLevelDomains operations
:vartype top_level_domains: azure.mgmt.web.operations.TopLevelDomainsOperations
:ivar certificates: Certificates operations
:vartype certificates: azure.mgmt.web.operations.CertificatesOperations
:ivar deleted_web_apps: DeletedWebApps operations
:vartype deleted_web_apps: azure.mgmt.web.operations.DeletedWebAppsOperations
:ivar provider: Provider operations
:vartype provider: azure.mgmt.web.operations.ProviderOperations
:ivar recommendations: Recommendations operations
:vartype recommendations: azure.mgmt.web.operations.RecommendationsOperations
:ivar web_apps: WebApps operations
:vartype web_apps: azure.mgmt.web.operations.WebAppsOperations
:ivar app_service_environments: AppServiceEnvironments operations
:vartype app_service_environments: azure.mgmt.web.operations.AppServiceEnvironmentsOperations
:ivar app_service_plans: AppServicePlans operations
:vartype app_service_plans: azure.mgmt.web.operations.AppServicePlansOperations
: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: Your Azure subscription ID. This is a
GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, credentials, subscription_id, base_url=None):
self.config = WebSiteManagementClientConfiguration(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.app_service_certificate_orders = AppServiceCertificateOrdersOperations(
self._client, self.config, self._serialize, self._deserialize)
self.domains = DomainsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.top_level_domains = TopLevelDomainsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.certificates = CertificatesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.deleted_web_apps = DeletedWebAppsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.provider = ProviderOperations(
self._client, self.config, self._serialize, self._deserialize)
self.recommendations = RecommendationsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.web_apps = WebAppsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.app_service_environments = AppServiceEnvironmentsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.app_service_plans = AppServicePlansOperations(
self._client, self.config, self._serialize, self._deserialize)
def get_publishing_user(
self, custom_headers=None, raw=False, **operation_config):
"""Gets publishing user.
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:
#.........这里部分代码省略.........
示例12: TextAnalyticsAPI
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [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.
#.........这里部分代码省略.........
示例13: FormRecognizerClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [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.
#.........这里部分代码省略.........
示例14: AnomalyDetectorClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [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.
#.........这里部分代码省略.........
示例15: NetworkManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import url [as 别名]
class NetworkManagementClient(object):
"""Composite Swagger for Network Client
:ivar config: Configuration for client.
:vartype config: NetworkManagementClientConfiguration
:ivar application_gateways: ApplicationGateways operations
:vartype application_gateways: .operations.ApplicationGatewaysOperations
:ivar route_tables: RouteTables operations
:vartype route_tables: .operations.RouteTablesOperations
:ivar routes: Routes operations
:vartype routes: .operations.RoutesOperations
:ivar public_ip_addresses: PublicIPAddresses operations
:vartype public_ip_addresses: .operations.PublicIPAddressesOperations
:ivar network_security_groups: NetworkSecurityGroups operations
:vartype network_security_groups: .operations.NetworkSecurityGroupsOperations
:ivar security_rules: SecurityRules operations
:vartype security_rules: .operations.SecurityRulesOperations
:ivar load_balancers: LoadBalancers operations
:vartype load_balancers: .operations.LoadBalancersOperations
:ivar virtual_networks: VirtualNetworks operations
:vartype virtual_networks: .operations.VirtualNetworksOperations
:ivar subnets: Subnets operations
:vartype subnets: .operations.SubnetsOperations
:ivar virtual_network_peerings: VirtualNetworkPeerings operations
:vartype virtual_network_peerings: .operations.VirtualNetworkPeeringsOperations
:ivar network_interfaces: NetworkInterfaces operations
:vartype network_interfaces: .operations.NetworkInterfacesOperations
:ivar usages: Usages operations
:vartype usages: .operations.UsagesOperations
:ivar virtual_network_gateways: VirtualNetworkGateways operations
:vartype virtual_network_gateways: .operations.VirtualNetworkGatewaysOperations
:ivar virtual_network_gateway_connections: VirtualNetworkGatewayConnections operations
:vartype virtual_network_gateway_connections: .operations.VirtualNetworkGatewayConnectionsOperations
:ivar local_network_gateways: LocalNetworkGateways operations
:vartype local_network_gateways: .operations.LocalNetworkGatewaysOperations
:ivar express_route_circuit_authorizations: ExpressRouteCircuitAuthorizations operations
:vartype express_route_circuit_authorizations: .operations.ExpressRouteCircuitAuthorizationsOperations
:ivar express_route_circuit_peerings: ExpressRouteCircuitPeerings operations
:vartype express_route_circuit_peerings: .operations.ExpressRouteCircuitPeeringsOperations
:ivar express_route_circuits: ExpressRouteCircuits operations
:vartype express_route_circuits: .operations.ExpressRouteCircuitsOperations
:ivar express_route_service_providers: ExpressRouteServiceProviders operations
:vartype express_route_service_providers: .operations.ExpressRouteServiceProvidersOperations
: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 credentials which uniquely
identify the Microsoft Azure subscription. The subscription ID forms part
of the URI for every service call.
:type subscription_id: str
: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, subscription_id, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None):
self.config = NetworkManagementClientConfiguration(credentials, subscription_id, 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)
self.application_gateways = ApplicationGatewaysOperations(
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.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)
#.........这里部分代码省略.........