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
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
def __init__( self, credentials, subscription_id, base_url=None): self.config = CdnManagementClientConfiguration(credentials, subscription_id, base_url) self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self.api_version = '2017-04-02' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.profiles = ProfilesOperations( self._client, self.config, self._serialize, self._deserialize) self.endpoints = EndpointsOperations( self._client, self.config, self._serialize, self._deserialize) self.origins = OriginsOperations( self._client, self.config, self._serialize, self._deserialize) self.custom_domains = CustomDomainsOperations( self._client, self.config, self._serialize, self._deserialize) self.resource_usage = ResourceUsageOperations( self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) self.edge_nodes = EdgeNodesOperations( self._client, self.config, self._serialize, self._deserialize)
def __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 __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 __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)
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)
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)
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 __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)
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)
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 __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 __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)
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 __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 __init__( self, credentials, subscription_id, api_version='2016-01-29', accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): self.config = PowerBIEmbeddedManagementClientConfiguration(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.workspace_collections = WorkspaceCollectionsOperations( self._client, self.config, self._serialize, self._deserialize) self.workspaces = WorkspacesOperations( self._client, self.config, self._serialize, self._deserialize)
def __init__( self, credentials, subscription_id, base_url=None): self.config = ContainerRegistryManagementClientConfiguration(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-03-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.registries = RegistriesOperations( self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize)
def __init__( self, base_url=None): self.config = AutoRestSwaggerBATServiceConfiguration(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) self.string = StringOperations( self._client, self.config, self._serialize, self._deserialize) self.enum = EnumOperations( self._client, self.config, self._serialize, self._deserialize)
def __init__(self, credentials, base_url=None): self.config = AutoRestDurationTestServiceConfiguration( 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._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.duration = DurationOperations(self._client, self.config, self._serialize, self._deserialize)
def __init__(self, subscription_id, dns_suffix): self.config = AutoRestParameterizedCustomHostTestClientConfiguration( subscription_id, dns_suffix) 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) self.paths = PathsOperations(self._client, self.config, self._serialize, self._deserialize)
def __init__(self, base_url=None, filepath=None): self.config = AutoRestIntegerTestServiceConfiguration( 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) self.int_model = IntModelOperations(self._client, self.config, self._serialize, self._deserialize)
def __init__(self, base_url=None): self.config = AutoRestParameterFlatteningConfiguration(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) self.availability_sets = AvailabilitySetsOperations( self._client, self.config, self._serialize, self._deserialize)
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 self.datetimerfc1123 = Datetimerfc1123(self._client, self.config, self._serialize, self._deserialize)
def __init__(self, base_url=None, filepath=None): self.config = AutoRestSwaggerBATByteServiceConfiguration( 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) self.byte = Byte(self._client, self.config, self._serialize, self._deserialize)
def run_example(): credentials = get_credentials() config = AzureConfiguration('https://management.azure.com') service_client = ServiceClient(credentials, config) query_parameters = {} query_parameters['api-version'] = API_VERSION header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) operation_config = {} request = service_client.put( "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.Storage/storageAccounts/" + STORAGE_ACCOUNT_NAME, query_parameters) response = service_client.send(request, header_parameters, BODY, **operation_config) if response.status_code == 202: response = wait_poller(service_client, operation_config, response) print(response.text)
def __init__(self, credentials, base_url=None): self.config = EntitySearchAPIConfiguration(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) self.entities = EntitiesOperations(self._client, self.config, self._serialize, self._deserialize)
def __init__(self, credentials, base_url=None): self.config = AutoRestHeadExceptionTestServiceConfiguration( credentials, base_url) self._client = ServiceClient(self.config.credentials, self.config) client_models = {} self.api_version = '1.0.0' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.head_exception = HeadExceptionOperations(self._client, self.config, self._serialize, self._deserialize)
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.databases = DatabasesOperations(self._client, self.config, self._serialize, self._deserialize) self.recoverable_databases = RecoverableDatabasesOperations( self._client, self.config, self._serialize, self._deserialize) self.restorable_dropped_databases = RestorableDroppedDatabasesOperations( self._client, self.config, self._serialize, self._deserialize) self.capabilities = CapabilitiesOperations(self._client, self.config, self._serialize, self._deserialize) self.servers = ServersOperations(self._client, self.config, self._serialize, self._deserialize) self.firewall_rules = FirewallRulesOperations(self._client, self.config, self._serialize, self._deserialize) self.elastic_pools = ElasticPoolsOperations(self._client, self.config, self._serialize, self._deserialize) self.operations = Operations(self._client, self.config, self._serialize, self._deserialize) self.recommended_elastic_pools = RecommendedElasticPoolsOperations( self._client, self.config, self._serialize, self._deserialize) self.server_azure_ad_administrators = ServerAzureADAdministratorsOperations( self._client, self.config, self._serialize, self._deserialize) self.server_communication_links = ServerCommunicationLinksOperations( self._client, self.config, self._serialize, self._deserialize) self.failover_groups = FailoverGroupsOperations( self._client, self.config, self._serialize, self._deserialize) self.virtual_network_rules = VirtualNetworkRulesOperations( self._client, self.config, self._serialize, self._deserialize) self.server_keys = ServerKeysOperations(self._client, self.config, self._serialize, self._deserialize)
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 = LogicManagementClientConfiguration( 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.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.integration_account_schemas = IntegrationAccountSchemasOperations( self._client, self.config, self._serialize, self._deserialize) self.integration_account_maps = IntegrationAccountMapsOperations( self._client, self.config, self._serialize, self._deserialize) self.integration_account_partners = IntegrationAccountPartnersOperations( self._client, self.config, self._serialize, self._deserialize) self.integration_account_agreements = IntegrationAccountAgreementsOperations( self._client, self.config, self._serialize, self._deserialize) self.integration_account_certificates = IntegrationAccountCertificatesOperations( self._client, self.config, self._serialize, self._deserialize)
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) self.virtual_network_gateways = VirtualNetworkGatewaysOperations( self._client, self.config, self._serialize, self._deserialize) self.virtual_network_gateway_connections = VirtualNetworkGatewayConnectionsOperations( self._client, self.config, self._serialize, self._deserialize) self.local_network_gateways = LocalNetworkGatewaysOperations( self._client, self.config, self._serialize, self._deserialize) self.express_route_circuit_authorizations = ExpressRouteCircuitAuthorizationsOperations( self._client, self.config, self._serialize, self._deserialize) self.express_route_circuit_peerings = ExpressRouteCircuitPeeringsOperations( self._client, self.config, self._serialize, self._deserialize) self.express_route_circuits = ExpressRouteCircuitsOperations( self._client, self.config, self._serialize, self._deserialize) self.express_route_service_providers = ExpressRouteServiceProvidersOperations( self._client, self.config, self._serialize, self._deserialize)
def __init__(self, credentials, subscription_id, base_url=None): self.config = ComputeManagementClientConfiguration( 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-03-30' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.availability_sets = AvailabilitySetsOperations( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_extensions = VirtualMachineExtensionsOperations( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_images = VirtualMachineImagesOperations( self._client, self.config, self._serialize, self._deserialize) self.usage = UsageOperations(self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_sizes = VirtualMachineSizesOperations( self._client, self.config, self._serialize, self._deserialize) self.images = ImagesOperations(self._client, self.config, self._serialize, self._deserialize) self.resource_skus = ResourceSkusOperations(self._client, self.config, self._serialize, self._deserialize) self.virtual_machines = VirtualMachinesOperations( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_scale_set_extensions = VirtualMachineScaleSetExtensionsOperations( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_scale_set_rolling_upgrades = VirtualMachineScaleSetRollingUpgradesOperations( self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( self._client, self.config, self._serialize, self._deserialize) self.disks = DisksOperations(self._client, self.config, self._serialize, self._deserialize) self.snapshots = SnapshotsOperations(self._client, self.config, self._serialize, self._deserialize) self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( self._client, self.config, self._serialize, self._deserialize)
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.job_collections = JobCollectionsOperations( self._client, self.config, self._serialize, self._deserialize) self.jobs = JobsOperations(self._client, self.config, self._serialize, self._deserialize)
def __init__( self, credentials, subscription_id, api_version='2015-12-01', accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): self.config = BatchManagementClientConfiguration(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.account = AccountOperations( self._client, self.config, self._serialize, self._deserialize) self.application = ApplicationOperations( self._client, self.config, self._serialize, self._deserialize) self.subscription = SubscriptionOperations( self._client, self.config, self._serialize, self._deserialize)
def __init__(self, base_url=None): self.config = AutoRestSwaggerBATdictionaryServiceConfiguration( base_url) 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) self.dictionary = DictionaryOperations(self._client, self.config, self._serialize, self._deserialize)
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.storage_accounts = StorageAccountsOperations( self._client, self.config, self._serialize, self._deserialize) self.usage = UsageOperations(self._client, self.config, self._serialize, self._deserialize)
def __init__(self, credentials, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default): super(ComputeManagementClient, self).__init__(credentials=credentials, subscription_id=subscription_id, api_version=api_version, base_url=base_url, profile=profile) self.config = ComputeManagementClientConfiguration( credentials, subscription_id, base_url) self._client = ServiceClient(self.config.credentials, self.config)
def __init__(self, base_url=None, filepath=None): self.config = AutoRestRFC1123DateTimeTestServiceConfiguration( 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) self.datetimerfc1123 = Datetimerfc1123(self._client, self.config, self._serialize, self._deserialize)
def __init__(self, credentials, adla_catalog_dns_suffix): self.config = DataLakeAnalyticsCatalogManagementClientConfiguration( credentials, adla_catalog_dns_suffix) 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-11-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.catalog = CatalogOperations(self._client, self.config, self._serialize, self._deserialize)
def __init__(self, base_url=None): self.config = AutoRestDateTimeTestServiceConfiguration(base_url) 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) self.datetime_model = DatetimeModelOperations(self._client, self.config, self._serialize, self._deserialize)
def __init__(self, credentials, host): self.config = AutoRestParameterizedHostTestClientConfiguration( credentials, host) self._client = ServiceClient(self.config.credentials, self.config) client_models = { k: v for k, v in models.__dict__.items() if isinstance(v, type) } self.api_version = '1.0.0' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.paths = PathsOperations(self._client, self.config, self._serialize, self._deserialize)
def __init__(self, credentials, subscription_id, base_url=None): self.config = MicrosoftAzureTestUrlConfiguration( 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 = '2014-04-01-preview' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.group = GroupOperations(self._client, self.config, self._serialize, self._deserialize)
def __init__( self, global_string_path, global_string_query=None, base_url=None, filepath=None): self.config = AutoRestUrlTestServiceConfiguration(global_string_path, global_string_query, 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) self.paths = Paths( self._client, self.config, self._serialize, self._deserialize) self.queries = Queries( self._client, self.config, self._serialize, self._deserialize) self.path_items = PathItems( self._client, self.config, self._serialize, self._deserialize)
def __init__( self, credentials, subscription_id, api_version='2016-11-01', base_url=None): self.config = DataLakeStoreAccountManagementClientConfiguration(credentials, subscription_id, api_version, 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.firewall_rules = FirewallRulesOperations( self._client, self.config, self._serialize, self._deserialize) self.trusted_id_providers = TrustedIdProvidersOperations( self._client, self.config, self._serialize, self._deserialize) self.account = AccountOperations( self._client, self.config, self._serialize, self._deserialize)
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 self.string = String(self._client, self.config, self._serialize, self._deserialize) self.enum = Enum(self._client, self.config, self._serialize, self._deserialize)
def __init__(self, credentials, base_url=None): self.config = AutoRestParameterGroupingTestServiceConfiguration( credentials, base_url) self._client = ServiceClient(self.config.credentials, self.config) client_models = { k: v for k, v in models.__dict__.items() if isinstance(v, type) } self.api_version = '1.0.0' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.parameter_grouping = ParameterGroupingOperations( self._client, self.config, self._serialize, self._deserialize)
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 self.implicit = Implicit(self._client, self.config, self._serialize, self._deserialize) self.explicit = Explicit(self._client, self.config, self._serialize, self._deserialize)
def __init__(self, credentials, subscription_id, base_url=None): self.config = ManagementLockClientConfiguration( 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-09-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.management_locks = ManagementLocksOperations( self._client, self.config, self._serialize, self._deserialize)
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 __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 __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 __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)
class AutoRestResourceFlatteningTestService(object): """Resource Flattening for AutoRest :ivar config: Configuration for client. :vartype config: AutoRestResourceFlatteningTestServiceConfiguration :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials object<msrestazure.azure_active_directory>` :param accept_language: Gets or sets the preferred language for the response. :type accept_language: str :param long_running_operation_retry_timeout: Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. :type long_running_operation_retry_timeout: int :param generate_client_request_id: When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. :type generate_client_request_id: bool :param str base_url: Service URL :param str filepath: Existing config """ def __init__( self, credentials, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): self.config = 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) def put_array( self, resource_array=None, custom_headers=None, 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.acceptancetestsazureresource.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 :raises: :class:`ErrorException<fixtures.acceptancetestsazureresource.models.ErrorException>` """ # Construct URL url = '/azure/resource-flatten/array' # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body if resource_array is not None: body_content = self._serialize.body(resource_array, '[Resource]') else: body_content = None # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( request, header_parameters, body_content, **operation_config) if response.status_code not in [200]: raise models.ErrorException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response def get_array( self, custom_headers=None, 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.acceptancetestsazureresource.models.FlattenedProduct>` :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true :raises: :class:`ErrorException<fixtures.acceptancetestsazureresource.models.ErrorException>` """ # Construct URL url = '/azure/resource-flatten/array' # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send(request, header_parameters, **operation_config) if response.status_code not in [200]: raise models.ErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('[FlattenedProduct]', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def put_dictionary( self, resource_dictionary=None, custom_headers=None, raw=False, **operation_config): """Put External Resource as a Dictionary. :param resource_dictionary: External Resource as a Dictionary to put :type resource_dictionary: dict :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 :raises: :class:`ErrorException<fixtures.acceptancetestsazureresource.models.ErrorException>` """ # Construct URL url = '/azure/resource-flatten/dictionary' # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body if resource_dictionary is not None: body_content = self._serialize.body(resource_dictionary, '{FlattenedProduct}') 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_dictionary( self, custom_headers=None, raw=False, **operation_config): """Get External Resource as a Dictionary. :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 :raises: :class:`ErrorException<fixtures.acceptancetestsazureresource.models.ErrorException>` """ # Construct URL url = '/azure/resource-flatten/dictionary' # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send(request, header_parameters, **operation_config) if response.status_code not in [200]: raise models.ErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('{FlattenedProduct}', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def put_resource_collection( self, resource_complex_object=None, custom_headers=None, raw=False, **operation_config): """Put External Resource as a ResourceCollection. :param resource_complex_object: External Resource as a ResourceCollection to put :type resource_complex_object: :class:`ResourceCollection <fixtures.acceptancetestsazureresource.models.ResourceCollection>` :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 :raises: :class:`ErrorException<fixtures.acceptancetestsazureresource.models.ErrorException>` """ # Construct URL url = '/azure/resource-flatten/resourcecollection' # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body if resource_complex_object is not None: body_content = self._serialize.body(resource_complex_object, 'ResourceCollection') 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_resource_collection( self, custom_headers=None, raw=False, **operation_config): """Get External Resource as a ResourceCollection. :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:`ResourceCollection <fixtures.acceptancetestsazureresource.models.ResourceCollection>` :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true :raises: :class:`ErrorException<fixtures.acceptancetestsazureresource.models.ErrorException>` """ # Construct URL url = '/azure/resource-flatten/resourcecollection' # 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('ResourceCollection', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized
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 session cookie. For other apps such as mobile apps, use the device's persistent storage to persist the ID. The next time the user uses your app on that device, get the client ID that you persisted. Bing responses may or may not include this header. If the response includes this header, capture the client ID and use it for all subsequent Bing requests for the user on that device. If you include the X-MSEdge-ClientID, you must not include cookies in the request. :type client_id: str :param client_ip: The IPv4 or IPv6 address of the client device. The IP address is used to discover the user's location. Bing uses the location information to determine safe search behavior. Although optional, you are encouraged to always specify this header and the X-Search-Location header. Do not obfuscate the address (for example, by changing the last octet to 0). Obfuscating the address results in the location not being anywhere near the device's actual location, which may result in Bing serving erroneous results. :type client_ip: str :param location: A semicolon-delimited list of key/value pairs that describe the client's geographical location. Bing uses the location information to determine safe search behavior and to return relevant local content. Specify the key/value pair as <key>:<value>. The following are the keys that you use to specify the user's location. lat (required): The latitude of the client's location, in degrees. The latitude must be greater than or equal to -90.0 and less than or equal to +90.0. Negative values indicate southern latitudes and positive values indicate northern latitudes. long (required): The longitude of the client's location, in degrees. The longitude must be greater than or equal to -180.0 and less than or equal to +180.0. Negative values indicate western longitudes and positive values indicate eastern longitudes. re (required): The radius, in meters, which specifies the horizontal accuracy of the coordinates. Pass the value returned by the device's location service. Typical values might be 22m for GPS/Wi-Fi, 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts (optional): The UTC UNIX timestamp of when the client was at the location. (The UNIX timestamp is the number of seconds since January 1, 1970.) head (optional): The client's relative heading or direction of travel. Specify the direction of travel as degrees from 0 through 360, counting clockwise relative to true north. Specify this key only if the sp key is nonzero. sp (optional): The horizontal velocity (speed), in meters per second, that the client device is traveling. alt (optional): The altitude of the client device, in meters. are (optional): The radius, in meters, that specifies the vertical accuracy of the coordinates. Specify this key only if you specify the alt key. Although many of the keys are optional, the more information that you provide, the more accurate the location results are. Although optional, you are encouraged to always specify the user's geographical location. Providing the location is especially important if the client's IP address does not accurately reflect the user's physical location (for example, if the client uses VPN). For optimal results, you should include this header and the X-Search-ClientIP header, but at a minimum, you should include this header. :type location: str :param action_type: A string that's used by logging to determine whether the request is coming from an interactive session or a page load. The following are the possible values. 1) Edit—The request is from an interactive session 2) Load—The request is from a page load. Possible values include: 'Edit', 'Load' :type action_type: str or ~azure.cognitiveservices.language.spellcheck.models.ActionType :param app_name: The unique name of your app. The name must be known by Bing. Do not include this parameter unless you have previously contacted Bing to get a unique app name. To get a unique name, contact your Bing Business Development manager. :type app_name: str :param country_code: A 2-character country code of the country where the results come from. This API supports only the United States market. If you specify this query parameter, it must be set to us. If you set this parameter, you must also specify the Accept-Language header. Bing uses the first supported language it finds from the languages list, and combine that language with the country code that you specify to determine the market to return results for. If the languages list does not include a supported language, Bing finds the closest language and market that supports the request, or it may use an aggregated or default market for the results instead of a specified one. You should use this query parameter and the Accept-Language query parameter only if you specify multiple languages; otherwise, you should use the mkt and setLang query parameters. This parameter and the mkt query parameter are mutually exclusive—do not specify both. :type country_code: str :param client_machine_name: A unique name of the device that the request is being made from. Generate a unique value for each device (the value is unimportant). The service uses the ID to help debug issues and improve the quality of corrections. :type client_machine_name: str :param doc_id: A unique ID that identifies the document that the text belongs to. Generate a unique value for each document (the value is unimportant). The service uses the ID to help debug issues and improve the quality of corrections. :type doc_id: str :param market: The market where the results come from. You are strongly encouraged to always specify the market, if known. Specifying the market helps Bing route the request and return an appropriate and optimal response. This parameter and the cc query parameter are mutually exclusive—do not specify both. :type market: str :param session_id: A unique ID that identifies this user session. Generate a unique value for each user session (the value is unimportant). The service uses the ID to help debug issues and improve the quality of corrections :type session_id: str :param set_lang: The language to use for user interface strings. Specify the language using the ISO 639-1 2-letter language code. For example, the language code for English is EN. The default is EN (English). Although optional, you should always specify the language. Typically, you set setLang to the same language specified by mkt unless the user wants the user interface strings displayed in a different language. This parameter and the Accept-Language header are mutually exclusive—do not specify both. A user interface string is a string that's used as a label in a user interface. There are few user interface strings in the JSON response objects. Also, any links to Bing.com properties in the response objects apply the specified language. :type set_lang: str :param user_id: A unique ID that identifies the user. Generate a unique value for each user (the value is unimportant). The service uses the ID to help debug issues and improve the quality of corrections. :type user_id: str :param mode: The type of spelling and grammar checks to perform. The following are the possible values (the values are case insensitive). The default is Proof. 1) Proof—Finds most spelling and grammar mistakes. 2) Spell—Finds most spelling mistakes but does not find some of the grammar errors that Proof catches (for example, capitalization and repeated words). Possible values include: 'Proof', 'Spell' :type mode: str :param pre_context_text: A string that gives context to the text string. For example, the text string petal is valid. However, if you set preContextText to bike, the context changes and the text string becomes not valid. In this case, the API suggests that you change petal to pedal (as in bike pedal). This text is not checked for grammar or spelling 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. :type pre_context_text: str :param post_context_text: A string that gives context to the text string. For example, the text string read is valid. However, if you set postContextText to carpet, the context changes and the text string becomes not valid. In this case, the API suggests that you change read to red (as in red carpet). This text is not checked for grammar or spelling 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. :type post_context_text: 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: SpellCheck or ClientRawResponse if raw=true :rtype: ~azure.cognitiveservices.language.spellcheck.models.SpellCheck or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException<azure.cognitiveservices.language.spellcheck.models.ErrorResponseException>` """ x_bing_apis_sdk = "true" # Construct URL url = '/spellcheck' # Construct parameters query_parameters = {} if action_type is not None: query_parameters['ActionType'] = self._serialize.query("action_type", action_type, 'str') if app_name is not None: query_parameters['AppName'] = self._serialize.query("app_name", app_name, 'str') if country_code is not None: query_parameters['cc'] = self._serialize.query("country_code", country_code, 'str') if client_machine_name is not None: query_parameters['ClientMachineName'] = self._serialize.query("client_machine_name", client_machine_name, 'str') if doc_id is not None: query_parameters['DocId'] = self._serialize.query("doc_id", doc_id, 'str') if market is not None: query_parameters['mkt'] = self._serialize.query("market", market, 'str') if session_id is not None: query_parameters['SessionId'] = self._serialize.query("session_id", session_id, 'str') if set_lang is not None: query_parameters['SetLang'] = self._serialize.query("set_lang", set_lang, 'str') if user_id is not None: query_parameters['UserId'] = self._serialize.query("user_id", user_id, 'str') # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/x-www-form-urlencoded' if custom_headers: header_parameters.update(custom_headers) header_parameters['X-BingApis-SDK'] = self._serialize.header("x_bing_apis_sdk", x_bing_apis_sdk, 'str') if accept_language is not None: header_parameters['Accept-Language'] = self._serialize.header("accept_language", accept_language, 'str') if pragma is not None: header_parameters['Pragma'] = self._serialize.header("pragma", pragma, 'str') if user_agent is not None: header_parameters['User-Agent'] = self._serialize.header("user_agent", user_agent, 'str') if client_id is not None: header_parameters['X-MSEdge-ClientID'] = self._serialize.header("client_id", client_id, 'str') if client_ip is not None: header_parameters['X-MSEdge-ClientIP'] = self._serialize.header("client_ip", client_ip, 'str') if location is not None: header_parameters['X-Search-Location'] = self._serialize.header("location", location, 'str') # Construct form data form_data_content = { 'Text': text, 'Mode': mode, 'PreContextText': pre_context_text, 'PostContextText': post_context_text, } # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send_formdata( request, header_parameters, form_data_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('SpellCheck', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized
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') 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 update_pet( self, body=None, custom_headers=None, raw=False, **operation_config): """Update an existing pet. :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') 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 [405, 404, 400]: raise HttpOperationError(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response def find_pets_by_status( self, status=None, custom_headers=None, raw=False, **operation_config): """Finds Pets by status. Multiple status values can be provided with comma seperated strings. :param status: Status values that need to be considered for filter :type status: list of 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: list of :class:`Pet <Petstore.models.Pet>` :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/pet/findByStatus' # Construct parameters query_parameters = {} if status is not None: query_parameters['status'] = self._serialize.query("status", status, '[str]', div=',') # 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, 400]: raise HttpOperationError(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('[Pet]', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def find_pets_by_tags( self, tags=None, custom_headers=None, raw=False, **operation_config): """Finds Pets by tags. Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. :param tags: Tags to filter by :type tags: list of 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: list of :class:`Pet <Petstore.models.Pet>` :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/pet/findByTags' # Construct parameters query_parameters = {} if tags is not None: query_parameters['tags'] = self._serialize.query("tags", tags, '[str]', div=',') # 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, 400]: raise HttpOperationError(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('[Pet]', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def find_pets_with_byte_array( self, pet_id, custom_headers=None, raw=False, **operation_config): """Fake endpoint to test byte array return by 'Find pet by ID'. Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions. :param pet_id: ID of pet that needs to be fetched :type pet_id: long :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: str :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/pet/{petId}' path_format_arguments = { 'petId': self._serialize.url("pet_id", pet_id, 'long') } 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 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 [404, 200, 400]: raise HttpOperationError(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def get_pet_by_id( self, pet_id, custom_headers=None, raw=False, **operation_config): """Find pet by ID. Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions. :param pet_id: ID of pet that needs to be fetched :type pet_id: long :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:`Pet <Petstore.models.Pet>` :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/pet/{petId}' path_format_arguments = { 'petId': self._serialize.url("pet_id", pet_id, 'long') } 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 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 [404, 200, 400]: raise HttpOperationError(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('Pet', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def update_pet_with_form( self, pet_id, name=None, status=None, custom_headers=None, raw=False, **operation_config): """Updates a pet in the store with form data. :param pet_id: ID of pet that needs to be updated :type pet_id: str :param name: Updated name of the pet :type name: str :param status: Updated status of the pet :type status: 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/{petId}' path_format_arguments = { 'petId': self._serialize.url("pet_id", pet_id, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/x-www-form-urlencoded' if custom_headers: header_parameters.update(custom_headers) # Construct form data form_data_content = { 'name': name, 'status': status, } # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send_formdata( request, header_parameters, form_data_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 delete_pet( self, pet_id, api_key=None, custom_headers=None, raw=False, **operation_config): """Deletes a pet. :param pet_id: Pet id to delete :type pet_id: long :param api_key: :type api_key: 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/{petId}' path_format_arguments = { 'petId': self._serialize.url("pet_id", pet_id, 'long') } 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) if api_key is not None: header_parameters['api_key'] = self._serialize.header("api_key", api_key, 'str') # Construct and send request request = self._client.delete(url, query_parameters) response = self._client.send(request, header_parameters, **operation_config) if response.status_code not in [400]: raise HttpOperationError(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response def upload_file( self, pet_id, additional_metadata=None, file=None, custom_headers=None, raw=False, **operation_config): """uploads an image. :param pet_id: ID of pet to update :type pet_id: long :param additional_metadata: Additional data to pass to server :type additional_metadata: str :param file: file to upload :type file: Generator :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/{petId}/uploadImage' path_format_arguments = { 'petId': self._serialize.url("pet_id", pet_id, 'long') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'multipart/form-data' if custom_headers: header_parameters.update(custom_headers) # Construct form data form_data_content = { 'additionalMetadata': additional_metadata, 'file': file, } # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send_formdata( request, header_parameters, form_data_content, **operation_config) if response.status_code < 200 or response.status_code >= 300: raise HttpOperationError(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response def get_inventory( self, custom_headers=None, raw=False, **operation_config): """Returns pet inventories by status. Returns a map of status codes to quantities. :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 = '/store/inventory' # 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 HttpOperationError(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 def place_order( self, body=None, custom_headers=None, raw=False, **operation_config): """Place an order for a pet. :param body: order placed for purchasing the pet :type body: :class:`Order <Petstore.models.Order>` :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:`Order <Petstore.models.Order>` :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/store/order' # 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, 'Order') 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 [200, 400]: raise HttpOperationError(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('Order', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def get_order_by_id( self, order_id, custom_headers=None, raw=False, **operation_config): """Find purchase order by ID. For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions. :param order_id: ID of pet that needs to be fetched :type order_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>`. :rtype: :class:`Order <Petstore.models.Order>` :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/store/order/{orderId}' path_format_arguments = { 'orderId': self._serialize.url("order_id", order_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 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 [404, 200, 400]: raise HttpOperationError(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('Order', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def delete_order( self, order_id, custom_headers=None, raw=False, **operation_config): """Delete purchase order by ID. For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors. :param order_id: ID of the order that needs to be deleted :type order_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>`. :rtype: None :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/store/order/{orderId}' path_format_arguments = { 'orderId': self._serialize.url("order_id", order_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 and send request request = self._client.delete(url, query_parameters) response = self._client.send(request, header_parameters, **operation_config) if response.status_code not in [404, 400]: raise HttpOperationError(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response def create_user( self, body=None, custom_headers=None, raw=False, **operation_config): """Create user. This can only be done by the logged in user. :param body: Created user object :type body: :class:`User <Petstore.models.User>` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides<msrest:optionsforoperations>`. :rtype: None :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/user' # 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, 'User') 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 < 200 or response.status_code >= 300: raise HttpOperationError(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response def create_users_with_array_input( self, body=None, custom_headers=None, raw=False, **operation_config): """Creates list of users with given input array. :param body: List of user object :type body: list of :class:`User <Petstore.models.User>` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides<msrest:optionsforoperations>`. :rtype: None :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/user/createWithArray' # 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, '[User]') 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 < 200 or response.status_code >= 300: raise HttpOperationError(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response def create_users_with_list_input( self, body=None, custom_headers=None, raw=False, **operation_config): """Creates list of users with given input array. :param body: List of user object :type body: list of :class:`User <Petstore.models.User>` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides<msrest:optionsforoperations>`. :rtype: None :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/user/createWithList' # 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, '[User]') 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 < 200 or response.status_code >= 300: raise HttpOperationError(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response def login_user( self, username=None, password=None, custom_headers=None, raw=False, **operation_config): """Logs user into the system. :param username: The user name for login :type username: str :param password: The password for login in clear text :type password: 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: str :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/user/login' # Construct parameters query_parameters = {} if username is not None: query_parameters['username'] = self._serialize.query("username", username, 'str') if password is not None: query_parameters['password'] = self._serialize.query("password", password, '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, 400]: raise HttpOperationError(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def logout_user( self, custom_headers=None, raw=False, **operation_config): """Logs out current logged in user session. :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 = '/user/logout' # 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 < 200 or response.status_code >= 300: raise HttpOperationError(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response def get_user_by_name( self, username, custom_headers=None, raw=False, **operation_config): """Get user by user name. :param username: The name that needs to be fetched. Use user1 for testing. :type username: 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:`User <Petstore.models.User>` :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/user/{username}' path_format_arguments = { 'username': self._serialize.url("username", username, '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 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 [404, 200, 400]: raise HttpOperationError(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('User', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def update_user( self, username, body=None, custom_headers=None, raw=False, **operation_config): """Updated user. This can only be done by the logged in user. :param username: name that need to be deleted :type username: str :param body: Updated user object :type body: :class:`User <Petstore.models.User>` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides<msrest:optionsforoperations>`. :rtype: None :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/user/{username}' path_format_arguments = { 'username': self._serialize.url("username", username, '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 if body is not None: body_content = self._serialize.body(body, 'User') 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 [404, 400]: raise HttpOperationError(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response def delete_user( self, username, custom_headers=None, raw=False, **operation_config): """Delete user. This can only be done by the logged in user. :param username: The name that needs to be deleted :type username: 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 = '/user/{username}' path_format_arguments = { 'username': self._serialize.url("username", username, '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 and send request request = self._client.delete(url, query_parameters) response = self._client.send(request, header_parameters, **operation_config) if response.status_code not in [404, 400]: raise HttpOperationError(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response
class AutoRestReportService(object): """Test Infrastructure for AutoRest :ivar config: Configuration for client. :vartype config: AutoRestReportServiceConfiguration :param str base_url: Service URL :param str filepath: Existing config """ 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) def get_report(self, custom_headers=None, raw=False, **operation_config): """Get test coverage report. :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides<msrest:optionsforoperations>`. :rtype: dict :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true :raises: :class:`ErrorException<Fixtures.AcceptanceTestsReport.models.ErrorException>` """ # 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
class NetworkManagementClient(object): """Network Client :ivar config: Configuration for client. :vartype config: NetworkManagementClientConfiguration :ivar application_gateways: ApplicationGateways operations :vartype application_gateways: azure.mgmt.network.v2017_09_01.operations.ApplicationGatewaysOperations :ivar application_security_groups: ApplicationSecurityGroups operations :vartype application_security_groups: azure.mgmt.network.v2017_09_01.operations.ApplicationSecurityGroupsOperations :ivar available_endpoint_services: AvailableEndpointServices operations :vartype available_endpoint_services: azure.mgmt.network.v2017_09_01.operations.AvailableEndpointServicesOperations :ivar express_route_circuit_authorizations: ExpressRouteCircuitAuthorizations operations :vartype express_route_circuit_authorizations: azure.mgmt.network.v2017_09_01.operations.ExpressRouteCircuitAuthorizationsOperations :ivar express_route_circuit_peerings: ExpressRouteCircuitPeerings operations :vartype express_route_circuit_peerings: azure.mgmt.network.v2017_09_01.operations.ExpressRouteCircuitPeeringsOperations :ivar express_route_circuits: ExpressRouteCircuits operations :vartype express_route_circuits: azure.mgmt.network.v2017_09_01.operations.ExpressRouteCircuitsOperations :ivar express_route_service_providers: ExpressRouteServiceProviders operations :vartype express_route_service_providers: azure.mgmt.network.v2017_09_01.operations.ExpressRouteServiceProvidersOperations :ivar load_balancers: LoadBalancers operations :vartype load_balancers: azure.mgmt.network.v2017_09_01.operations.LoadBalancersOperations :ivar load_balancer_backend_address_pools: LoadBalancerBackendAddressPools operations :vartype load_balancer_backend_address_pools: azure.mgmt.network.v2017_09_01.operations.LoadBalancerBackendAddressPoolsOperations :ivar load_balancer_frontend_ip_configurations: LoadBalancerFrontendIPConfigurations operations :vartype load_balancer_frontend_ip_configurations: azure.mgmt.network.v2017_09_01.operations.LoadBalancerFrontendIPConfigurationsOperations :ivar inbound_nat_rules: InboundNatRules operations :vartype inbound_nat_rules: azure.mgmt.network.v2017_09_01.operations.InboundNatRulesOperations :ivar load_balancer_load_balancing_rules: LoadBalancerLoadBalancingRules operations :vartype load_balancer_load_balancing_rules: azure.mgmt.network.v2017_09_01.operations.LoadBalancerLoadBalancingRulesOperations :ivar load_balancer_network_interfaces: LoadBalancerNetworkInterfaces operations :vartype load_balancer_network_interfaces: azure.mgmt.network.v2017_09_01.operations.LoadBalancerNetworkInterfacesOperations :ivar load_balancer_probes: LoadBalancerProbes operations :vartype load_balancer_probes: azure.mgmt.network.v2017_09_01.operations.LoadBalancerProbesOperations :ivar network_interfaces: NetworkInterfaces operations :vartype network_interfaces: azure.mgmt.network.v2017_09_01.operations.NetworkInterfacesOperations :ivar network_interface_ip_configurations: NetworkInterfaceIPConfigurations operations :vartype network_interface_ip_configurations: azure.mgmt.network.v2017_09_01.operations.NetworkInterfaceIPConfigurationsOperations :ivar network_interface_load_balancers: NetworkInterfaceLoadBalancers operations :vartype network_interface_load_balancers: azure.mgmt.network.v2017_09_01.operations.NetworkInterfaceLoadBalancersOperations :ivar network_security_groups: NetworkSecurityGroups operations :vartype network_security_groups: azure.mgmt.network.v2017_09_01.operations.NetworkSecurityGroupsOperations :ivar security_rules: SecurityRules operations :vartype security_rules: azure.mgmt.network.v2017_09_01.operations.SecurityRulesOperations :ivar default_security_rules: DefaultSecurityRules operations :vartype default_security_rules: azure.mgmt.network.v2017_09_01.operations.DefaultSecurityRulesOperations :ivar network_watchers: NetworkWatchers operations :vartype network_watchers: azure.mgmt.network.v2017_09_01.operations.NetworkWatchersOperations :ivar packet_captures: PacketCaptures operations :vartype packet_captures: azure.mgmt.network.v2017_09_01.operations.PacketCapturesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.network.v2017_09_01.operations.Operations :ivar public_ip_addresses: PublicIPAddresses operations :vartype public_ip_addresses: azure.mgmt.network.v2017_09_01.operations.PublicIPAddressesOperations :ivar route_filters: RouteFilters operations :vartype route_filters: azure.mgmt.network.v2017_09_01.operations.RouteFiltersOperations :ivar route_filter_rules: RouteFilterRules operations :vartype route_filter_rules: azure.mgmt.network.v2017_09_01.operations.RouteFilterRulesOperations :ivar route_tables: RouteTables operations :vartype route_tables: azure.mgmt.network.v2017_09_01.operations.RouteTablesOperations :ivar routes: Routes operations :vartype routes: azure.mgmt.network.v2017_09_01.operations.RoutesOperations :ivar bgp_service_communities: BgpServiceCommunities operations :vartype bgp_service_communities: azure.mgmt.network.v2017_09_01.operations.BgpServiceCommunitiesOperations :ivar usages: Usages operations :vartype usages: azure.mgmt.network.v2017_09_01.operations.UsagesOperations :ivar virtual_networks: VirtualNetworks operations :vartype virtual_networks: azure.mgmt.network.v2017_09_01.operations.VirtualNetworksOperations :ivar subnets: Subnets operations :vartype subnets: azure.mgmt.network.v2017_09_01.operations.SubnetsOperations :ivar virtual_network_peerings: VirtualNetworkPeerings operations :vartype virtual_network_peerings: azure.mgmt.network.v2017_09_01.operations.VirtualNetworkPeeringsOperations :ivar virtual_network_gateways: VirtualNetworkGateways operations :vartype virtual_network_gateways: azure.mgmt.network.v2017_09_01.operations.VirtualNetworkGatewaysOperations :ivar virtual_network_gateway_connections: VirtualNetworkGatewayConnections operations :vartype virtual_network_gateway_connections: azure.mgmt.network.v2017_09_01.operations.VirtualNetworkGatewayConnectionsOperations :ivar local_network_gateways: LocalNetworkGateways operations :vartype local_network_gateways: azure.mgmt.network.v2017_09_01.operations.LocalNetworkGatewaysOperations :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) 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.application_security_groups = ApplicationSecurityGroupsOperations( 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) 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.load_balancer_backend_address_pools = LoadBalancerBackendAddressPoolsOperations( self._client, self.config, self._serialize, self._deserialize) self.load_balancer_frontend_ip_configurations = LoadBalancerFrontendIPConfigurationsOperations( self._client, self.config, self._serialize, self._deserialize) self.inbound_nat_rules = InboundNatRulesOperations( self._client, self.config, self._serialize, self._deserialize) self.load_balancer_load_balancing_rules = LoadBalancerLoadBalancingRulesOperations( self._client, self.config, self._serialize, self._deserialize) self.load_balancer_network_interfaces = LoadBalancerNetworkInterfacesOperations( self._client, self.config, self._serialize, self._deserialize) self.load_balancer_probes = LoadBalancerProbesOperations( self._client, self.config, self._serialize, self._deserialize) self.network_interfaces = NetworkInterfacesOperations( self._client, self.config, self._serialize, self._deserialize) self.network_interface_ip_configurations = NetworkInterfaceIPConfigurationsOperations( self._client, self.config, self._serialize, self._deserialize) self.network_interface_load_balancers = NetworkInterfaceLoadBalancersOperations( 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.default_security_rules = DefaultSecurityRulesOperations( 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
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._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_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) 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.load_balancer_backend_address_pools = LoadBalancerBackendAddressPoolsOperations( self._client, self.config, self._serialize, self._deserialize) self.load_balancer_frontend_ip_configurations = LoadBalancerFrontendIPConfigurationsOperations( self._client, self.config, self._serialize, self._deserialize) self.inbound_nat_rules = InboundNatRulesOperations( self._client, self.config, self._serialize, self._deserialize) self.load_balancer_load_balancing_rules = LoadBalancerLoadBalancingRulesOperations( self._client, self.config, self._serialize, self._deserialize) self.load_balancer_network_interfaces = LoadBalancerNetworkInterfacesOperations( self._client, self.config, self._serialize, self._deserialize) self.load_balancer_probes = LoadBalancerProbesOperations( self._client, self.config, self._serialize, self._deserialize) self.network_interfaces = NetworkInterfacesOperations( self._client, self.config, self._serialize, self._deserialize) self.network_interface_ip_configurations = NetworkInterfaceIPConfigurationsOperations( self._client, self.config, self._serialize, self._deserialize) self.network_interface_load_balancers = NetworkInterfaceLoadBalancersOperations( 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.default_security_rules = DefaultSecurityRulesOperations( 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)
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: ^[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 boolean raw: returns the direct response alongside the deserialized response :rtype: DnsNameAvailabilityResult :rtype: msrest.pipeline.ClientRawResponse if raw=True """ # Construct URL url = '/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability' path_format_arguments = { 'location': self._serialize.url("location", location, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} if domain_name_label is not None: query_parameters['domainNameLabel'] = self._serialize.query("domain_name_label", domain_name_label, 'str') query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str') # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send(request, header_parameters, **operation_config) if response.status_code not in [200]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp deserialized = None if response.status_code == 200: deserialized = self._deserialize('DnsNameAvailabilityResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized
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 if response.status_code == 200: deserialized = self._deserialize('[FlattenedProduct]', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def put_dictionary( self, resource_dictionary=None, custom_headers={}, raw=False, **operation_config): """ Put External Resource as a Dictionary :param resource_dictionary: External Resource as a Dictionary to put :type resource_dictionary: dict :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/dictionary' # 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_dictionary is not None: body_content = self._serialize.body(resource_dictionary, '{FlattenedProduct}') 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_dictionary( self, custom_headers={}, raw=False, **operation_config): """ Get External Resource as a Dictionary :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 = '/model-flatten/dictionary' # 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('{FlattenedProduct}', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def put_resource_collection( self, resource_complex_object=None, custom_headers={}, raw=False, **operation_config): """ Put External Resource as a ResourceCollection :param resource_complex_object: External Resource as a ResourceCollection to put :type resource_complex_object: :class:`ResourceCollection <fixtures.acceptancetestsmodelflattening.models.ResourceCollection>` :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/resourcecollection' # 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_complex_object is not None: body_content = self._serialize.body(resource_complex_object, 'ResourceCollection') 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_resource_collection( self, custom_headers={}, raw=False, **operation_config): """ Get External Resource as a ResourceCollection :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:`ResourceCollection <fixtures.acceptancetestsmodelflattening.models.ResourceCollection>` :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/model-flatten/resourcecollection' # 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('ResourceCollection', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def put_simple_product( self, simple_body_product=None, custom_headers={}, raw=False, **operation_config): """ Put Simple Product with client flattening true on the model :param simple_body_product: Simple body product to put :type simple_body_product: :class:`SimpleProduct <fixtures.acceptancetestsmodelflattening.models.SimpleProduct>` :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:`SimpleProduct <fixtures.acceptancetestsmodelflattening.models.SimpleProduct>` :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/model-flatten/customFlattening' # 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 simple_body_product is not None: body_content = self._serialize.body(simple_body_product, 'SimpleProduct') 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) deserialized = None if response.status_code == 200: deserialized = self._deserialize('SimpleProduct', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def post_flattened_simple_product( self, product_id, max_product_display_name, description=None, odatavalue=None, custom_headers={}, raw=False, **operation_config): """ Put Flattened Simple Product with client flattening true on the parameter :param product_id: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. :type product_id: str :param max_product_display_name: Display name of product. :type max_product_display_name: str :param description: Description of product. :type description: str :param odatavalue: URL value. :type odatavalue: 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:`SimpleProduct <fixtures.acceptancetestsmodelflattening.models.SimpleProduct>` :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ simple_body_product = models.SimpleProduct(product_id=product_id, description=description, max_product_display_name=max_product_display_name, odatavalue=odatavalue) # Construct URL url = '/model-flatten/customFlattening' # 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 simple_body_product is not None: body_content = self._serialize.body(simple_body_product, 'SimpleProduct') 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 [200]: raise models.ErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('SimpleProduct', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def put_simple_product_with_grouping( self, flatten_parameter_group, custom_headers={}, raw=False, **operation_config): """ Put Simple Product with client flattening true on the model :param flatten_parameter_group: Additional parameters for the operation :type flatten_parameter_group: :class:`FlattenParameterGroup <fixtures.acceptancetestsmodelflattening.models.FlattenParameterGroup>` :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:`SimpleProduct <fixtures.acceptancetestsmodelflattening.models.SimpleProduct>` :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ name = None if flatten_parameter_group is not None: name = flatten_parameter_group.name product_id = None if flatten_parameter_group is not None: product_id = flatten_parameter_group.product_id description = None if flatten_parameter_group is not None: description = flatten_parameter_group.description max_product_display_name = None if flatten_parameter_group is not None: max_product_display_name = flatten_parameter_group.max_product_display_name odatavalue = None if flatten_parameter_group is not None: odatavalue = flatten_parameter_group.odatavalue simple_body_product = models.SimpleProduct(product_id=product_id, description=description, max_product_display_name=max_product_display_name, odatavalue=odatavalue) # Construct URL url = '/model-flatten/customFlattening/parametergrouping/{name}/' path_format_arguments = { 'name': self._serialize.url("name", name, '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 if simple_body_product is not None: body_content = self._serialize.body(simple_body_product, 'SimpleProduct') 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) deserialized = None if response.status_code == 200: deserialized = self._deserialize('SimpleProduct', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized