/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import { PrivateEndpointConnections } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { AzureMediaServices } from "../azureMediaServices"; import { PrivateEndpointConnectionsListOptionalParams, PrivateEndpointConnectionsListResponse, PrivateEndpointConnectionsGetOptionalParams, PrivateEndpointConnectionsGetResponse, PrivateEndpointConnection, PrivateEndpointConnectionsCreateOrUpdateOptionalParams, PrivateEndpointConnectionsCreateOrUpdateResponse, PrivateEndpointConnectionsDeleteOptionalParams } from "../models"; /** Class containing PrivateEndpointConnections operations. */ export class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { private readonly client: AzureMediaServices; /** * Initialize a new instance of the class PrivateEndpointConnections class. * @param client Reference to the service client */ constructor(client: AzureMediaServices) { this.client = client; } /** * List all private endpoint connections. * @param resourceGroupName The name of the resource group within the Azure subscription. * @param accountName The Media Services account name. * @param options The options parameters. */ list( resourceGroupName: string, accountName: string, options?: PrivateEndpointConnectionsListOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, accountName, options }, listOperationSpec ); } /** * Get the details of a private endpoint connection. * @param resourceGroupName The name of the resource group within the Azure subscription. * @param accountName The Media Services account name. * @param name * @param options The options parameters. */ get( resourceGroupName: string, accountName: string, name: string, options?: PrivateEndpointConnectionsGetOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, accountName, name, options }, getOperationSpec ); } /** * Update an existing private endpoint connection. * @param resourceGroupName The name of the resource group within the Azure subscription. * @param accountName The Media Services account name. * @param name * @param parameters The request parameters * @param options The options parameters. */ createOrUpdate( resourceGroupName: string, accountName: string, name: string, parameters: PrivateEndpointConnection, options?: PrivateEndpointConnectionsCreateOrUpdateOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, accountName, name, parameters, options }, createOrUpdateOperationSpec ); } /** * Deletes a private endpoint connection. * @param resourceGroupName The name of the resource group within the Azure subscription. * @param accountName The Media Services account name. * @param name * @param options The options parameters. */ delete( resourceGroupName: string, accountName: string, name: string, options?: PrivateEndpointConnectionsDeleteOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, accountName, name, options }, deleteOperationSpec ); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const listOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PrivateEndpointConnectionListResult }, default: { bodyMapper: Mappers.ErrorResponse } }, queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.accountName ], headerParameters: [Parameters.accept], serializer }; const getOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PrivateEndpointConnection }, default: { bodyMapper: Mappers.ErrorResponse } }, queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.accountName, Parameters.name ], headerParameters: [Parameters.accept], serializer }; const createOrUpdateOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}", httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.PrivateEndpointConnection }, default: { bodyMapper: Mappers.ErrorResponse } }, requestBody: Parameters.parameters5, queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.accountName, Parameters.name ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer }; const deleteOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}", httpMethod: "DELETE", responses: { 200: {}, 204: {}, default: { bodyMapper: Mappers.ErrorResponse } }, queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.accountName, Parameters.name ], headerParameters: [Parameters.accept], serializer };