@pulumi/azuredevops
Version:
A Pulumi package for creating and managing Azure DevOps.
161 lines • 7.31 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.CheckRestApi = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a Rest API check on a resource within Azure DevOps.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuredevops from "@pulumi/azuredevops";
*
* const example = new azuredevops.Project("example", {name: "Example Project"});
* const exampleServiceEndpointGeneric = new azuredevops.ServiceEndpointGeneric("example", {
* projectId: example.id,
* serverUrl: "https://some-server.example.com",
* serviceEndpointName: "Example Generic",
* username: "username",
* password: "password",
* description: "Managed by Pulumi",
* });
* const exampleAzure = new azuredevops.ServiceEndpointGeneric("example_azure", {
* projectId: example.id,
* serverUrl: "https://dev.azure.com/",
* serviceEndpointName: "Example Generic Azure",
* username: "username",
* password: "dummy",
* });
* const exampleVariableGroup = new azuredevops.VariableGroup("example", {
* projectId: example.id,
* name: "Example Variable Group",
* allowAccess: true,
* variables: [{
* name: "FOO",
* value: "BAR",
* }],
* });
* const exampleCheckRestApi = new azuredevops.CheckRestApi("example", {
* projectId: example.id,
* targetResourceId: exampleServiceEndpointGeneric.id,
* targetResourceType: "endpoint",
* displayName: "Example REST API Check",
* connectedServiceNameSelector: "connectedServiceName",
* connectedServiceName: exampleAzure.serviceEndpointName,
* method: "POST",
* headers: "{\"contentType\":\"application/json\"}",
* body: "{\"params\":\"value\"}",
* completionEvent: "ApiResponse",
* successCriteria: "eq(root['status'], '200')",
* urlSuffix: "user/1",
* retryInterval: 4000,
* variableGroupName: exampleVariableGroup.name,
* timeout: 40000,
* });
* ```
*
* ## Relevant Links
*
* - [Define approvals and checks](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass)
*
* ## Import
*
* Importing this resource is not supported.
*/
class CheckRestApi extends pulumi.CustomResource {
/**
* Get an existing CheckRestApi resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new CheckRestApi(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of CheckRestApi. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === CheckRestApi.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["body"] = state?.body;
resourceInputs["completionEvent"] = state?.completionEvent;
resourceInputs["connectedServiceName"] = state?.connectedServiceName;
resourceInputs["connectedServiceNameSelector"] = state?.connectedServiceNameSelector;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["headers"] = state?.headers;
resourceInputs["method"] = state?.method;
resourceInputs["projectId"] = state?.projectId;
resourceInputs["retryInterval"] = state?.retryInterval;
resourceInputs["successCriteria"] = state?.successCriteria;
resourceInputs["targetResourceId"] = state?.targetResourceId;
resourceInputs["targetResourceType"] = state?.targetResourceType;
resourceInputs["timeout"] = state?.timeout;
resourceInputs["urlSuffix"] = state?.urlSuffix;
resourceInputs["variableGroupName"] = state?.variableGroupName;
resourceInputs["version"] = state?.version;
}
else {
const args = argsOrState;
if (args?.connectedServiceName === undefined && !opts.urn) {
throw new Error("Missing required property 'connectedServiceName'");
}
if (args?.connectedServiceNameSelector === undefined && !opts.urn) {
throw new Error("Missing required property 'connectedServiceNameSelector'");
}
if (args?.displayName === undefined && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if (args?.method === undefined && !opts.urn) {
throw new Error("Missing required property 'method'");
}
if (args?.projectId === undefined && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
if (args?.targetResourceId === undefined && !opts.urn) {
throw new Error("Missing required property 'targetResourceId'");
}
if (args?.targetResourceType === undefined && !opts.urn) {
throw new Error("Missing required property 'targetResourceType'");
}
resourceInputs["body"] = args?.body;
resourceInputs["completionEvent"] = args?.completionEvent;
resourceInputs["connectedServiceName"] = args?.connectedServiceName;
resourceInputs["connectedServiceNameSelector"] = args?.connectedServiceNameSelector;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["headers"] = args?.headers;
resourceInputs["method"] = args?.method;
resourceInputs["projectId"] = args?.projectId;
resourceInputs["retryInterval"] = args?.retryInterval;
resourceInputs["successCriteria"] = args?.successCriteria;
resourceInputs["targetResourceId"] = args?.targetResourceId;
resourceInputs["targetResourceType"] = args?.targetResourceType;
resourceInputs["timeout"] = args?.timeout;
resourceInputs["urlSuffix"] = args?.urlSuffix;
resourceInputs["variableGroupName"] = args?.variableGroupName;
resourceInputs["version"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(CheckRestApi.__pulumiType, name, resourceInputs, opts);
}
}
exports.CheckRestApi = CheckRestApi;
/** @internal */
CheckRestApi.__pulumiType = 'azuredevops:index/checkRestApi:CheckRestApi';
//# sourceMappingURL=checkRestApi.js.map