本文整理汇总了Python中msrest.service_client.ServiceClient类的典型用法代码示例。如果您正苦于以下问题:Python ServiceClient类的具体用法?Python ServiceClient怎么用?Python ServiceClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ServiceClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AutoRestReportService
class AutoRestReportService(object):
"""Test Infrastructure for AutoRest
:param config: Configuration for client.
:type config: AutoRestReportServiceConfiguration
"""
def __init__(self, config):
self._client = ServiceClient(None, config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer()
self._deserialize = Deserializer(client_models)
self.config = config
def get_report(
self, custom_headers={}, raw=False, **operation_config):
"""
Get test coverage report
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: dict
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/report'
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [200]:
raise models.ErrorException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('{int}', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
示例2: AutoRestReportServiceForAzure
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
示例3: __init__
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)
示例4: __init__
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)
示例5: __init__
def __init__(
self, credentials, subscription_id, base_url=None):
self.config = CdnManagementClientConfiguration(credentials, subscription_id, base_url)
self._client = ServiceClient(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2017-04-02'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.profiles = ProfilesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.endpoints = EndpointsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.origins = OriginsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.custom_domains = CustomDomainsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.resource_usage = ResourceUsageOperations(
self._client, self.config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.edge_nodes = EdgeNodesOperations(
self._client, self.config, self._serialize, self._deserialize)
示例6: __init__
def __init__(
self, credentials, subscription_id, base_url=None):
self.config = NetworkManagementClientConfiguration(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-12-01'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.network_interfaces = NetworkInterfacesOperations(
self._client, self.config, self._serialize, self._deserialize)
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.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.network_watchers = NetworkWatchersOperations(
self._client, self.config, self._serialize, self._deserialize)
self.packet_captures = PacketCapturesOperations(
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)
示例7: __init__
def __init__(self, base_url=None, filepath=None):
self.config = AutoRestReportServiceConfiguration(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)
示例8: __init__
def __init__(self, subscription_id, api_version, base_url=None, filepath=None):
self.config = AutoRestValidationTestConfiguration(subscription_id, api_version, 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)
示例9: __init__
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
示例10: __init__
def __init__(
self, credentials, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None):
self.config = AutoRestResourceFlatteningTestServiceConfiguration(credentials, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath)
self._client = ServiceClient(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
示例11: __init__
def __init__(
self, base_url=None):
self.config = AutoRestResourceFlatteningTestServiceConfiguration(base_url)
self._client = ServiceClient(None, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '1.0.0'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
示例12: __init__
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)
示例13: __init__
def __init__(
self, credentials):
self.config = EventGridClientConfiguration(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 = '2018-01-01'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
示例14: __init__
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)
示例15: __init__
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)