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

118 lines
5.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 Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules.
*
* @summary Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/FileServicesPut.json
*/
function putFileServices() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "res4410";
const accountName = "sto8607";
const parameters = {
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
}
]
}
};
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = yield client.fileServices.setServiceProperties(resourceGroupName, accountName, parameters);
console.log(result);
});
}
putFileServices().catch(console.error);
/**
* This sample demonstrates how to Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules.
*
* @summary Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/FileServicesPut_EnableSMBMultichannel.json
*/
function putFileServicesEnableSmbMultichannel() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "res4410";
const accountName = "sto8607";
const parameters = {
protocolSettings: { smb: { multichannel: { enabled: true } } }
};
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = yield client.fileServices.setServiceProperties(resourceGroupName, accountName, parameters);
console.log(result);
});
}
putFileServicesEnableSmbMultichannel().catch(console.error);
/**
* This sample demonstrates how to Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules.
*
* @summary Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/FileServicesPut_EnableSecureSmbFeatures.json
*/
function putFileServicesEnableSecureSmbFeatures() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "res4410";
const accountName = "sto8607";
const parameters = {
protocolSettings: {
smb: {
authenticationMethods: "NTLMv2;Kerberos",
channelEncryption: "AES-128-CCM;AES-128-GCM;AES-256-GCM",
kerberosTicketEncryption: "RC4-HMAC;AES-256",
versions: "SMB2.1;SMB3.0;SMB3.1.1"
}
}
};
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = yield client.fileServices.setServiceProperties(resourceGroupName, accountName, parameters);
console.log(result);
});
}
putFileServicesEnableSecureSmbFeatures().catch(console.error);
//# sourceMappingURL=fileServicesSetServicePropertiesSample.js.map