Files
2025-03-07 19:22:02 +01:00

78 lines
4.5 KiB
JavaScript

/*
* 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 { __awaiter } from "tslib";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageManagementClient } from "@azure/arm-storage";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container.
*
* @summary Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/BlobContainersPutDefaultEncryptionScope.json
*/
function putContainerWithDefaultEncryptionScope() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "res3376";
const accountName = "sto328";
const containerName = "container6185";
const blobContainer = {
defaultEncryptionScope: "encryptionscope185",
denyEncryptionScopeOverride: true
};
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = yield client.blobContainers.create(resourceGroupName, accountName, containerName, blobContainer);
console.log(result);
});
}
putContainerWithDefaultEncryptionScope().catch(console.error);
/**
* This sample demonstrates how to Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container.
*
* @summary Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/BlobContainersPutObjectLevelWorm.json
*/
function putContainerWithObjectLevelWorm() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "res3376";
const accountName = "sto328";
const containerName = "container6185";
const blobContainer = {
immutableStorageWithVersioning: { enabled: true }
};
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = yield client.blobContainers.create(resourceGroupName, accountName, containerName, blobContainer);
console.log(result);
});
}
putContainerWithObjectLevelWorm().catch(console.error);
/**
* This sample demonstrates how to Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container.
*
* @summary Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/BlobContainersPut.json
*/
function putContainers() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "res3376";
const accountName = "sto328";
const containerName = "container6185";
const blobContainer = {};
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = yield client.blobContainers.create(resourceGroupName, accountName, containerName, blobContainer);
console.log(result);
});
}
putContainers().catch(console.error);
//# sourceMappingURL=blobContainersCreateSample.js.map