本文整理汇总了Python中msrest.Serializer.header方法的典型用法代码示例。如果您正苦于以下问题:Python Serializer.header方法的具体用法?Python Serializer.header怎么用?Python Serializer.header使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msrest.Serializer
的用法示例。
在下文中一共展示了Serializer.header方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AutoRestReportServiceForAzure
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [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: PowerBIEmbeddedManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [as 别名]
class PowerBIEmbeddedManagementClient(SDKClient):
"""Client to manage your Power BI Embedded workspace collections and retrieve workspaces.
:ivar config: Configuration for client.
:vartype config: PowerBIEmbeddedManagementClientConfiguration
:ivar workspace_collections: WorkspaceCollections operations
:vartype workspace_collections: azure.mgmt.powerbiembedded.operations.WorkspaceCollectionsOperations
:ivar workspaces: Workspaces operations
:vartype workspaces: azure.mgmt.powerbiembedded.operations.WorkspacesOperations
: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: Gets subscription credentials which uniquely
identify a 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 = PowerBIEmbeddedManagementClientConfiguration(credentials, subscription_id, base_url)
super(PowerBIEmbeddedManagementClient, 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 = '2016-01-29'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.workspace_collections = WorkspaceCollectionsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.workspaces = WorkspacesOperations(
self._client, self.config, self._serialize, self._deserialize)
def get_available_operations(
self, custom_headers=None, raw=False, **operation_config):
"""Indicates which operations can be performed by the Power BI Resource
Provider.
: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: OperationList or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.powerbiembedded.models.OperationList or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorException<azure.mgmt.powerbiembedded.models.ErrorException>`
"""
# Construct URL
url = self.get_available_operations.metadata['url']
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct 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]:
raise models.ErrorException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OperationList', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get_available_operations.metadata = {'url': '/providers/Microsoft.PowerBI/operations'}
示例3: ManagementGroupsAPI
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [as 别名]
class ManagementGroupsAPI(SDKClient):
"""The Azure Management Groups API enables consolidation of multiple subscriptions/resources into an organizational hierarchy and centrally manage access control, policies, alerting and reporting for those resources.
:ivar config: Configuration for client.
:vartype config: ManagementGroupsAPIConfiguration
:ivar management_groups: ManagementGroups operations
:vartype management_groups: azure.mgmt.managementgroups.operations.ManagementGroupsOperations
:ivar management_group_subscriptions: ManagementGroupSubscriptions operations
:vartype management_group_subscriptions: azure.mgmt.managementgroups.operations.ManagementGroupSubscriptionsOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.managementgroups.operations.Operations
:ivar entities: Entities operations
:vartype entities: azure.mgmt.managementgroups.operations.EntitiesOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param str base_url: Service URL
"""
def __init__(
self, credentials, base_url=None):
self.config = ManagementGroupsAPIConfiguration(credentials, base_url)
super(ManagementGroupsAPI, self).__init__(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2018-03-01-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.management_groups = ManagementGroupsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.management_group_subscriptions = ManagementGroupSubscriptionsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.entities = EntitiesOperations(
self._client, self.config, self._serialize, self._deserialize)
def check_name_availability(
self, check_name_availability_request, custom_headers=None, raw=False, **operation_config):
"""Checks if the specified management group name is valid and unique.
:param check_name_availability_request: Management group name
availability check parameters.
:type check_name_availability_request:
~azure.mgmt.managementgroups.models.CheckNameAvailabilityRequest
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: CheckNameAvailabilityResult or ClientRawResponse if raw=true
:rtype:
~azure.mgmt.managementgroups.models.CheckNameAvailabilityResult or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.managementgroups.models.ErrorResponseException>`
"""
# Construct URL
url = self.check_name_availability.metadata['url']
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(check_name_availability_request, 'CheckNameAvailabilityRequest')
# Construct and send request
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('CheckNameAvailabilityResult', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
check_name_availability.metadata = {'url': '/providers/Microsoft.Management/checkNameAvailability'}
#.........这里部分代码省略.........
示例4: SpellCheckAPI
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [as 别名]
class SpellCheckAPI(object):
"""The Spell Check API - V7 lets you check a text string for spelling and grammar errors.
:ivar config: Configuration for client.
:vartype config: SpellCheckAPIConfiguration
: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 = SpellCheckAPIConfiguration(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'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
def spell_checker(
self, text, accept_language=None, pragma=None, user_agent=None, client_id=None, client_ip=None, location=None, action_type=None, app_name=None, country_code=None, client_machine_name=None, doc_id=None, market=None, session_id=None, set_lang=None, user_id=None, mode=None, pre_context_text=None, post_context_text=None, custom_headers=None, raw=False, **operation_config):
"""The Bing Spell Check API lets you perform contextual grammar and spell
checking. Bing has developed a web-based spell-checker that leverages
machine learning and statistical machine translation to dynamically
train a constantly evolving and highly contextual algorithm. The
spell-checker is based on a massive corpus of web searches and
documents.
:param text: The text string to check for spelling and grammar errors.
The combined length of the text string, preContextText string, and
postContextText string may not exceed 10,000 characters. You may
specify this parameter in the query string of a GET request or in the
body of a POST request. Because of the query string length limit,
you'll typically use a POST request unless you're checking only short
strings.
:type text: str
:param accept_language: A comma-delimited list of one or more
languages to use for user interface strings. The list is in decreasing
order of preference. For additional information, including expected
format, see
[RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
This header and the setLang query parameter are mutually exclusive; do
not specify both. If you set this header, you must also specify the cc
query parameter. Bing will use the first supported language it finds
from the list, and combine that language with the cc parameter value
to determine the market to return results for. If the list does not
include a supported language, Bing will find the closest language and
market that supports the request, and may use an aggregated or default
market for the results instead of a specified one. You should use this
header and the cc query parameter only if you specify multiple
languages; otherwise, you should use the mkt and setLang query
parameters. A user interface string is a string that's used as a label
in a user interface. There are very few user interface strings in the
JSON response objects. Any links in the response objects to Bing.com
properties will apply the specified language.
:type accept_language: str
:param pragma: By default, Bing returns cached content, if available.
To prevent Bing from returning cached content, set the Pragma header
to no-cache (for example, Pragma: no-cache).
:type pragma: str
:param user_agent: The user agent originating the request. Bing uses
the user agent to provide mobile users with an optimized experience.
Although optional, you are strongly encouraged to always specify this
header. The user-agent should be the same string that any commonly
used browser would send. For information about user agents, see [RFC
2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
:type user_agent: str
:param client_id: Bing uses this header to provide users with
consistent behavior across Bing API calls. Bing often flights new
features and improvements, and it uses the client ID as a key for
assigning traffic on different flights. If you do not use the same
client ID for a user across multiple requests, then Bing may assign
the user to multiple conflicting flights. Being assigned to multiple
conflicting flights can lead to an inconsistent user experience. For
example, if the second request has a different flight assignment than
the first, the experience may be unexpected. Also, Bing can use the
client ID to tailor web results to that client ID’s search history,
providing a richer experience for the user. Bing also uses this header
to help improve result rankings by analyzing the activity generated by
a client ID. The relevance improvements help with better quality of
results delivered by Bing APIs and in turn enables higher
click-through rates for the API consumer. IMPORTANT: Although
optional, you should consider this header required. Persisting the
client ID across multiple requests for the same end user and device
combination enables 1) the API consumer to receive a consistent user
experience, and 2) higher click-through rates via better quality of
results from the Bing APIs. Each user that uses your application on
the device must have a unique, Bing generated client ID. If you do not
include this header in the request, Bing generates an ID and returns
it in the X-MSEdge-ClientID response header. The only time that you
should NOT include this header in a request is the first time the user
uses your app on that device. Use the client ID for each Bing API
request that your app makes for this user on the device. Persist the
client ID. To persist the ID in a browser app, use a persistent HTTP
cookie to ensure the ID is used across all sessions. Do not use a
#.........这里部分代码省略.........
示例5: NetworkManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [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
示例6: NetworkManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [as 别名]
class NetworkManagementClient(object):
"""The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resrources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.
:param config: Configuration for client.
:type config: NetworkManagementClientConfiguration
:ivar application_gateways: ApplicationGateways operations
:vartype application_gateways: .operations.ApplicationGatewaysOperations
: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
:ivar load_balancers: LoadBalancers operations
:vartype load_balancers: .operations.LoadBalancersOperations
:ivar local_network_gateways: LocalNetworkGateways operations
:vartype local_network_gateways: .operations.LocalNetworkGatewaysOperations
:ivar network_interfaces: NetworkInterfaces operations
:vartype network_interfaces: .operations.NetworkInterfacesOperations
:ivar network_security_groups: NetworkSecurityGroups operations
:vartype network_security_groups: .operations.NetworkSecurityGroupsOperations
:ivar public_ip_addresses: PublicIPAddresses operations
:vartype public_ip_addresses: .operations.PublicIPAddressesOperations
:ivar route_tables: RouteTables operations
:vartype route_tables: .operations.RouteTablesOperations
:ivar routes: Routes operations
:vartype routes: .operations.RoutesOperations
:ivar security_rules: SecurityRules operations
:vartype security_rules: .operations.SecurityRulesOperations
:ivar subnets: Subnets operations
:vartype subnets: .operations.SubnetsOperations
:ivar usages: Usages operations
:vartype usages: .operations.UsagesOperations
:ivar virtual_network_gateway_connections: VirtualNetworkGatewayConnections operations
:vartype virtual_network_gateway_connections: .operations.VirtualNetworkGatewayConnectionsOperations
:ivar virtual_network_gateways: VirtualNetworkGateways operations
:vartype virtual_network_gateways: .operations.VirtualNetworkGatewaysOperations
:ivar virtual_networks: VirtualNetworks operations
:vartype virtual_networks: .operations.VirtualNetworksOperations
"""
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
self.application_gateways = ApplicationGatewaysOperations(
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)
self.load_balancers = LoadBalancersOperations(
self._client, self.config, self._serialize, self._deserialize)
self.local_network_gateways = LocalNetworkGatewaysOperations(
self._client, self.config, self._serialize, self._deserialize)
self.network_interfaces = NetworkInterfacesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.network_security_groups = NetworkSecurityGroupsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.public_ip_addresses = PublicIPAddressesOperations(
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.security_rules = SecurityRulesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.subnets = SubnetsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.usages = UsagesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_network_gateway_connections = VirtualNetworkGatewayConnectionsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_network_gateways = VirtualNetworkGatewaysOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_networks = VirtualNetworksOperations(
self._client, self.config, self._serialize, self._deserialize)
def check_dns_name_availability(
self, location, domain_name_label=None, custom_headers={}, 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:
#.........这里部分代码省略.........
示例7: ResourceGraphClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [as 别名]
class ResourceGraphClient(SDKClient):
"""Azure Resource Graph API Reference
:ivar config: Configuration for client.
:vartype config: ResourceGraphClientConfiguration
:ivar operations: Operations operations
:vartype operations: azure.mgmt.resourcegraph.operations.Operations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param str base_url: Service URL
"""
def __init__(
self, credentials, base_url=None):
self.config = ResourceGraphClientConfiguration(credentials, base_url)
super(ResourceGraphClient, self).__init__(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2018-09-01-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
def resources(
self, query, custom_headers=None, raw=False, **operation_config):
"""Queries the resources managed by Azure Resource Manager for all
subscriptions specified in the request.
:param query: Request specifying query and its options.
:type query: ~azure.mgmt.resourcegraph.models.QueryRequest
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: QueryResponse or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.resourcegraph.models.QueryResponse or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.resourcegraph.models.ErrorResponseException>`
"""
# Construct URL
url = self.resources.metadata['url']
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(query, 'QueryRequest')
# Construct and send request
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('QueryResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
resources.metadata = {'url': '/providers/Microsoft.ResourceGraph/resources'}
示例8: LogicManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [as 别名]
class LogicManagementClient(object):
"""REST API for Azure Logic Apps.
:ivar config: Configuration for client.
:vartype config: LogicManagementClientConfiguration
:ivar workflows: Workflows operations
:vartype workflows: .operations.WorkflowsOperations
:ivar workflow_versions: WorkflowVersions operations
:vartype workflow_versions: .operations.WorkflowVersionsOperations
:ivar workflow_triggers: WorkflowTriggers operations
:vartype workflow_triggers: .operations.WorkflowTriggersOperations
:ivar workflow_trigger_histories: WorkflowTriggerHistories operations
:vartype workflow_trigger_histories: .operations.WorkflowTriggerHistoriesOperations
:ivar workflow_runs: WorkflowRuns operations
:vartype workflow_runs: .operations.WorkflowRunsOperations
:ivar workflow_run_actions: WorkflowRunActions operations
:vartype workflow_run_actions: .operations.WorkflowRunActionsOperations
:ivar integration_accounts: IntegrationAccounts operations
:vartype integration_accounts: .operations.IntegrationAccountsOperations
:ivar schemas: Schemas operations
:vartype schemas: .operations.SchemasOperations
:ivar maps: Maps operations
:vartype maps: .operations.MapsOperations
:ivar partners: Partners operations
:vartype partners: .operations.PartnersOperations
:ivar agreements: Agreements operations
:vartype agreements: .operations.AgreementsOperations
:ivar certificates: Certificates operations
:vartype certificates: .operations.CertificatesOperations
:ivar sessions: Sessions operations
:vartype sessions: .operations.SessionsOperations
: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.
: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
#.........这里部分代码省略.........
示例9: SqlManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [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
示例10: AzureReservationAPI
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [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.
#.........这里部分代码省略.........
示例11: WebSiteManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [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: AzureNetAppFilesManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [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')
#.........这里部分代码省略.........
示例13: IntuneResourceManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [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
#.........这里部分代码省略.........
示例14: NetworkManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [as 别名]
#.........这里部分代码省略.........
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_taps = VirtualNetworkTapsOperations(
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.virtual_wans = VirtualWansOperations(
self._client, self.config, self._serialize, self._deserialize)
self.vpn_sites = VpnSitesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.vpn_sites_configuration = VpnSitesConfigurationOperations(
self._client, self.config, self._serialize, self._deserialize)
self.virtual_hubs = VirtualHubsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.hub_virtual_network_connections = HubVirtualNetworkConnectionsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.vpn_gateways = VpnGatewaysOperations(
self._client, self.config, self._serialize, self._deserialize)
self.vpn_connections = VpnConnectionsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.p2s_vpn_server_configurations = P2sVpnServerConfigurationsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.p2s_vpn_gateways = P2sVpnGatewaysOperations(
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.v2018_08_01.models.DnsNameAvailabilityResult or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
api_version = "2018-08-01"
# Construct URL
url = self.check_dns_name_availability.metadata['url']
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 = {}
示例15: CdnManagementClient
# 需要导入模块: from msrest import Serializer [as 别名]
# 或者: from msrest.Serializer import header [as 别名]
class CdnManagementClient(object):
"""Use these APIs to manage Azure CDN resources through the Azure Resource Manager. You must make sure that requests made to these resources are secure.
:ivar config: Configuration for client.
:vartype config: CdnManagementClientConfiguration
:ivar profiles: Profiles operations
:vartype profiles: .operations.ProfilesOperations
:ivar endpoints: Endpoints operations
:vartype endpoints: .operations.EndpointsOperations
:ivar origins: Origins operations
:vartype origins: .operations.OriginsOperations
:ivar custom_domains: CustomDomains operations
:vartype custom_domains: .operations.CustomDomainsOperations
:ivar edge_nodes: EdgeNodes operations
:vartype edge_nodes: .operations.EdgeNodesOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param api_version: Version of the API to be used with the client request.
Current version is 2016-10-02.
: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,
subscription_id,
api_version="2016-10-02",
accept_language="en-US",
long_running_operation_retry_timeout=30,
generate_client_request_id=True,
base_url=None,
filepath=None,
):
self.config = CdnManagementClientConfiguration(
credentials,
subscription_id,
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.profiles = ProfilesOperations(self._client, self.config, self._serialize, self._deserialize)
self.endpoints = EndpointsOperations(self._client, self.config, self._serialize, self._deserialize)
self.origins = OriginsOperations(self._client, self.config, self._serialize, self._deserialize)
self.custom_domains = CustomDomainsOperations(self._client, self.config, self._serialize, self._deserialize)
self.edge_nodes = EdgeNodesOperations(self._client, self.config, self._serialize, self._deserialize)
def check_name_availability(self, name, custom_headers=None, raw=False, **operation_config):
"""Check the availability of a resource name. This is needed for resources
where name is globally unique, such as a CDN endpoint.
:param name: The resource name to validate.
:type name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: :class:`CheckNameAvailabilityOutput
<azure.mgmt.cdn.models.CheckNameAvailabilityOutput>`
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
:raises:
:class:`ErrorResponseException<azure.mgmt.cdn.models.ErrorResponseException>`
"""
check_name_availability_input = models.CheckNameAvailabilityInput(name=name)
# Construct URL
url = "/providers/Microsoft.Cdn/checkNameAvailability"
# Construct parameters
query_parameters = {}
query_parameters["api-version"] = self._serialize.query(
"self.config.api_version", self.config.api_version, "str"
#.........这里部分代码省略.........