import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { BlobContainers } 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 { PollerLike , PollOperationState , LroEngine } from "@azure/core-lro" ; import { LroImpl } from "../lroImpl" ; import { ListContainerItem , BlobContainersListNextOptionalParams , BlobContainersListOptionalParams , BlobContainersListResponse , BlobContainer , BlobContainersCreateOptionalParams , BlobContainersCreateResponse , BlobContainersUpdateOptionalParams , BlobContainersUpdateResponse , BlobContainersGetOptionalParams , BlobContainersGetResponse , BlobContainersDeleteOptionalParams , LegalHold , BlobContainersSetLegalHoldOptionalParams , BlobContainersSetLegalHoldResponse , BlobContainersClearLegalHoldOptionalParams , BlobContainersClearLegalHoldResponse , BlobContainersCreateOrUpdateImmutabilityPolicyOptionalParams , BlobContainersCreateOrUpdateImmutabilityPolicyResponse , BlobContainersGetImmutabilityPolicyOptionalParams , BlobContainersGetImmutabilityPolicyResponse , BlobContainersDeleteImmutabilityPolicyOptionalParams , BlobContainersDeleteImmutabilityPolicyResponse , BlobContainersLockImmutabilityPolicyOptionalParams , BlobContainersLockImmutabilityPolicyResponse , BlobContainersExtendImmutabilityPolicyOptionalParams , BlobContainersExtendImmutabilityPolicyResponse , BlobContainersLeaseOptionalParams , BlobContainersLeaseResponse , BlobContainersObjectLevelWormOptionalParams , BlobContainersListNextResponse } from "../models" ; /** Class containing BlobContainers operations. */ export class BlobContainersImpl implements BlobContainers { private readonly client : StorageManagementClient ; param client constructor ( client ) { this . client = client ; } param resourceGroupName param accountName param options public list ( resourceGroupName , accountName , options ? ) { 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 , accountName , options ? ) { let result = await this . _list ( resourceGroupName , accountName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listNext ( resourceGroupName , accountName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listPagingAll ( resourceGroupName , accountName , options ? ) { for await ( const page of this . listPagingPage ( resourceGroupName , accountName , options ) ) { yield * page ; } } param resourceGroupName param accountName param options private _list ( resourceGroupName , accountName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , accountName , options } , listOperationSpec ) ; } param resourceGroupName param accountName param containerName param blobContainer param options create ( resourceGroupName , accountName , containerName , blobContainer , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , accountName , containerName , blobContainer , options } , createOperationSpec ) ; } param resourceGroupName param accountName param containerName param blobContainer param options update ( resourceGroupName , accountName , containerName , blobContainer , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , accountName , containerName , blobContainer , options } , updateOperationSpec ) ; } param resourceGroupName param accountName param containerName param options get ( resourceGroupName , accountName , containerName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , accountName , containerName , options } , getOperationSpec ) ; } param resourceGroupName param accountName param containerName param options delete ( resourceGroupName , accountName , containerName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , accountName , containerName , options } , deleteOperationSpec ) ; } param resourceGroupName param accountName param containerName param legalHold param options setLegalHold ( resourceGroupName , accountName , containerName , legalHold , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , accountName , containerName , legalHold , options } , setLegalHoldOperationSpec ) ; } param resourceGroupName param accountName param containerName param legalHold param options clearLegalHold ( resourceGroupName , accountName , containerName , legalHold , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , accountName , containerName , legalHold , options } , clearLegalHoldOperationSpec ) ; } param resourceGroupName param accountName param containerName param options createOrUpdateImmutabilityPolicy ( resourceGroupName , accountName , containerName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , accountName , containerName , options } , createOrUpdateImmutabilityPolicyOperationSpec ) ; } param resourceGroupName param accountName param containerName param options getImmutabilityPolicy ( resourceGroupName , accountName , containerName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , accountName , containerName , options } , getImmutabilityPolicyOperationSpec ) ; } param resourceGroupName param accountName param containerName param ifMatch param options deleteImmutabilityPolicy ( resourceGroupName , accountName , containerName , ifMatch , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , accountName , containerName , ifMatch , options } , deleteImmutabilityPolicyOperationSpec ) ; } param resourceGroupName param accountName param containerName param ifMatch param options lockImmutabilityPolicy ( resourceGroupName , accountName , containerName , ifMatch , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , accountName , containerName , ifMatch , options } , lockImmutabilityPolicyOperationSpec ) ; } param resourceGroupName param accountName param containerName param ifMatch param options extendImmutabilityPolicy ( resourceGroupName , accountName , containerName , ifMatch , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , accountName , containerName , ifMatch , options } , extendImmutabilityPolicyOperationSpec ) ; } param resourceGroupName param accountName param containerName param options lease ( resourceGroupName , accountName , containerName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , accountName , containerName , options } , leaseOperationSpec ) ; } param resourceGroupName param accountName param containerName param options async beginObjectLevelWorm ( resourceGroupName , accountName , containerName , options ? ) { const directSendOperation = async ( args , spec ) : Promise < void > => { return this . client . sendOperationRequest ( args , spec ) ; } ; const sendOperation = async ( args , spec ) => { let currentRawResponse = undefined ; const providedCallback = args . options ?. onResponse ; const callback = ( rawResponse , flatResponse ) => { currentRawResponse = rawResponse ; providedCallback ?. ( rawResponse , flatResponse ) ; } ; const updatedArgs = { ... args , options : { ... args . options , onResponse : callback } } ; const flatResponse = await directSendOperation ( updatedArgs , spec ) ; return { flatResponse , rawResponse : { statusCode : currentRawResponse ! . status , body : currentRawResponse ! . parsedBody , headers : currentRawResponse ! . headers . toJSON ( ) } } ; } ; const lro = new LroImpl ( sendOperation , { resourceGroupName , accountName , containerName , options } , objectLevelWormOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs , lroResourceLocationConfig : "location" } ) ; } param resourceGroupName param accountName param containerName param options async beginObjectLevelWormAndWait ( resourceGroupName , accountName , containerName , options ? ) { const poller = await this . beginObjectLevelWorm ( resourceGroupName , accountName , containerName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param accountName param nextLink param options private _listNext ( resourceGroupName , accountName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , accountName , nextLink , options } , listNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const listOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ListContainerItems } } , queryParameters : [ Parameters . apiVersion , Parameters . maxpagesize , Parameters . filter , Parameters . include ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 ] , headerParameters : [ Parameters . accept ] , serializer } ; const createOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . BlobContainer } , 201 : { bodyMapper : Mappers . BlobContainer } } , requestBody : Parameters . blobContainer , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 , Parameters . containerName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const updateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}" , httpMethod : "PATCH" , responses : { 200 : { bodyMapper : Mappers . BlobContainer } } , requestBody : Parameters . blobContainer , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 , Parameters . containerName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . BlobContainer } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 , Parameters . containerName ] , headerParameters : [ Parameters . accept ] , serializer } ; const deleteOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}" , httpMethod : "DELETE" , responses : { 200 : { } , 204 : { } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 , Parameters . containerName ] , serializer } ; const setLegalHoldOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . LegalHold } } , requestBody : Parameters . legalHold , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 , Parameters . containerName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const clearLegalHoldOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . LegalHold } } , requestBody : Parameters . legalHold , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 , Parameters . containerName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const createOrUpdateImmutabilityPolicyOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . ImmutabilityPolicy , headersMapper : Mappers . BlobContainersCreateOrUpdateImmutabilityPolicyHeaders } } , requestBody : Parameters . parameters6 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 , Parameters . containerName , Parameters . immutabilityPolicyName ] , headerParameters : [ Parameters . accept , Parameters . contentType , Parameters . ifMatch ] , mediaType : "json" , serializer } ; const getImmutabilityPolicyOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ImmutabilityPolicy , headersMapper : Mappers . BlobContainersGetImmutabilityPolicyHeaders } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 , Parameters . containerName , Parameters . immutabilityPolicyName ] , headerParameters : [ Parameters . accept , Parameters . ifMatch ] , serializer } ; const deleteImmutabilityPolicyOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}" , httpMethod : "DELETE" , responses : { 200 : { bodyMapper : Mappers . ImmutabilityPolicy , headersMapper : Mappers . BlobContainersDeleteImmutabilityPolicyHeaders } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 , Parameters . containerName , Parameters . immutabilityPolicyName ] , headerParameters : [ Parameters . accept , Parameters . ifMatch1 ] , serializer } ; const lockImmutabilityPolicyOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . ImmutabilityPolicy , headersMapper : Mappers . BlobContainersLockImmutabilityPolicyHeaders } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 , Parameters . containerName ] , headerParameters : [ Parameters . accept , Parameters . ifMatch1 ] , serializer } ; const extendImmutabilityPolicyOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . ImmutabilityPolicy , headersMapper : Mappers . BlobContainersExtendImmutabilityPolicyHeaders } } , requestBody : Parameters . parameters6 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 , Parameters . containerName ] , headerParameters : [ Parameters . accept , Parameters . contentType , Parameters . ifMatch1 ] , mediaType : "json" , serializer } ; const leaseOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . LeaseContainerResponse } } , requestBody : Parameters . parameters7 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 , Parameters . containerName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const objectLevelWormOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 , Parameters . containerName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ListContainerItems } } , queryParameters : [ Parameters . apiVersion , Parameters . maxpagesize , Parameters . filter , Parameters . include ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . accountName1 , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ;