Outlook_Addin_LLM/node_modules/@azure/arm-resources/dist-esm/samples-dev/deploymentsCreateOrUpdateSample.js

123 lines
6.3 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 { ResourceManagementClient } from "@azure/arm-resources";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to You can provide the template and parameters directly in the request or link to JSON files.
*
* @summary You can provide the template and parameters directly in the request or link to JSON files.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentResourceGroup.json
*/
function createADeploymentThatWillDeployATemplateWithAUriAndQueryString() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "00000000-0000-0000-0000-000000000001";
const resourceGroupName = "my-resource-group";
const deploymentName = "my-deployment";
const parameters = {
properties: {
mode: "Incremental",
parameters: {},
templateLink: {
queryString: "sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=xxxxxxxx0xxxxxxxxxxxxx%2bxxxxxxxxxxxxxxxxxxxx%3d",
uri: "https://example.com/exampleTemplate.json"
}
}
};
const credential = new DefaultAzureCredential();
const client = new ResourceManagementClient(credential, subscriptionId);
const result = yield client.deployments.beginCreateOrUpdateAndWait(resourceGroupName, deploymentName, parameters);
console.log(result);
});
}
createADeploymentThatWillDeployATemplateWithAUriAndQueryString().catch(console.error);
/**
* This sample demonstrates how to You can provide the template and parameters directly in the request or link to JSON files.
*
* @summary You can provide the template and parameters directly in the request or link to JSON files.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentResourceGroupTemplateSpecsWithId.json
*/
function createADeploymentThatWillDeployATemplateSpecWithTheGivenResourceId() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "00000000-0000-0000-0000-000000000001";
const resourceGroupName = "my-resource-group";
const deploymentName = "my-deployment";
const parameters = {
properties: {
mode: "Incremental",
parameters: {},
templateLink: {
id: "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1"
}
}
};
const credential = new DefaultAzureCredential();
const client = new ResourceManagementClient(credential, subscriptionId);
const result = yield client.deployments.beginCreateOrUpdateAndWait(resourceGroupName, deploymentName, parameters);
console.log(result);
});
}
createADeploymentThatWillDeployATemplateSpecWithTheGivenResourceId().catch(console.error);
/**
* This sample demonstrates how to You can provide the template and parameters directly in the request or link to JSON files.
*
* @summary You can provide the template and parameters directly in the request or link to JSON files.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentWithOnErrorDeploymentSpecificDeployment.json
*/
function createADeploymentThatWillRedeployAnotherDeploymentOnFailure() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const resourceGroupName = "my-resource-group";
const deploymentName = "my-deployment";
const parameters = {
properties: {
mode: "Complete",
onErrorDeployment: {
type: "SpecificDeployment",
deploymentName: "name-of-deployment-to-use"
},
parameters: {},
templateLink: { uri: "https://example.com/exampleTemplate.json" }
}
};
const credential = new DefaultAzureCredential();
const client = new ResourceManagementClient(credential, subscriptionId);
const result = yield client.deployments.beginCreateOrUpdateAndWait(resourceGroupName, deploymentName, parameters);
console.log(result);
});
}
createADeploymentThatWillRedeployAnotherDeploymentOnFailure().catch(console.error);
/**
* This sample demonstrates how to You can provide the template and parameters directly in the request or link to JSON files.
*
* @summary You can provide the template and parameters directly in the request or link to JSON files.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentWithOnErrorDeploymentLastSuccessful.json
*/
function createADeploymentThatWillRedeployTheLastSuccessfulDeploymentOnFailure() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const resourceGroupName = "my-resource-group";
const deploymentName = "my-deployment";
const parameters = {
properties: {
mode: "Complete",
onErrorDeployment: { type: "LastSuccessful" },
parameters: {},
templateLink: { uri: "https://example.com/exampleTemplate.json" }
}
};
const credential = new DefaultAzureCredential();
const client = new ResourceManagementClient(credential, subscriptionId);
const result = yield client.deployments.beginCreateOrUpdateAndWait(resourceGroupName, deploymentName, parameters);
console.log(result);
});
}
createADeploymentThatWillRedeployTheLastSuccessfulDeploymentOnFailure().catch(console.error);
//# sourceMappingURL=deploymentsCreateOrUpdateSample.js.map