# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator 2.3.33.0
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.pipeline import ClientRawResponse

from .. import models


class AssetOperations(object):
    """AssetOperations operations.

    :param client: Client for service requests.
    :param config: Configuration of service client.
    :param serializer: An object model serializer.
    :param deserializer: An object model deserializer.
    :ivar api_version: The version of the Microsoft.MachineLearning resource provider API to use. Constant value: "2018-11-19".
    """

    models = models

    def __init__(self, client, config, serializer, deserializer):

        self._client = client
        self._serialize = serializer
        self._deserialize = deserializer

        self.config = config
        self.api_version = "2018-11-19"

    def create(
            self, subscription_id, resource_group_name, workspace, asset, custom_headers=None, raw=False, **operation_config):
        """Create an Asset.

        :param subscription_id: The Azure Subscription ID.
        :type subscription_id: str
        :param resource_group_name: Name of the resource group in which the
         workspace is located.
        :type resource_group_name: str
        :param workspace: The name of the workspace.
        :type workspace: str
        :param asset: The payload that is used to register an Asset.
        :type asset: ~_restclient.models.Asset
        :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: Asset or ClientRawResponse if raw=true
        :rtype: ~_restclient.models.Asset or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>`
        """
        # Construct URL
        url = self.create.metadata['url']
        path_format_arguments = {
            'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),
            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
            'workspace': self._serialize.url("workspace", workspace, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct body
        body_content = self._serialize.body(asset, 'Asset')

        # Construct and send request
        request = self._client.post(url, query_parameters)
        response = self._client.send(
            request, header_parameters, body_content, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.ModelErrorResponseException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('Asset', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
    create.metadata = {'url': '/modelmanagement/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspace}/assets'}

    def list_query(
            self, subscription_id, resource_group_name, workspace, runid=None, project_id=None, name=None, tag=None, properties=None, count=None, skip_token=None, order_by=None, custom_headers=None, raw=False, **operation_config):
        """Query the list of Assets in a workspace. If no filter is passed, the
        query lists all the Assets in the given workspace. The returned list is
        paginated and the count of item in each page is an optional parameter.

        :param subscription_id: The Azure Subscription ID.
        :type subscription_id: str
        :param resource_group_name: Name of the resource group in which the
         workspace is located.
        :type resource_group_name: str
        :param workspace: The name of the workspace.
        :type workspace: str
        :param runid: The run id.
        :type runid: str
        :param project_id: The project id.
        :type project_id: str
        :param name: The object name.
        :type name: str
        :param tag: The object tag.
        :type tag: str
        :param properties: The object key-value properties.
        :type properties: str
        :param count: The number of items to retrieve in a page
        :type count: str
        :param skip_token: The continuation token to retrieve the next page
        :type skip_token: str
        :param order_by: The option to order response. Possible values
         include: 'CreatedAtDesc', 'CreatedAtAsc', 'UpdatedAtDesc',
         'UpdatedAtAsc'
        :type order_by: 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: PaginatedAssetList or ClientRawResponse if raw=true
        :rtype: ~_restclient.models.PaginatedAssetList or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>`
        """
        # Construct URL
        url = self.list_query.metadata['url']
        path_format_arguments = {
            'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),
            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
            'workspace': self._serialize.url("workspace", workspace, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
        if runid is not None:
            query_parameters['runid'] = self._serialize.query("runid", runid, 'str')
        if project_id is not None:
            query_parameters['projectId'] = self._serialize.query("project_id", project_id, 'str')
        if name is not None:
            query_parameters['name'] = self._serialize.query("name", name, 'str')
        if tag is not None:
            query_parameters['tag'] = self._serialize.query("tag", tag, 'str')
        if properties is not None:
            query_parameters['properties'] = self._serialize.query("properties", properties, 'str')
        if count is not None:
            query_parameters['count'] = self._serialize.query("count", count, 'str')
        if skip_token is not None:
            query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str')
        if order_by is not None:
            query_parameters['orderBy'] = self._serialize.query("order_by", order_by, '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, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.ModelErrorResponseException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('PaginatedAssetList', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
    list_query.metadata = {'url': '/modelmanagement/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspace}/assets'}

    def patch(
            self, subscription_id, resource_group_name, workspace, id, patch, custom_headers=None, raw=False, **operation_config):
        """Patch a specific asset.

        :param subscription_id: The Azure Subscription ID.
        :type subscription_id: str
        :param resource_group_name: Name of the resource group in which the
         workspace is located.
        :type resource_group_name: str
        :param workspace: The name of the workspace.
        :type workspace: str
        :param id: The object id.
        :type id: str
        :param patch: The payload that is used to patch an Asset.
        :type patch: list[~_restclient.models.JsonPatchOperation]
        :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: Asset or ClientRawResponse if raw=true
        :rtype: ~_restclient.models.Asset or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>`
        """
        # Construct URL
        url = self.patch.metadata['url']
        path_format_arguments = {
            'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),
            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
            'workspace': self._serialize.url("workspace", workspace, 'str'),
            'id': self._serialize.url("id", id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct body
        body_content = self._serialize.body(patch, '[JsonPatchOperation]')

        # Construct and send request
        request = self._client.patch(url, query_parameters)
        response = self._client.send(
            request, header_parameters, body_content, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.ModelErrorResponseException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('Asset', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
    patch.metadata = {'url': '/modelmanagement/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspace}/assets/{id}'}

    def query_by_id(
            self, subscription_id, resource_group_name, workspace, id, custom_headers=None, raw=False, **operation_config):
        """Gets Asset by ID.

        :param subscription_id: The Azure Subscription ID.
        :type subscription_id: str
        :param resource_group_name: Name of the resource group in which the
         workspace is located.
        :type resource_group_name: str
        :param workspace: The name of the workspace.
        :type workspace: str
        :param id: The object id.
        :type id: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: Asset or ClientRawResponse if raw=true
        :rtype: ~_restclient.models.Asset or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>`
        """
        # Construct URL
        url = self.query_by_id.metadata['url']
        path_format_arguments = {
            'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),
            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
            'workspace': self._serialize.url("workspace", workspace, 'str'),
            'id': self._serialize.url("id", id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if 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, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.ModelErrorResponseException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('Asset', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
    query_by_id.metadata = {'url': '/modelmanagement/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspace}/assets/{id}'}

    def delete(
            self, subscription_id, resource_group_name, workspace, id, custom_headers=None, raw=False, **operation_config):
        """Deletes the specific asset.

        :param subscription_id: The Azure Subscription ID.
        :type subscription_id: str
        :param resource_group_name: Name of the resource group in which the
         workspace is located.
        :type resource_group_name: str
        :param workspace: The name of the workspace.
        :type workspace: str
        :param id: The object id.
        :type id: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: None or ClientRawResponse if raw=true
        :rtype: None or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>`
        """
        # Construct URL
        url = self.delete.metadata['url']
        path_format_arguments = {
            'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),
            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
            'workspace': self._serialize.url("workspace", workspace, 'str'),
            'id': self._serialize.url("id", id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if 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, stream=False, **operation_config)

        if response.status_code not in [200, 204]:
            raise models.ModelErrorResponseException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            return client_raw_response
    delete.metadata = {'url': '/modelmanagement/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspace}/assets/{id}'}

# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator 2.3.33.0
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.pipeline import ClientRawResponse

from .. import models


class AssetOperations(object):
    """AssetOperations operations.

    :param client: Client for service requests.
    :param config: Configuration of service client.
    :param serializer: An object model serializer.
    :param deserializer: An object model deserializer.
    :ivar api_version: The version of the Microsoft.MachineLearning resource provider API to use. Constant value: "2018-11-19".
    """

    models = models

    def __init__(self, client, config, serializer, deserializer):

        self._client = client
        self._serialize = serializer
        self._deserialize = deserializer

        self.config = config
        self.api_version = "2018-11-19"

    def create(
            self, subscription_id, resource_group_name, workspace, asset, custom_headers=None, raw=False, **operation_config):
        """Create an Asset.

        :param subscription_id: The Azure Subscription ID.
        :type subscription_id: str
        :param resource_group_name: Name of the resource group in which the
         workspace is located.
        :type resource_group_name: str
        :param workspace: The name of the workspace.
        :type workspace: str
        :param asset: The payload that is used to register an Asset.
        :type asset: ~_restclient.models.Asset
        :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: Asset or ClientRawResponse if raw=true
        :rtype: ~_restclient.models.Asset or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>`
        """
        # Construct URL
        url = self.create.metadata['url']
        path_format_arguments = {
            'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),
            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
            'workspace': self._serialize.url("workspace", workspace, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct body
        body_content = self._serialize.body(asset, 'Asset')

        # Construct and send request
        request = self._client.post(url, query_parameters)
        response = self._client.send(
            request, header_parameters, body_content, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.ModelErrorResponseException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('Asset', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
    create.metadata = {'url': '/modelmanagement/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspace}/assets'}

    def list_query(
            self, subscription_id, resource_group_name, workspace, runid=None, project_id=None, name=None, tag=None, properties=None, count=None, skip_token=None, order_by=None, custom_headers=None, raw=False, **operation_config):
        """Query the list of Assets in a workspace. If no filter is passed, the
        query lists all the Assets in the given workspace. The returned list is
        paginated and the count of item in each page is an optional parameter.

        :param subscription_id: The Azure Subscription ID.
        :type subscription_id: str
        :param resource_group_name: Name of the resource group in which the
         workspace is located.
        :type resource_group_name: str
        :param workspace: The name of the workspace.
        :type workspace: str
        :param runid: The run id.
        :type runid: str
        :param project_id: The project id.
        :type project_id: str
        :param name: The object name.
        :type name: str
        :param tag: The object tag.
        :type tag: str
        :param properties: The object key-value properties.
        :type properties: str
        :param count: The number of items to retrieve in a page
        :type count: str
        :param skip_token: The continuation token to retrieve the next page
        :type skip_token: str
        :param order_by: The option to order response. Possible values
         include: 'CreatedAtDesc', 'CreatedAtAsc', 'UpdatedAtDesc',
         'UpdatedAtAsc'
        :type order_by: 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: PaginatedAssetList or ClientRawResponse if raw=true
        :rtype: ~_restclient.models.PaginatedAssetList or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>`
        """
        # Construct URL
        url = self.list_query.metadata['url']
        path_format_arguments = {
            'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),
            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
            'workspace': self._serialize.url("workspace", workspace, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
        if runid is not None:
            query_parameters['runid'] = self._serialize.query("runid", runid, 'str')
        if project_id is not None:
            query_parameters['projectId'] = self._serialize.query("project_id", project_id, 'str')
        if name is not None:
            query_parameters['name'] = self._serialize.query("name", name, 'str')
        if tag is not None:
            query_parameters['tag'] = self._serialize.query("tag", tag, 'str')
        if properties is not None:
            query_parameters['properties'] = self._serialize.query("properties", properties, 'str')
        if count is not None:
            query_parameters['count'] = self._serialize.query("count", count, 'str')
        if skip_token is not None:
            query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str')
        if order_by is not None:
            query_parameters['orderBy'] = self._serialize.query("order_by", order_by, '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, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.ModelErrorResponseException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('PaginatedAssetList', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
    list_query.metadata = {'url': '/modelmanagement/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspace}/assets'}

    def patch(
            self, subscription_id, resource_group_name, workspace, id, patch, custom_headers=None, raw=False, **operation_config):
        """Patch a specific asset.

        :param subscription_id: The Azure Subscription ID.
        :type subscription_id: str
        :param resource_group_name: Name of the resource group in which the
         workspace is located.
        :type resource_group_name: str
        :param workspace: The name of the workspace.
        :type workspace: str
        :param id: The object id.
        :type id: str
        :param patch: The payload that is used to patch an Asset.
        :type patch: list[~_restclient.models.JsonPatchOperation]
        :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: Asset or ClientRawResponse if raw=true
        :rtype: ~_restclient.models.Asset or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>`
        """
        # Construct URL
        url = self.patch.metadata['url']
        path_format_arguments = {
            'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),
            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
            'workspace': self._serialize.url("workspace", workspace, 'str'),
            'id': self._serialize.url("id", id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct body
        body_content = self._serialize.body(patch, '[JsonPatchOperation]')

        # Construct and send request
        request = self._client.patch(url, query_parameters)
        response = self._client.send(
            request, header_parameters, body_content, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.ModelErrorResponseException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('Asset', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
    patch.metadata = {'url': '/modelmanagement/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspace}/assets/{id}'}

    def query_by_id(
            self, subscription_id, resource_group_name, workspace, id, custom_headers=None, raw=False, **operation_config):
        """Gets Asset by ID.

        :param subscription_id: The Azure Subscription ID.
        :type subscription_id: str
        :param resource_group_name: Name of the resource group in which the
         workspace is located.
        :type resource_group_name: str
        :param workspace: The name of the workspace.
        :type workspace: str
        :param id: The object id.
        :type id: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: Asset or ClientRawResponse if raw=true
        :rtype: ~_restclient.models.Asset or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>`
        """
        # Construct URL
        url = self.query_by_id.metadata['url']
        path_format_arguments = {
            'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),
            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
            'workspace': self._serialize.url("workspace", workspace, 'str'),
            'id': self._serialize.url("id", id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if 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, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.ModelErrorResponseException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('Asset', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
    query_by_id.metadata = {'url': '/modelmanagement/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspace}/assets/{id}'}

    def delete(
            self, subscription_id, resource_group_name, workspace, id, custom_headers=None, raw=False, **operation_config):
        """Deletes the specific asset.

        :param subscription_id: The Azure Subscription ID.
        :type subscription_id: str
        :param resource_group_name: Name of the resource group in which the
         workspace is located.
        :type resource_group_name: str
        :param workspace: The name of the workspace.
        :type workspace: str
        :param id: The object id.
        :type id: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: None or ClientRawResponse if raw=true
        :rtype: None or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>`
        """
        # Construct URL
        url = self.delete.metadata['url']
        path_format_arguments = {
            'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),
            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
            'workspace': self._serialize.url("workspace", workspace, 'str'),
            'id': self._serialize.url("id", id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if 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, stream=False, **operation_config)

        if response.status_code not in [200, 204]:
            raise models.ModelErrorResponseException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            return client_raw_response
    delete.metadata = {'url': '/modelmanagement/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspace}/assets/{id}'}

# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator 2.3.33.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- AssetOperations operations.
 
     :param client: Client for service requests.
     :param config: Configuration of service client.
     :param serializer: An object model serializer.
     :param deserializer: An object model deserializer.
     :ivar api_version: The version of the Microsoft.MachineLearning resource provider API to use. Constant value: "2018-11-19". Create an Asset.
 
         :param subscription_id: The Azure Subscription ID.
         :type subscription_id: str
         :param resource_group_name: Name of the resource group in which the
          workspace is located.
         :type resource_group_name: str
         :param workspace: The name of the workspace.
         :type workspace: str
         :param asset: The payload that is used to register an Asset.
         :type asset: ~_restclient.models.Asset
         :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: Asset or ClientRawResponse if raw=true
         :rtype: ~_restclient.models.Asset or
          ~msrest.pipeline.ClientRawResponse
         :raises:
          :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>` # Construct URL # Construct parameters # Construct headers # Construct body # Construct and send request Query the list of Assets in a workspace. If no filter is passed, the
         query lists all the Assets in the given workspace. The returned list is
         paginated and the count of item in each page is an optional parameter.
 
         :param subscription_id: The Azure Subscription ID.
         :type subscription_id: str
         :param resource_group_name: Name of the resource group in which the
          workspace is located.
         :type resource_group_name: str
         :param workspace: The name of the workspace.
         :type workspace: str
         :param runid: The run id.
         :type runid: str
         :param project_id: The project id.
         :type project_id: str
         :param name: The object name.
         :type name: str
         :param tag: The object tag.
         :type tag: str
         :param properties: The object key-value properties.
         :type properties: str
         :param count: The number of items to retrieve in a page
         :type count: str
         :param skip_token: The continuation token to retrieve the next page
         :type skip_token: str
         :param order_by: The option to order response. Possible values
          include: 'CreatedAtDesc', 'CreatedAtAsc', 'UpdatedAtDesc',
          'UpdatedAtAsc'
         :type order_by: 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: PaginatedAssetList or ClientRawResponse if raw=true
         :rtype: ~_restclient.models.PaginatedAssetList or
          ~msrest.pipeline.ClientRawResponse
         :raises:
          :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>` # Construct URL # Construct parameters # Construct headers # Construct and send request Patch a specific asset.
 
         :param subscription_id: The Azure Subscription ID.
         :type subscription_id: str
         :param resource_group_name: Name of the resource group in which the
          workspace is located.
         :type resource_group_name: str
         :param workspace: The name of the workspace.
         :type workspace: str
         :param id: The object id.
         :type id: str
         :param patch: The payload that is used to patch an Asset.
         :type patch: list[~_restclient.models.JsonPatchOperation]
         :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: Asset or ClientRawResponse if raw=true
         :rtype: ~_restclient.models.Asset or
          ~msrest.pipeline.ClientRawResponse
         :raises:
          :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>` # Construct URL # Construct parameters # Construct headers # Construct body # Construct and send request Gets Asset by ID.
 
         :param subscription_id: The Azure Subscription ID.
         :type subscription_id: str
         :param resource_group_name: Name of the resource group in which the
          workspace is located.
         :type resource_group_name: str
         :param workspace: The name of the workspace.
         :type workspace: str
         :param id: The object id.
         :type id: str
         :param dict custom_headers: headers that will be added to the request
         :param bool raw: returns the direct response alongside the
          deserialized response
         :param operation_config: :ref:`Operation configuration
          overrides<msrest:optionsforoperations>`.
         :return: Asset or ClientRawResponse if raw=true
         :rtype: ~_restclient.models.Asset or
          ~msrest.pipeline.ClientRawResponse
         :raises:
          :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>` # Construct URL # Construct parameters # Construct headers # Construct and send request Deletes the specific asset.
 
         :param subscription_id: The Azure Subscription ID.
         :type subscription_id: str
         :param resource_group_name: Name of the resource group in which the
          workspace is located.
         :type resource_group_name: str
         :param workspace: The name of the workspace.
         :type workspace: str
         :param id: The object id.
         :type id: str
         :param dict custom_headers: headers that will be added to the request
         :param bool raw: returns the direct response alongside the
          deserialized response
         :param operation_config: :ref:`Operation configuration
          overrides<msrest:optionsforoperations>`.
         :return: None or ClientRawResponse if raw=true
         :rtype: None or ~msrest.pipeline.ClientRawResponse
         :raises:
          :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>` # Construct URL # Construct parameters # Construct headers # Construct and send request