/* * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; import { PrivateEndpointConnections } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { StorageManagementClient } from "../storageManagementClient"; import { PrivateEndpointConnection, PrivateEndpointConnectionsListOptionalParams, PrivateEndpointConnectionsListResponse, PrivateEndpointConnectionsGetOptionalParams, PrivateEndpointConnectionsGetResponse, PrivateEndpointConnectionsPutOptionalParams, PrivateEndpointConnectionsPutResponse, PrivateEndpointConnectionsDeleteOptionalParams } from "../models"; /// /** Class containing PrivateEndpointConnections operations. */ export class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { private readonly client: StorageManagementClient; /** * Initialize a new instance of the class PrivateEndpointConnections class. * @param client Reference to the service client */ constructor(client: StorageManagementClient) { this.client = client; } /** * List all the private endpoint connections associated with the storage account. * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param accountName The name of the storage account within the specified resource group. Storage * account names must be between 3 and 24 characters in length and use numbers and lower-case letters * only. * @param options The options parameters. */ public list( resourceGroupName: string, accountName: string, options?: PrivateEndpointConnectionsListOptionalParams ): PagedAsyncIterableIterator { const iter = this.listPagingAll(resourceGroupName, accountName, options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: () => { return this.listPagingPage(resourceGroupName, accountName, options); } }; } private async *listPagingPage( resourceGroupName: string, accountName: string, options?: PrivateEndpointConnectionsListOptionalParams ): AsyncIterableIterator { let result = await this._list(resourceGroupName, accountName, options); yield result.value || []; } private async *listPagingAll( resourceGroupName: string, accountName: string, options?: PrivateEndpointConnectionsListOptionalParams ): AsyncIterableIterator { for await (const page of this.listPagingPage( resourceGroupName, accountName, options )) { yield* page; } } /** * List all the private endpoint connections associated with the storage account. * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param accountName The name of the storage account within the specified resource group. Storage * account names must be between 3 and 24 characters in length and use numbers and lower-case letters * only. * @param options The options parameters. */ private _list( resourceGroupName: string, accountName: string, options?: PrivateEndpointConnectionsListOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, accountName, options }, listOperationSpec ); } /** * Gets the specified private endpoint connection associated with the storage account. * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param accountName The name of the storage account within the specified resource group. Storage * account names must be between 3 and 24 characters in length and use numbers and lower-case letters * only. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the * Azure resource * @param options The options parameters. */ get( resourceGroupName: string, accountName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, accountName, privateEndpointConnectionName, options }, getOperationSpec ); } /** * Update the state of specified private endpoint connection associated with the storage account. * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param accountName The name of the storage account within the specified resource group. Storage * account names must be between 3 and 24 characters in length and use numbers and lower-case letters * only. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the * Azure resource * @param properties The private endpoint connection properties. * @param options The options parameters. */ put( resourceGroupName: string, accountName: string, privateEndpointConnectionName: string, properties: PrivateEndpointConnection, options?: PrivateEndpointConnectionsPutOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, accountName, privateEndpointConnectionName, properties, options }, putOperationSpec ); } /** * Deletes the specified private endpoint connection associated with the storage account. * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param accountName The name of the storage account within the specified resource group. Storage * account names must be between 3 and 24 characters in length and use numbers and lower-case letters * only. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the * Azure resource * @param options The options parameters. */ delete( resourceGroupName: string, accountName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, accountName, privateEndpointConnectionName, options }, deleteOperationSpec ); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const listOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PrivateEndpointConnectionListResult } }, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.accountName1 ], headerParameters: [Parameters.accept], serializer }; const getOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PrivateEndpointConnection }, default: { bodyMapper: Mappers.ErrorResponse } }, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.accountName1, Parameters.privateEndpointConnectionName ], headerParameters: [Parameters.accept], serializer }; const putOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.PrivateEndpointConnection }, default: { bodyMapper: Mappers.ErrorResponse } }, requestBody: Parameters.properties2, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.accountName1, Parameters.privateEndpointConnectionName ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer }; const deleteOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", httpMethod: "DELETE", responses: { 200: {}, 204: {}, default: { bodyMapper: Mappers.ErrorResponse } }, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.accountName1, Parameters.privateEndpointConnectionName ], headerParameters: [Parameters.accept], serializer };