@pulumi/azuredevops
Version:
A Pulumi package for creating and managing Azure DevOps.
161 lines • 8 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** 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, Object.assign(Object.assign({}, 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 ? state.body : undefined;
resourceInputs["completionEvent"] = state ? state.completionEvent : undefined;
resourceInputs["connectedServiceName"] = state ? state.connectedServiceName : undefined;
resourceInputs["connectedServiceNameSelector"] = state ? state.connectedServiceNameSelector : undefined;
resourceInputs["displayName"] = state ? state.displayName : undefined;
resourceInputs["headers"] = state ? state.headers : undefined;
resourceInputs["method"] = state ? state.method : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["retryInterval"] = state ? state.retryInterval : undefined;
resourceInputs["successCriteria"] = state ? state.successCriteria : undefined;
resourceInputs["targetResourceId"] = state ? state.targetResourceId : undefined;
resourceInputs["targetResourceType"] = state ? state.targetResourceType : undefined;
resourceInputs["timeout"] = state ? state.timeout : undefined;
resourceInputs["urlSuffix"] = state ? state.urlSuffix : undefined;
resourceInputs["variableGroupName"] = state ? state.variableGroupName : undefined;
resourceInputs["version"] = state ? state.version : undefined;
}
else {
const args = argsOrState;
if ((!args || args.connectedServiceName === undefined) && !opts.urn) {
throw new Error("Missing required property 'connectedServiceName'");
}
if ((!args || args.connectedServiceNameSelector === undefined) && !opts.urn) {
throw new Error("Missing required property 'connectedServiceNameSelector'");
}
if ((!args || args.displayName === undefined) && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if ((!args || args.method === undefined) && !opts.urn) {
throw new Error("Missing required property 'method'");
}
if ((!args || args.projectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
if ((!args || args.targetResourceId === undefined) && !opts.urn) {
throw new Error("Missing required property 'targetResourceId'");
}
if ((!args || args.targetResourceType === undefined) && !opts.urn) {
throw new Error("Missing required property 'targetResourceType'");
}
resourceInputs["body"] = args ? args.body : undefined;
resourceInputs["completionEvent"] = args ? args.completionEvent : undefined;
resourceInputs["connectedServiceName"] = args ? args.connectedServiceName : undefined;
resourceInputs["connectedServiceNameSelector"] = args ? args.connectedServiceNameSelector : undefined;
resourceInputs["displayName"] = args ? args.displayName : undefined;
resourceInputs["headers"] = args ? args.headers : undefined;
resourceInputs["method"] = args ? args.method : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["retryInterval"] = args ? args.retryInterval : undefined;
resourceInputs["successCriteria"] = args ? args.successCriteria : undefined;
resourceInputs["targetResourceId"] = args ? args.targetResourceId : undefined;
resourceInputs["targetResourceType"] = args ? args.targetResourceType : undefined;
resourceInputs["timeout"] = args ? args.timeout : undefined;
resourceInputs["urlSuffix"] = args ? args.urlSuffix : undefined;
resourceInputs["variableGroupName"] = args ? args.variableGroupName : undefined;
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