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

125 lines
5.9 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* 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 Sets the properties of a storage accounts Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
*
* @summary Sets the properties of a storage accounts Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/BlobServicesPutAllowPermanentDelete.json
*/
function blobServicesPutAllowPermanentDelete() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "res4410";
const accountName = "sto8607";
const parameters = {
deleteRetentionPolicy: {
allowPermanentDelete: true,
days: 300,
enabled: true
},
isVersioningEnabled: true
};
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = yield client.blobServices.setServiceProperties(resourceGroupName, accountName, parameters);
console.log(result);
});
}
blobServicesPutAllowPermanentDelete().catch(console.error);
/**
* This sample demonstrates how to Sets the properties of a storage accounts Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
*
* @summary Sets the properties of a storage accounts Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/BlobServicesPutLastAccessTimeBasedTracking.json
*/
function blobServicesPutLastAccessTimeBasedTracking() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "res4410";
const accountName = "sto8607";
const parameters = {
lastAccessTimeTrackingPolicy: {
name: "AccessTimeTracking",
blobType: ["blockBlob"],
enable: true,
trackingGranularityInDays: 1
}
};
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = yield client.blobServices.setServiceProperties(resourceGroupName, accountName, parameters);
console.log(result);
});
}
blobServicesPutLastAccessTimeBasedTracking().catch(console.error);
/**
* This sample demonstrates how to Sets the properties of a storage accounts Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
*
* @summary Sets the properties of a storage accounts Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/BlobServicesPut.json
*/
function putBlobServices() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "res4410";
const accountName = "sto8607";
const parameters = {
changeFeed: { enabled: true, retentionInDays: 7 },
cors: {
corsRules: [
{
allowedHeaders: [
"x-ms-meta-abc",
"x-ms-meta-data*",
"x-ms-meta-target*"
],
allowedMethods: ["GET", "HEAD", "POST", "OPTIONS", "MERGE", "PUT"],
allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"],
exposedHeaders: ["x-ms-meta-*"],
maxAgeInSeconds: 100
},
{
allowedHeaders: ["*"],
allowedMethods: ["GET"],
allowedOrigins: ["*"],
exposedHeaders: ["*"],
maxAgeInSeconds: 2
},
{
allowedHeaders: ["x-ms-meta-12345675754564*"],
allowedMethods: ["GET", "PUT"],
allowedOrigins: [
"http://www.abc23.com",
"https://www.fabrikam.com/*"
],
exposedHeaders: [
"x-ms-meta-abc",
"x-ms-meta-data*",
"x -ms-meta-target*"
],
maxAgeInSeconds: 2000
}
]
},
defaultServiceVersion: "2017-07-29",
deleteRetentionPolicy: { days: 300, enabled: true },
isVersioningEnabled: true
};
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = yield client.blobServices.setServiceProperties(resourceGroupName, accountName, parameters);
console.log(result);
});
}
putBlobServices().catch(console.error);
//# sourceMappingURL=blobServicesSetServicePropertiesSample.js.map