How to use msrest - 10 common examples

To help you get started, we’ve selected a few msrest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-sdk-for-python / sdk / devtestlabs / azure-mgmt-devtestlabs / azure / mgmt / devtestlabs / operations / virtual_machines_operations.py View on Github external
name=name,
            custom_headers=custom_headers,
            raw=True,
            **operation_config
        )

        def get_long_running_output(response):
            if raw:
                client_raw_response = ClientRawResponse(None, response)
                return client_raw_response

        lro_delay = operation_config.get(
            'long_running_operation_timeout',
            self.config.long_running_operation_timeout)
        if polling is True: polling_method = ARMPolling(lro_delay, **operation_config)
        elif polling is False: polling_method = NoPolling()
        else: polling_method = polling
        return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
    delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}'}
github Azure / autorest / src / generator / AutoRest.Python.Tests / Expected / AcceptanceTests / ModelFlattening / auto_rest_resource_flattening_test_service / auto_rest_resource_flattening_test_service.py View on Github external
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)
github Azure / autorest / src / generator / AutoRest.Python.Tests / Expected / AcceptanceTests / CustomBaseUriMoreOptions / auto_rest_parameterized_custom_host_test_client / auto_rest_parameterized_custom_host_test_client.py View on Github external
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.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)
github Azure / autorest / src / generator / AutoRest.Python.Tests / Expected / AcceptanceTests / Http / auto_rest_http_infrastructure_test_service / operations / multiple_responses_operations.py View on Github external
# 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
github Azure / azure-sdk-for-java / AutoRest / Generators / Python / Python.Tests / Expected / AcceptanceTests / CustomBaseUriMoreOptions / autorestparameterizedcustomhosttestclient / auto_rest_parameterized_custom_host_test_client.py View on Github external
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.paths = Paths(
            self._client, self.config, self._serialize, self._deserialize)
github Azure / autorest / src / generator / AutoRest.Python.Azure.Tests / Expected / AcceptanceTests / Lro / fixtures / acceptancetestslro / auto_rest_long_running_operation_test_service.py View on Github external
def __init__(
            self, credentials, base_url=None):

        self.config = AutoRestLongRunningOperationTestServiceConfiguration(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.lr_os = LROsOperations(
            self._client, self.config, self._serialize, self._deserialize)
        self.lro_retrys = LRORetrysOperations(
            self._client, self.config, self._serialize, self._deserialize)
        self.lrosa_ds = LROSADsOperations(
            self._client, self.config, self._serialize, self._deserialize)
        self.lr_os_custom_header = LROsCustomHeaderOperations(
            self._client, self.config, self._serialize, self._deserialize)
github Azure / autorest / src / generator / AutoRest.Python.Tests / Expected / AcceptanceTests / BodyDateTimeRfc1123 / auto_rest_rfc1123_date_time_test_service / auto_rest_rfc1123_date_time_test_service.py View on Github external
def __init__(
            self, base_url=None):

        self.config = AutoRestRFC1123DateTimeTestServiceConfiguration(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.datetimerfc1123 = Datetimerfc1123Operations(
            self._client, self.config, self._serialize, self._deserialize)
github Azure / azure-sdk-for-java / AutoRest / Generators / Python / Python.Tests / Expected / AcceptanceTests / Url / autoresturltestservice / auto_rest_url_test_service.py View on Github external
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.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)
github Azure / msrest-for-python / tests / test_runtime.py View on Github external
def setUp(self):

        cfg = Configuration("https://my_service.com")
        cfg.retry_policy.backoff_factor=0
        cfg.redirect_policy.max_redirects=2
        cfg.credentials = Authentication()

        self.client = ServiceClient(None, cfg)

        return super(TestRedirect, self).setUp()
github Azure / autorest / src / generator / AutoRest.Python.Tests / Expected / AcceptanceTests / Url / auto_rest_url_test_service / auto_rest_url_test_service.py View on Github external
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import ServiceClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from .operations.paths_operations import PathsOperations
from .operations.queries_operations import QueriesOperations
from .operations.path_items_operations import PathItemsOperations
from . import models


class AutoRestUrlTestServiceConfiguration(Configuration):
    """Configuration for AutoRestUrlTestService
    Note that all parameters used to create this instance are saved as instance
    attributes.

    :param global_string_path: A string value 'globalItemStringPath' that
     appears in the path
    :type global_string_path: str
    :param global_string_query: should contain value null
    :type global_string_query: str
    :param str base_url: Service URL
    """

    def __init__(
            self, global_string_path, global_string_query=None, base_url=None):

        if global_string_path is None: