def build_mount_blob_request(
        name,  # type: str
        **kwargs  # type: Any
):
    # type: (...) -> HttpRequest
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
    _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

    from_parameter = kwargs.pop('from_parameter')  # type: str
    mount = kwargs.pop('mount')  # type: str
    accept = _headers.pop('Accept', "application/json")

    # Construct URL
    _url = kwargs.pop("template_url", "/v2/{name}/blobs/uploads/")
    path_format_arguments = {
        "name": _SERIALIZER.url("name", name, 'str'),
    }

    _url = _format_url_section(_url, **path_format_arguments)

    # Construct parameters
    _params['from'] = _SERIALIZER.query("from_parameter", from_parameter,
                                        'str')
    _params['mount'] = _SERIALIZER.query("mount", mount, 'str')

    # Construct headers
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(method="POST",
                       url=_url,
                       params=_params,
                       headers=_headers,
                       **kwargs)
def build_list_request(
    subscription_id: str,
    **kwargs: Any
) -> HttpRequest:
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
    _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

    api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview"))  # type: str
    accept = _headers.pop('Accept', "application/json")

    # Construct URL
    _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets")
    path_format_arguments = {
        "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
    }

    _url = _format_url_section(_url, **path_format_arguments)

    # Construct parameters
    _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')

    # Construct headers
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(
        method="GET",
        url=_url,
        params=_params,
        headers=_headers,
        **kwargs
    )
def build_list_credentials_request(
    subscription_id: str,
    resource_group_name: str,
    fleet_name: str,
    **kwargs: Any
) -> HttpRequest:
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
    _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

    api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview"))  # type: str
    accept = _headers.pop('Accept', "application/json")

    # Construct URL
    _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials")  # pylint: disable=line-too-long
    path_format_arguments = {
        "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
        "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
        "fleetName": _SERIALIZER.url("fleet_name", fleet_name, 'str', max_length=63, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'),
    }

    _url = _format_url_section(_url, **path_format_arguments)

    # Construct parameters
    _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')

    # Construct headers
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(
        method="POST",
        url=_url,
        params=_params,
        headers=_headers,
        **kwargs
    )
    def _create_or_update_initial(
        self,
        resource_group_name: str,
        fleet_name: str,
        parameters: _models.Fleet,
        if_match: Optional[str] = None,
        if_none_match: Optional[str] = None,
        **kwargs: Any
    ) -> _models.Fleet:
        error_map = {
            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
        }
        error_map.update(kwargs.pop('error_map', {}) or {})

        _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview"))  # type: str
        content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json"))  # type: Optional[str]
        cls = kwargs.pop('cls', None)  # type: ClsType[_models.Fleet]

        _json = self._serialize.body(parameters, 'Fleet')

        request = build_create_or_update_request_initial(
            subscription_id=self._config.subscription_id,
            resource_group_name=resource_group_name,
            fleet_name=fleet_name,
            api_version=api_version,
            content_type=content_type,
            json=_json,
            if_match=if_match,
            if_none_match=if_none_match,
            template_url=self._create_or_update_initial.metadata['url'],
            headers=_headers,
            params=_params,
        )
        request = _convert_request(request)
        request.url = self._client.format_url(request.url)  # type: ignore

        pipeline_response = self._client._pipeline.run(  # type: ignore # pylint: disable=protected-access
            request,
            stream=False,
            **kwargs
        )
        response = pipeline_response.http_response

        if response.status_code not in [200, 201]:
            map_error(status_code=response.status_code, response=response, error_map=error_map)
            raise HttpResponseError(response=response, error_format=ARMErrorFormat)

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

        if response.status_code == 201:
            deserialized = self._deserialize('Fleet', pipeline_response)

        if cls:
            return cls(pipeline_response, deserialized, {})

        return deserialized
Exemplo n.º 5
0
def build_list_request(**kwargs: Any) -> HttpRequest:
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
    _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

    api_version = kwargs.pop('api_version',
                             _params.pop('api-version',
                                         "2022-08-01"))  # type: str
    accept = _headers.pop('Accept', "application/json")

    # Construct URL
    _url = kwargs.pop("template_url",
                      "/providers/Microsoft.Dashboard/operations")

    # Construct parameters
    _params['api-version'] = _SERIALIZER.query("api_version", api_version,
                                               'str')

    # Construct headers
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(method="GET",
                       url=_url,
                       params=_params,
                       headers=_headers,
                       **kwargs)
Exemplo n.º 6
0
def build_conversation_analysis_request_initial(*,
                                                json: Optional[JSON] = None,
                                                content: Any = None,
                                                **kwargs: Any) -> HttpRequest:
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
    _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

    api_version = kwargs.pop('api_version',
                             _params.pop('api-version',
                                         "2022-05-15-preview"))  # type: str
    content_type = kwargs.pop('content_type',
                              _headers.pop('Content-Type',
                                           None))  # type: Optional[str]
    accept = _headers.pop('Accept', "application/json")

    # Construct URL
    _url = "/analyze-conversations/jobs"

    # Construct parameters
    _params['api-version'] = _SERIALIZER.query("api_version", api_version,
                                               'str')

    # Construct headers
    if content_type is not None:
        _headers['Content-Type'] = _SERIALIZER.header("content_type",
                                                      content_type, 'str')
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(method="POST",
                       url=_url,
                       params=_params,
                       headers=_headers,
                       json=json,
                       content=content,
                       **kwargs)
Exemplo n.º 7
0
    async def _conversation_analysis_initial(
        self,
        task: JSON,
        **kwargs: Any
    ) -> Optional[JSON]:
        error_map = {
            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
        }
        error_map.update(kwargs.pop('error_map', {}) or {})

        _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-15-preview"))  # type: str
        content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json"))  # type: Optional[str]
        cls = kwargs.pop('cls', None)  # type: ClsType[Optional[JSON]]

        _json = task

        request = build_conversation_analysis_request_initial(
            api_version=api_version,
            content_type=content_type,
            json=_json,
            headers=_headers,
            params=_params,
        )
        path_format_arguments = {
            "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
        }
        request.url = self._client.format_url(request.url, **path_format_arguments)  # type: ignore

        pipeline_response = await self._client._pipeline.run(  # type: ignore # pylint: disable=protected-access
            request,
            stream=False,
            **kwargs
        )
        response = pipeline_response.http_response

        if response.status_code not in [200, 202]:
            map_error(status_code=response.status_code, response=response, error_map=error_map)
            raise HttpResponseError(response=response)

        deserialized = None
        response_headers = {}
        if response.status_code == 200:
            if response.content:
                deserialized = response.json()
            else:
                deserialized = None

        if response.status_code == 202:
            response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location'))
            

        if cls:
            return cls(pipeline_response, deserialized, response_headers)

        return deserialized
    async def _approve_initial(
        self,
        resource_group_name: str,
        workspace_name: str,
        private_endpoint_connection_name: str,
        body: Optional[_models.PrivateEndpointConnection] = None,
        **kwargs: Any
    ) -> _models.PrivateEndpointConnection:
        error_map = {
            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
        }
        error_map.update(kwargs.pop('error_map', {}) or {})

        _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-08-01"))  # type: str
        content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json"))  # type: Optional[str]
        cls = kwargs.pop('cls', None)  # type: ClsType[_models.PrivateEndpointConnection]

        if body is not None:
            _json = self._serialize.body(body, 'PrivateEndpointConnection')
        else:
            _json = None

        request = build_approve_request_initial(
            subscription_id=self._config.subscription_id,
            resource_group_name=resource_group_name,
            workspace_name=workspace_name,
            private_endpoint_connection_name=private_endpoint_connection_name,
            api_version=api_version,
            content_type=content_type,
            json=_json,
            template_url=self._approve_initial.metadata['url'],
            headers=_headers,
            params=_params,
        )
        request = _convert_request(request)
        request.url = self._client.format_url(request.url)  # type: ignore

        pipeline_response = await self._client._pipeline.run(  # type: ignore # pylint: disable=protected-access
            request,
            stream=False,
            **kwargs
        )
        response = pipeline_response.http_response

        if response.status_code not in [201]:
            map_error(status_code=response.status_code, response=response, error_map=error_map)
            raise HttpResponseError(response=response, error_format=ARMErrorFormat)

        deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)

        if cls:
            return cls(pipeline_response, deserialized, {})

        return deserialized
def build_update_request(subscription_id: str,
                         resource_group_name: str,
                         workspace_name: str,
                         *,
                         json: Optional[
                             _models.ManagedGrafanaUpdateParameters] = None,
                         content: Any = None,
                         **kwargs: Any) -> HttpRequest:
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
    _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

    api_version = kwargs.pop('api_version',
                             _params.pop('api-version',
                                         "2022-08-01"))  # type: str
    content_type = kwargs.pop('content_type',
                              _headers.pop('Content-Type',
                                           None))  # type: Optional[str]
    accept = _headers.pop('Accept', "application/json")

    # Construct URL
    _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}")  # pylint: disable=line-too-long
    path_format_arguments = {
        "subscriptionId":
        _SERIALIZER.url("subscription_id",
                        subscription_id,
                        'str',
                        min_length=1),
        "resourceGroupName":
        _SERIALIZER.url("resource_group_name",
                        resource_group_name,
                        'str',
                        max_length=90,
                        min_length=1),
        "workspaceName":
        _SERIALIZER.url("workspace_name", workspace_name, 'str'),
    }

    _url = _format_url_section(_url, **path_format_arguments)

    # Construct parameters
    _params['api-version'] = _SERIALIZER.query("api_version", api_version,
                                               'str')

    # Construct headers
    if content_type is not None:
        _headers['Content-Type'] = _SERIALIZER.header("content_type",
                                                      content_type, 'str')
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(method="PATCH",
                       url=_url,
                       params=_params,
                       headers=_headers,
                       json=json,
                       content=content,
                       **kwargs)
Exemplo n.º 10
0
def build_get_request(subscription_id: str, resource_group_name: str,
                      resource_name: str,
                      private_endpoint_connection_name: str,
                      **kwargs: Any) -> HttpRequest:
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
    _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

    api_version = kwargs.pop('api_version',
                             _params.pop('api-version',
                                         "2022-06-02-preview"))  # type: str
    accept = _headers.pop('Accept', "application/json")

    # Construct URL
    _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}")  # pylint: disable=line-too-long
    path_format_arguments = {
        "subscriptionId":
        _SERIALIZER.url("subscription_id",
                        subscription_id,
                        'str',
                        min_length=1),
        "resourceGroupName":
        _SERIALIZER.url("resource_group_name",
                        resource_group_name,
                        'str',
                        max_length=90,
                        min_length=1),
        "resourceName":
        _SERIALIZER.url(
            "resource_name",
            resource_name,
            'str',
            max_length=63,
            min_length=1,
            pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'
        ),
        "privateEndpointConnectionName":
        _SERIALIZER.url("private_endpoint_connection_name",
                        private_endpoint_connection_name, 'str'),
    }

    _url = _format_url_section(_url, **path_format_arguments)

    # Construct parameters
    _params['api-version'] = _SERIALIZER.query("api_version", api_version,
                                               'str')

    # Construct headers
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(method="GET",
                       url=_url,
                       params=_params,
                       headers=_headers,
                       **kwargs)
def build_create_or_update_request_initial(
    subscription_id: str,
    resource_group_name: str,
    fleet_name: str,
    fleet_member_name: str,
    *,
    json: Optional[_models.FleetMember] = None,
    content: Any = None,
    if_match: Optional[str] = None,
    if_none_match: Optional[str] = None,
    **kwargs: Any
) -> HttpRequest:
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
    _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

    api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview"))  # type: str
    content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None))  # type: Optional[str]
    accept = _headers.pop('Accept', "application/json")

    # Construct URL
    _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}")  # pylint: disable=line-too-long
    path_format_arguments = {
        "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
        "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
        "fleetName": _SERIALIZER.url("fleet_name", fleet_name, 'str', max_length=63, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'),
        "fleetMemberName": _SERIALIZER.url("fleet_member_name", fleet_member_name, 'str', max_length=50, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'),
    }

    _url = _format_url_section(_url, **path_format_arguments)

    # Construct parameters
    _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')

    # Construct headers
    if if_match is not None:
        _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str')
    if if_none_match is not None:
        _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str')
    if content_type is not None:
        _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str')
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(
        method="PUT",
        url=_url,
        params=_params,
        headers=_headers,
        json=json,
        content=content,
        **kwargs
    )
def build_upload_chunk_request(
        next_link,  # type: str
        **kwargs  # type: Any
):
    # type: (...) -> HttpRequest
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})

    content_type = kwargs.pop('content_type',
                              _headers.pop('Content-Type',
                                           None))  # type: Optional[str]
    accept = _headers.pop('Accept', "application/json")

    # Construct URL
    _url = kwargs.pop("template_url", "/{nextBlobUuidLink}")
    path_format_arguments = {
        "nextBlobUuidLink":
        _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True),
    }

    _url = _format_url_section(_url, **path_format_arguments)

    # Construct headers
    if content_type is not None:
        _headers['Content-Type'] = _SERIALIZER.header("content_type",
                                                      content_type, 'str')
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs)
def build_check_chunk_exists_request(
        name,  # type: str
        digest,  # type: str
        **kwargs  # type: Any
):
    # type: (...) -> HttpRequest
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})

    range = kwargs.pop('range')  # type: str
    accept = _headers.pop('Accept', "application/json")

    # Construct URL
    _url = kwargs.pop("template_url", "/v2/{name}/blobs/{digest}")
    path_format_arguments = {
        "name": _SERIALIZER.url("name", name, 'str'),
        "digest": _SERIALIZER.url("digest", digest, 'str'),
    }

    _url = _format_url_section(_url, **path_format_arguments)

    # Construct headers
    _headers['Range'] = _SERIALIZER.header("range", range, 'str')
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs)
Exemplo n.º 14
0
def build_get_request(subscription_id: str, resource_group_name: str,
                      workspace_name: str, private_link_resource_name: str,
                      **kwargs: Any) -> HttpRequest:
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
    _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

    api_version = kwargs.pop('api_version',
                             _params.pop('api-version',
                                         "2022-08-01"))  # type: str
    accept = _headers.pop('Accept', "application/json")

    # Construct URL
    _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateLinkResources/{privateLinkResourceName}")  # pylint: disable=line-too-long
    path_format_arguments = {
        "subscriptionId":
        _SERIALIZER.url("subscription_id",
                        subscription_id,
                        'str',
                        min_length=1),
        "resourceGroupName":
        _SERIALIZER.url("resource_group_name",
                        resource_group_name,
                        'str',
                        max_length=90,
                        min_length=1),
        "workspaceName":
        _SERIALIZER.url("workspace_name", workspace_name, 'str'),
        "privateLinkResourceName":
        _SERIALIZER.url("private_link_resource_name",
                        private_link_resource_name, 'str'),
    }

    _url = _format_url_section(_url, **path_format_arguments)

    # Construct parameters
    _params['api-version'] = _SERIALIZER.query("api_version", api_version,
                                               'str')

    # Construct headers
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(method="GET",
                       url=_url,
                       params=_params,
                       headers=_headers,
                       **kwargs)
    def delete(  # pylint: disable=inconsistent-return-statements
            self, resource_group_name: str, resource_name: str,
            **kwargs: Any) -> None:
        """Deletes a managed cluster snapshot.

        Deletes a managed cluster snapshot.

        :param resource_group_name: The name of the resource group. The name is case insensitive.
        :type resource_group_name: str
        :param resource_name: The name of the managed cluster resource.
        :type resource_name: str
        :keyword callable cls: A custom type or function that will be passed the direct response
        :return: None, or the result of cls(response)
        :rtype: None
        :raises: ~azure.core.exceptions.HttpResponseError
        """
        error_map = {
            401: ClientAuthenticationError,
            404: ResourceNotFoundError,
            409: ResourceExistsError
        }
        error_map.update(kwargs.pop('error_map', {}) or {})

        _headers = kwargs.pop("headers", {}) or {}
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop(
            'api_version', _params.pop('api-version',
                                       "2022-06-02-preview"))  # type: str
        cls = kwargs.pop('cls', None)  # type: ClsType[None]

        request = build_delete_request(
            subscription_id=self._config.subscription_id,
            resource_group_name=resource_group_name,
            resource_name=resource_name,
            api_version=api_version,
            template_url=self.delete.metadata['url'],
            headers=_headers,
            params=_params,
        )
        request = _convert_request(request)
        request.url = self._client.format_url(request.url)  # type: ignore

        pipeline_response = self._client._pipeline.run(  # type: ignore # pylint: disable=protected-access
            request,
            stream=False,
            **kwargs)
        response = pipeline_response.http_response

        if response.status_code not in [200, 204]:
            map_error(status_code=response.status_code,
                      response=response,
                      error_map=error_map)
            raise HttpResponseError(response=response,
                                    error_format=ARMErrorFormat)

        if cls:
            return cls(pipeline_response, None, {})
def build_post_request(
    subscription_id: str,
    resource_group_name: str,
    resource_name: str,
    *,
    json: Optional[_models.PrivateLinkResource] = None,
    content: Any = None,
    **kwargs: Any
) -> HttpRequest:
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
    _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

    api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview"))  # type: str
    content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None))  # type: Optional[str]
    accept = _headers.pop('Accept', "application/json")

    # Construct URL
    _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId")  # pylint: disable=line-too-long
    path_format_arguments = {
        "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
        "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
        "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'),
    }

    _url = _format_url_section(_url, **path_format_arguments)

    # Construct parameters
    _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')

    # Construct headers
    if content_type is not None:
        _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str')
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(
        method="POST",
        url=_url,
        params=_params,
        headers=_headers,
        json=json,
        content=content,
        **kwargs
    )
Exemplo n.º 17
0
    async def _delete_initial(  # pylint: disable=inconsistent-return-statements
            self,
            resource_group_name: str,
            fleet_name: str,
            if_match: Optional[str] = None,
            **kwargs: Any) -> None:
        error_map = {
            401: ClientAuthenticationError,
            404: ResourceNotFoundError,
            409: ResourceExistsError
        }
        error_map.update(kwargs.pop('error_map', {}) or {})

        _headers = kwargs.pop("headers", {}) or {}
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop(
            'api_version', _params.pop('api-version',
                                       "2022-06-02-preview"))  # type: str
        cls = kwargs.pop('cls', None)  # type: ClsType[None]

        request = build_delete_request_initial(
            subscription_id=self._config.subscription_id,
            resource_group_name=resource_group_name,
            fleet_name=fleet_name,
            api_version=api_version,
            if_match=if_match,
            template_url=self._delete_initial.metadata['url'],
            headers=_headers,
            params=_params,
        )
        request = _convert_request(request)
        request.url = self._client.format_url(request.url)  # type: ignore

        pipeline_response = await self._client._pipeline.run(  # type: ignore # pylint: disable=protected-access
            request,
            stream=False,
            **kwargs)
        response = pipeline_response.http_response

        if response.status_code not in [200, 202, 204]:
            map_error(status_code=response.status_code,
                      response=response,
                      error_map=error_map)
            raise HttpResponseError(response=response,
                                    error_format=ARMErrorFormat)

        if cls:
            return cls(pipeline_response, None, {})
def build_start_upload_request(
        name,  # type: str
        **kwargs  # type: Any
):
    # type: (...) -> HttpRequest
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})

    accept = _headers.pop('Accept', "application/json")

    # Construct URL
    _url = kwargs.pop("template_url", "/v2/{name}/blobs/uploads/")
    path_format_arguments = {
        "name": _SERIALIZER.url("name", name, 'str'),
    }

    _url = _format_url_section(_url, **path_format_arguments)

    # Construct headers
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
def build_cancel_upload_request(
        next_link,  # type: str
        **kwargs  # type: Any
):
    # type: (...) -> HttpRequest
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})

    accept = _headers.pop('Accept', "application/json")

    # Construct URL
    _url = kwargs.pop("template_url", "/{nextBlobUuidLink}")
    path_format_arguments = {
        "nextBlobUuidLink":
        _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True),
    }

    _url = _format_url_section(_url, **path_format_arguments)

    # Construct headers
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
Exemplo n.º 20
0
def test_case_insensitive_dict_initialization():
    dict_response = {
        "platformUpdateDomainCount": 5,
        "platformFaultDomainCount": 3,
        "virtualMachines": []
    }
    a = case_insensitive_dict(platformUpdateDomainCount=5,
                              platformFaultDomainCount=3,
                              virtualMachines=[])
    b = case_insensitive_dict(
        zip([
            'platformUpdateDomainCount', 'platformFaultDomainCount',
            'virtualMachines'
        ], [5, 3, []]))
    c = case_insensitive_dict([('platformFaultDomainCount', 3),
                               ('platformUpdateDomainCount', 5),
                               ('virtualMachines', [])])
    d = case_insensitive_dict({
        'virtualMachines': [],
        'platformFaultDomainCount': 3,
        'platformUpdateDomainCount': 5
    })
    e = case_insensitive_dict(
        {
            'platformFaultDomainCount': 3,
            'virtualMachines': []
        },
        platformUpdateDomainCount=5)
    f = case_insensitive_dict(dict_response)
    g = case_insensitive_dict(**dict_response)
    assert a == b == c == d == e == f == g
    dicts = [a, b, c, d, e, f, g]
    for d in dicts:
        assert len(d) == 3
        assert d['platformUpdateDomainCount'] == d[
            'platformupdatedomaincount'] == d['PLATFORMUPDATEDOMAINCOUNT'] == 5
        assert d['platformFaultDomainCount'] == d[
            'platformfaultdomaincount'] == d['PLATFORMFAULTDOMAINCOUNT'] == 3
        assert d['virtualMachines'] == d['virtualmachines'] == d[
            'VIRTUALMACHINES'] == []
def build_delete_blob_request(
        name,  # type: str
        digest,  # type: str
        **kwargs  # type: Any
):
    # type: (...) -> HttpRequest
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})

    accept = _headers.pop('Accept', "application/octet-stream")

    # Construct URL
    _url = kwargs.pop("template_url", "/v2/{name}/blobs/{digest}")
    path_format_arguments = {
        "name": _SERIALIZER.url("name", name, 'str'),
        "digest": _SERIALIZER.url("digest", digest, 'str'),
    }

    _url = _format_url_section(_url, **path_format_arguments)

    # Construct headers
    _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')

    return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
    def begin_create_or_update(
        self,
        resource_group_name: str,
        fleet_name: str,
        parameters: _models.Fleet,
        if_match: Optional[str] = None,
        if_none_match: Optional[str] = None,
        **kwargs: Any
    ) -> LROPoller[_models.Fleet]:
        """Creates or updates a Fleet.

        Creates or updates a Fleet.

        :param resource_group_name: The name of the resource group. The name is case insensitive.
        :type resource_group_name: str
        :param fleet_name: The name of the Fleet resource.
        :type fleet_name: str
        :param parameters: The Fleet to create or update.
        :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet
        :param if_match: Omit this value to always overwrite the current resource. Specify the
         last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is
         None.
        :type if_match: str
        :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an
         existing resource. Other values will result in a 412 Pre-condition Failed response. Default
         value is None.
        :type if_none_match: str
        :keyword callable cls: A custom type or function that will be passed the direct response
        :keyword str continuation_token: A continuation token to restart a poller from a saved state.
        :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
         operation to not poll, or pass in your own initialized polling object for a personal polling
         strategy.
        :paramtype polling: bool or ~azure.core.polling.PollingMethod
        :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
         Retry-After header is present.
        :return: An instance of LROPoller that returns either Fleet or the result of cls(response)
        :rtype:
         ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet]
        :raises: ~azure.core.exceptions.HttpResponseError
        """
        _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview"))  # type: str
        content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json"))  # type: Optional[str]
        cls = kwargs.pop('cls', None)  # type: ClsType[_models.Fleet]
        polling = kwargs.pop('polling', True)  # type: Union[bool, PollingMethod]
        lro_delay = kwargs.pop(
            'polling_interval',
            self._config.polling_interval
        )
        cont_token = kwargs.pop('continuation_token', None)  # type: Optional[str]
        if cont_token is None:
            raw_result = self._create_or_update_initial(  # type: ignore
                resource_group_name=resource_group_name,
                fleet_name=fleet_name,
                parameters=parameters,
                if_match=if_match,
                if_none_match=if_none_match,
                api_version=api_version,
                content_type=content_type,
                cls=lambda x,y,z: x,
                headers=_headers,
                params=_params,
                **kwargs
            )
        kwargs.pop('error_map', None)

        def get_long_running_output(pipeline_response):
            deserialized = self._deserialize('Fleet', pipeline_response)
            if cls:
                return cls(pipeline_response, deserialized, {})
            return deserialized


        if polling is True:
            polling_method = cast(PollingMethod, ARMPolling(
                lro_delay,
                
                
                **kwargs
        ))  # type: PollingMethod
        elif polling is False: polling_method = cast(PollingMethod, NoPolling())
        else: polling_method = polling
        if cont_token:
            return LROPoller.from_continuation_token(
                polling_method=polling_method,
                continuation_token=cont_token,
                client=self._client,
                deserialization_callback=get_long_running_output
            )
        return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
Exemplo n.º 23
0
    def begin_conversation_analysis(self, task: JSON,
                                    **kwargs: Any) -> LROPoller[JSON]:
        """Submit analysis job for conversations.

        Submit a collection of conversations for analysis. Specify one or more unique tasks to be
        executed.

        :param task: The collection of conversations to analyze and one or more tasks to execute.
        :type task: JSON
        :keyword str continuation_token: A continuation token to restart a poller from a saved state.
        :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for
         this operation to not poll, or pass in your own initialized polling object for a personal
         polling strategy.
        :paramtype polling: bool or ~azure.core.polling.PollingMethod
        :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
         Retry-After header is present.
        :return: An instance of LROPoller that returns JSON object
        :rtype: ~azure.core.polling.LROPoller[JSON]
        :raises: ~azure.core.exceptions.HttpResponseError

        Example:
            .. code-block:: python

                # JSON input template you can fill out and use as your body input.
                task = {
                    "analysisInput": {
                        "conversations": [
                            {
                                "domain": "str",  # Optional. Enumeration of
                                  supported conversational domains. Known values are: "finance",
                                  "healthcare", "generic".
                                "id": "str",  # Required. Unique identifier for the
                                  conversation.
                                "language": "str",  # Required. The language of the
                                  conversation item in BCP-47 format.
                                modality: modality
                            }
                        ]
                    },
                    "displayName": "str",  # Optional. Optional display name for the analysis
                      job.
                    "tasks": [
                        {
                            "taskName": "str",  # Optional. Required. The set of tasks to
                              execute on the input conversation.
                            kind: AnalyzeConversationLROTask
                        }
                    ]
                }

                # response body for status code(s): 200
                response.json() == {
                    "createdDateTime": "2020-02-20 00:00:00",  # Required.
                    "displayName": "str",  # Optional.
                    "errors": [
                        {
                            "code": "str",  # Required. One of a server-defined set of
                              error codes. Known values are: "InvalidRequest", "InvalidArgument",
                              "Unauthorized", "Forbidden", "NotFound", "ProjectNotFound",
                              "OperationNotFound", "AzureCognitiveSearchNotFound",
                              "AzureCognitiveSearchIndexNotFound", "TooManyRequests",
                              "AzureCognitiveSearchThrottling",
                              "AzureCognitiveSearchIndexLimitReached", "InternalServerError",
                              "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", "Warning".
                            "details": [
                                ...
                            ],
                            "innererror": {
                                "code": "str",  # Required. One of a server-defined
                                  set of error codes. Known values are: "InvalidRequest",
                                  "InvalidParameterValue", "KnowledgeBaseNotFound",
                                  "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling",
                                  "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest",
                                  "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect",
                                  "InvalidDocumentBatch", "UnsupportedLanguageCode",
                                  "InvalidCountryHint".
                                "details": {
                                    "str": "str"  # Optional. Error details.
                                },
                                "innererror": ...,
                                "message": "str",  # Required. Error message.
                                "target": "str"  # Optional. Error target.
                            },
                            "message": "str",  # Required. A human-readable
                              representation of the error.
                            "target": "str"  # Optional. The target of the error.
                        }
                    ],
                    "expirationDateTime": "2020-02-20 00:00:00",  # Optional.
                    "jobId": "str",  # Required.
                    "lastUpdatedDateTime": "2020-02-20 00:00:00",  # Required.
                    "nextLink": "str",  # Optional.
                    "statistics": {
                        "conversationsCount": 0,  # Required. Number of conversations
                          submitted in the request.
                        "erroneousConversationsCount": 0,  # Required. Number of invalid
                          documents. This includes empty, over-size limit or non-supported languages
                          documents.
                        "transactionsCount": 0.0,  # Required. Number of transactions for the
                          request.
                        "validConversationsCount": 0  # Required. Number of conversations
                          documents. This excludes empty, over-size limit or non-supported languages
                          documents.
                    },
                    "status": "str",  # Required. Known values are: "notStarted", "running",
                      "succeeded", "partiallyCompleted", "failed", "cancelled", "cancelling".
                    "tasks": {
                        "completed": 0,  # Required. Count of tasks completed successfully.
                        "failed": 0,  # Required. Count of tasks that failed.
                        "inProgress": 0,  # Required. Count of tasks in progress currently.
                        "items": [
                            {
                                "lastUpdateDateTime": "2020-02-20 00:00:00",  #
                                  Required. The last updated time in UTC for the task.
                                "status": "str",  # Required. The status of the task
                                  at the mentioned last update time. Known values are: "notStarted",
                                  "running", "succeeded", "failed", "cancelled", "cancelling".
                                "taskName": "str",  # Optional. List of results from
                                  tasks (if available).
                                kind: AnalyzeConversationJobResult
                            }
                        ],
                        "total": 0  # Required. Total count of tasks submitted as part of the
                          job.
                    }
                }
        """
        _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop(
            'api_version', _params.pop('api-version',
                                       "2022-05-15-preview"))  # type: str
        content_type = kwargs.pop(
            'content_type',
            _headers.pop('Content-Type',
                         "application/json"))  # type: Optional[str]
        cls = kwargs.pop('cls', None)  # type: ClsType[JSON]
        polling = kwargs.pop('polling',
                             True)  # type: Union[bool, PollingMethod]
        lro_delay = kwargs.pop('polling_interval',
                               self._config.polling_interval)
        cont_token = kwargs.pop('continuation_token',
                                None)  # type: Optional[str]
        if cont_token is None:
            raw_result = self._conversation_analysis_initial(  # type: ignore
                task=task,
                api_version=api_version,
                content_type=content_type,
                cls=lambda x, y, z: x,
                headers=_headers,
                params=_params,
                **kwargs)
        kwargs.pop('error_map', None)

        def get_long_running_output(pipeline_response):
            response = pipeline_response.http_response
            if response.content:
                deserialized = response.json()
            else:
                deserialized = None
            if cls:
                return cls(pipeline_response, deserialized, {})
            return deserialized

        path_format_arguments = {
            "Endpoint":
            self._serialize.url("self._config.endpoint",
                                self._config.endpoint,
                                'str',
                                skip_quote=True),
        }

        if polling is True:
            polling_method = cast(
                PollingMethod,
                LROBasePolling(lro_delay,
                               path_format_arguments=path_format_arguments,
                               **kwargs))  # type: PollingMethod
        elif polling is False:
            polling_method = cast(PollingMethod, NoPolling())
        else:
            polling_method = polling
        if cont_token:
            return LROPoller.from_continuation_token(
                polling_method=polling_method,
                continuation_token=cont_token,
                client=self._client,
                deserialization_callback=get_long_running_output)
        return LROPoller(self._client, raw_result, get_long_running_output,
                         polling_method)
Exemplo n.º 24
0
    def analyze_conversation(self, task: JSON, **kwargs: Any) -> JSON:
        """Analyzes the input conversation utterance.

        :param task: A single conversational task to execute.
        :type task: JSON
        :return: JSON object
        :rtype: JSON
        :raises: ~azure.core.exceptions.HttpResponseError

        Example:
            .. code-block:: python

                kind = 'ConversationalTask'

                # JSON input template you can fill out and use as your body input.
                task = {
                    kind: kind
                }

                # response body for status code(s): 200
                response.json() == {
                    kind: kind
                }
        """
        error_map = {
            401: ClientAuthenticationError,
            404: ResourceNotFoundError,
            409: ResourceExistsError
        }
        error_map.update(kwargs.pop('error_map', {}) or {})

        _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop(
            'api_version', _params.pop('api-version',
                                       "2022-05-15-preview"))  # type: str
        content_type = kwargs.pop(
            'content_type',
            _headers.pop('Content-Type',
                         "application/json"))  # type: Optional[str]
        cls = kwargs.pop('cls', None)  # type: ClsType[JSON]

        _json = task

        request = build_analyze_conversation_request(
            api_version=api_version,
            content_type=content_type,
            json=_json,
            headers=_headers,
            params=_params,
        )
        path_format_arguments = {
            "Endpoint":
            self._serialize.url("self._config.endpoint",
                                self._config.endpoint,
                                'str',
                                skip_quote=True),
        }
        request.url = self._client.format_url(
            request.url, **path_format_arguments)  # type: ignore

        pipeline_response = self._client._pipeline.run(  # type: ignore # pylint: disable=protected-access
            request,
            stream=False,
            **kwargs)
        response = pipeline_response.http_response

        if response.status_code not in [200]:
            map_error(status_code=response.status_code,
                      response=response,
                      error_map=error_map)
            raise HttpResponseError(response=response)

        if response.content:
            deserialized = response.json()
        else:
            deserialized = None

        if cls:
            return cls(pipeline_response, cast(JSON, deserialized), {})

        return cast(JSON, deserialized)
    def post(
        self,
        resource_group_name: str,
        resource_name: str,
        parameters: _models.PrivateLinkResource,
        **kwargs: Any
    ) -> _models.PrivateLinkResource:
        """Gets the private link service ID for the specified managed cluster.

        Gets the private link service ID for the specified managed cluster.

        :param resource_group_name: The name of the resource group. The name is case insensitive.
        :type resource_group_name: str
        :param resource_name: The name of the managed cluster resource.
        :type resource_name: str
        :param parameters: Parameters required in order to resolve a private link service ID.
        :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource
        :keyword callable cls: A custom type or function that will be passed the direct response
        :return: PrivateLinkResource, or the result of cls(response)
        :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource
        :raises: ~azure.core.exceptions.HttpResponseError
        """
        error_map = {
            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
        }
        error_map.update(kwargs.pop('error_map', {}) or {})

        _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview"))  # type: str
        content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json"))  # type: Optional[str]
        cls = kwargs.pop('cls', None)  # type: ClsType[_models.PrivateLinkResource]

        _json = self._serialize.body(parameters, 'PrivateLinkResource')

        request = build_post_request(
            subscription_id=self._config.subscription_id,
            resource_group_name=resource_group_name,
            resource_name=resource_name,
            api_version=api_version,
            content_type=content_type,
            json=_json,
            template_url=self.post.metadata['url'],
            headers=_headers,
            params=_params,
        )
        request = _convert_request(request)
        request.url = self._client.format_url(request.url)  # type: ignore

        pipeline_response = self._client._pipeline.run(  # type: ignore # pylint: disable=protected-access
            request,
            stream=False,
            **kwargs
        )
        response = pipeline_response.http_response

        if response.status_code not in [200]:
            map_error(status_code=response.status_code, response=response, error_map=error_map)
            raise HttpResponseError(response=response, error_format=ARMErrorFormat)

        deserialized = self._deserialize('PrivateLinkResource', pipeline_response)

        if cls:
            return cls(pipeline_response, deserialized, {})

        return deserialized
    def list_credentials(
        self,
        resource_group_name: str,
        fleet_name: str,
        **kwargs: Any
    ) -> _models.FleetCredentialResults:
        """Lists the user credentials of a Fleet.

        Lists the user credentials of a Fleet.

        :param resource_group_name: The name of the resource group. The name is case insensitive.
        :type resource_group_name: str
        :param fleet_name: The name of the Fleet resource.
        :type fleet_name: str
        :keyword callable cls: A custom type or function that will be passed the direct response
        :return: FleetCredentialResults, or the result of cls(response)
        :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetCredentialResults
        :raises: ~azure.core.exceptions.HttpResponseError
        """
        error_map = {
            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
        }
        error_map.update(kwargs.pop('error_map', {}) or {})

        _headers = kwargs.pop("headers", {}) or {}
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview"))  # type: str
        cls = kwargs.pop('cls', None)  # type: ClsType[_models.FleetCredentialResults]

        
        request = build_list_credentials_request(
            subscription_id=self._config.subscription_id,
            resource_group_name=resource_group_name,
            fleet_name=fleet_name,
            api_version=api_version,
            template_url=self.list_credentials.metadata['url'],
            headers=_headers,
            params=_params,
        )
        request = _convert_request(request)
        request.url = self._client.format_url(request.url)  # type: ignore

        pipeline_response = self._client._pipeline.run(  # type: ignore # pylint: disable=protected-access
            request,
            stream=False,
            **kwargs
        )
        response = pipeline_response.http_response

        if response.status_code not in [200]:
            map_error(status_code=response.status_code, response=response, error_map=error_map)
            error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
            raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

        deserialized = self._deserialize('FleetCredentialResults', pipeline_response)

        if cls:
            return cls(pipeline_response, deserialized, {})

        return deserialized
    def list(
        self,
        **kwargs: Any
    ) -> Iterable[_models.FleetListResult]:
        """Lists fleets in the specified subscription.

        Lists fleets in the specified subscription.

        :keyword callable cls: A custom type or function that will be passed the direct response
        :return: An iterator like instance of either FleetListResult or the result of cls(response)
        :rtype:
         ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetListResult]
        :raises: ~azure.core.exceptions.HttpResponseError
        """
        _headers = kwargs.pop("headers", {}) or {}
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview"))  # type: str
        cls = kwargs.pop('cls', None)  # type: ClsType[_models.FleetListResult]

        error_map = {
            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
        }
        error_map.update(kwargs.pop('error_map', {}) or {})
        def prepare_request(next_link=None):
            if not next_link:
                
                request = build_list_request(
                    subscription_id=self._config.subscription_id,
                    api_version=api_version,
                    template_url=self.list.metadata['url'],
                    headers=_headers,
                    params=_params,
                )
                request = _convert_request(request)
                request.url = self._client.format_url(request.url)  # type: ignore

            else:
                
                request = build_list_request(
                    subscription_id=self._config.subscription_id,
                    api_version=api_version,
                    template_url=next_link,
                    headers=_headers,
                    params=_params,
                )
                request = _convert_request(request)
                request.url = self._client.format_url(request.url)  # type: ignore
                request.method = "GET"
            return request

        def extract_data(pipeline_response):
            deserialized = self._deserialize("FleetListResult", pipeline_response)
            list_of_elem = deserialized.value
            if cls:
                list_of_elem = cls(list_of_elem)
            return deserialized.next_link or None, iter(list_of_elem)

        def get_next(next_link=None):
            request = prepare_request(next_link)

            pipeline_response = self._client._pipeline.run(  # pylint: disable=protected-access
                request,
                stream=False,
                **kwargs
            )
            response = pipeline_response.http_response

            if response.status_code not in [200]:
                map_error(status_code=response.status_code, response=response, error_map=error_map)
                error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
                raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

            return pipeline_response


        return ItemPaged(
            get_next, extract_data
        )
    def begin_delete(  # pylint: disable=inconsistent-return-statements
        self,
        resource_group_name: str,
        fleet_name: str,
        if_match: Optional[str] = None,
        **kwargs: Any
    ) -> LROPoller[None]:
        """Deletes a Fleet.

        Deletes a Fleet.

        :param resource_group_name: The name of the resource group. The name is case insensitive.
        :type resource_group_name: str
        :param fleet_name: The name of the Fleet resource.
        :type fleet_name: str
        :param if_match: Omit this value to always overwrite the current resource. Specify the
         last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is
         None.
        :type if_match: str
        :keyword callable cls: A custom type or function that will be passed the direct response
        :keyword str continuation_token: A continuation token to restart a poller from a saved state.
        :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
         operation to not poll, or pass in your own initialized polling object for a personal polling
         strategy.
        :paramtype polling: bool or ~azure.core.polling.PollingMethod
        :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
         Retry-After header is present.
        :return: An instance of LROPoller that returns either None or the result of cls(response)
        :rtype: ~azure.core.polling.LROPoller[None]
        :raises: ~azure.core.exceptions.HttpResponseError
        """
        _headers = kwargs.pop("headers", {}) or {}
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview"))  # type: str
        cls = kwargs.pop('cls', None)  # type: ClsType[None]
        polling = kwargs.pop('polling', True)  # type: Union[bool, PollingMethod]
        lro_delay = kwargs.pop(
            'polling_interval',
            self._config.polling_interval
        )
        cont_token = kwargs.pop('continuation_token', None)  # type: Optional[str]
        if cont_token is None:
            raw_result = self._delete_initial(  # type: ignore
                resource_group_name=resource_group_name,
                fleet_name=fleet_name,
                if_match=if_match,
                api_version=api_version,
                cls=lambda x,y,z: x,
                headers=_headers,
                params=_params,
                **kwargs
            )
        kwargs.pop('error_map', None)

        def get_long_running_output(pipeline_response):
            if cls:
                return cls(pipeline_response, None, {})


        if polling is True:
            polling_method = cast(PollingMethod, ARMPolling(
                lro_delay,
                lro_options={'final-state-via': 'location'},
                
                **kwargs
        ))  # type: PollingMethod
        elif polling is False: polling_method = cast(PollingMethod, NoPolling())
        else: polling_method = polling
        if cont_token:
            return LROPoller.from_continuation_token(
                polling_method=polling_method,
                continuation_token=cont_token,
                client=self._client,
                deserialization_callback=get_long_running_output
            )
        return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
    def update(
        self,
        resource_group_name: str,
        fleet_name: str,
        if_match: Optional[str] = None,
        parameters: Optional[_models.FleetPatch] = None,
        **kwargs: Any
    ) -> _models.Fleet:
        """Patches a fleet resource.

        Patches a fleet resource.

        :param resource_group_name: The name of the resource group. The name is case insensitive.
        :type resource_group_name: str
        :param fleet_name: The name of the Fleet resource.
        :type fleet_name: str
        :param if_match: Omit this value to always overwrite the current resource. Specify the
         last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is
         None.
        :type if_match: str
        :param parameters: The properties of a Fleet to update. Default value is None.
        :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetPatch
        :keyword callable cls: A custom type or function that will be passed the direct response
        :return: Fleet, or the result of cls(response)
        :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet
        :raises: ~azure.core.exceptions.HttpResponseError
        """
        error_map = {
            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
        }
        error_map.update(kwargs.pop('error_map', {}) or {})

        _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview"))  # type: str
        content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json"))  # type: Optional[str]
        cls = kwargs.pop('cls', None)  # type: ClsType[_models.Fleet]

        if parameters is not None:
            _json = self._serialize.body(parameters, 'FleetPatch')
        else:
            _json = None

        request = build_update_request(
            subscription_id=self._config.subscription_id,
            resource_group_name=resource_group_name,
            fleet_name=fleet_name,
            api_version=api_version,
            content_type=content_type,
            json=_json,
            if_match=if_match,
            template_url=self.update.metadata['url'],
            headers=_headers,
            params=_params,
        )
        request = _convert_request(request)
        request.url = self._client.format_url(request.url)  # type: ignore

        pipeline_response = self._client._pipeline.run(  # type: ignore # pylint: disable=protected-access
            request,
            stream=False,
            **kwargs
        )
        response = pipeline_response.http_response

        if response.status_code not in [200]:
            map_error(status_code=response.status_code, response=response, error_map=error_map)
            error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
            raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

        deserialized = self._deserialize('Fleet', pipeline_response)

        if cls:
            return cls(pipeline_response, deserialized, {})

        return deserialized
    def list(
            self, resource_group_name: str, workspace_name: str, **kwargs: Any
    ) -> AsyncIterable[_models.PrivateLinkResourceListResult]:
        """List all private link resources information for this grafana resource.

        List all private link resources information for this grafana resource.

        :param resource_group_name: The name of the resource group. The name is case insensitive.
        :type resource_group_name: str
        :param workspace_name: The workspace name of Azure Managed Grafana.
        :type workspace_name: str
        :keyword callable cls: A custom type or function that will be passed the direct response
        :return: An iterator like instance of either PrivateLinkResourceListResult or the result of
         cls(response)
        :rtype:
         ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dashboard.models.PrivateLinkResourceListResult]
        :raises: ~azure.core.exceptions.HttpResponseError
        """
        _headers = kwargs.pop("headers", {}) or {}
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop('api_version',
                                 _params.pop('api-version',
                                             "2022-08-01"))  # type: str
        cls = kwargs.pop(
            'cls',
            None)  # type: ClsType[_models.PrivateLinkResourceListResult]

        error_map = {
            401: ClientAuthenticationError,
            404: ResourceNotFoundError,
            409: ResourceExistsError
        }
        error_map.update(kwargs.pop('error_map', {}) or {})

        def prepare_request(next_link=None):
            if not next_link:

                request = build_list_request(
                    subscription_id=self._config.subscription_id,
                    resource_group_name=resource_group_name,
                    workspace_name=workspace_name,
                    api_version=api_version,
                    template_url=self.list.metadata['url'],
                    headers=_headers,
                    params=_params,
                )
                request = _convert_request(request)
                request.url = self._client.format_url(
                    request.url)  # type: ignore

            else:

                request = build_list_request(
                    subscription_id=self._config.subscription_id,
                    resource_group_name=resource_group_name,
                    workspace_name=workspace_name,
                    api_version=api_version,
                    template_url=next_link,
                    headers=_headers,
                    params=_params,
                )
                request = _convert_request(request)
                request.url = self._client.format_url(
                    request.url)  # type: ignore
                request.method = "GET"
            return request

        async def extract_data(pipeline_response):
            deserialized = self._deserialize("PrivateLinkResourceListResult",
                                             pipeline_response)
            list_of_elem = deserialized.value
            if cls:
                list_of_elem = cls(list_of_elem)
            return deserialized.next_link or None, AsyncList(list_of_elem)

        async def get_next(next_link=None):
            request = prepare_request(next_link)

            pipeline_response = await self._client._pipeline.run(  # pylint: disable=protected-access
                request,
                stream=False,
                **kwargs)
            response = pipeline_response.http_response

            if response.status_code not in [200]:
                map_error(status_code=response.status_code,
                          response=response,
                          error_map=error_map)
                error = self._deserialize.failsafe_deserialize(
                    _models.ErrorResponse, pipeline_response)
                raise HttpResponseError(response=response,
                                        model=error,
                                        error_format=ARMErrorFormat)

            return pipeline_response

        return AsyncItemPaged(get_next, extract_data)