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

67 lines
3.2 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 The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite.
*
* @summary The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/FileSharesLease_Acquire.json
*/
function acquireALeaseOnAShare() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "res3376";
const accountName = "sto328";
const shareName = "share124";
const parameters = {
action: "Acquire",
breakPeriod: undefined,
leaseDuration: -1,
leaseId: undefined,
proposedLeaseId: undefined
};
const options = { parameters };
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = yield client.fileShares.lease(resourceGroupName, accountName, shareName, options);
console.log(result);
});
}
acquireALeaseOnAShare().catch(console.error);
/**
* This sample demonstrates how to The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite.
*
* @summary The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/FileSharesLease_Break.json
*/
function breakALeaseOnAShare() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "res3376";
const accountName = "sto328";
const shareName = "share12";
const parameters = {
action: "Break",
breakPeriod: undefined,
leaseDuration: undefined,
leaseId: "8698f513-fa75-44a1-b8eb-30ba336af27d",
proposedLeaseId: undefined
};
const options = { parameters };
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = yield client.fileShares.lease(resourceGroupName, accountName, shareName, options);
console.log(result);
});
}
breakALeaseOnAShare().catch(console.error);
//# sourceMappingURL=fileSharesLeaseSample.js.map