UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

132 lines 5.06 kB
"use strict"; // *** 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.SourceCredential = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a CodeBuild Source Credentials Resource. * * > **NOTE: * ** [Codebuild only allows a single credential per given server type in a given region](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild.GitHubSourceCredentials.html). * Therefore, when you define `aws.codebuild.SourceCredential`, * `aws.codebuild.Project` resource defined in the same module will use it. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.codebuild.SourceCredential("example", { * authType: "PERSONAL_ACCESS_TOKEN", * serverType: "GITHUB", * token: "example", * }); * ``` * * ### Bitbucket Server Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.codebuild.SourceCredential("example", { * authType: "BASIC_AUTH", * serverType: "BITBUCKET", * token: "example", * userName: "test-user", * }); * ``` * * ### AWS CodeStar Connection Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.codebuild.SourceCredential("example", { * authType: "CODECONNECTIONS", * serverType: "GITHUB", * token: "arn:aws:codestar-connections:us-east-1:123456789012:connection/guid-string", * }); * ``` * * ## Import * * ### Identity Schema * * #### Required * * - `arn` (String) Amazon Resource Name (ARN) of the CodeBuild source credential. * * Using `pulumi import`, import CodeBuild Source Credential using the CodeBuild Source Credential arn. For example: * * console * * % pulumi import aws_codebuild_source_credential.example arn:aws:codebuild:us-west-2:123456789:token:github */ class SourceCredential extends pulumi.CustomResource { /** * Get an existing SourceCredential 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 SourceCredential(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of SourceCredential. 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'] === SourceCredential.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["authType"] = state?.authType; resourceInputs["region"] = state?.region; resourceInputs["serverType"] = state?.serverType; resourceInputs["token"] = state?.token; resourceInputs["userName"] = state?.userName; } else { const args = argsOrState; if (args?.authType === undefined && !opts.urn) { throw new Error("Missing required property 'authType'"); } if (args?.serverType === undefined && !opts.urn) { throw new Error("Missing required property 'serverType'"); } if (args?.token === undefined && !opts.urn) { throw new Error("Missing required property 'token'"); } resourceInputs["authType"] = args?.authType; resourceInputs["region"] = args?.region; resourceInputs["serverType"] = args?.serverType; resourceInputs["token"] = args?.token ? pulumi.secret(args.token) : undefined; resourceInputs["userName"] = args?.userName; resourceInputs["arn"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["token"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(SourceCredential.__pulumiType, name, resourceInputs, opts); } } exports.SourceCredential = SourceCredential; /** @internal */ SourceCredential.__pulumiType = 'aws:codebuild/sourceCredential:SourceCredential'; //# sourceMappingURL=sourceCredential.js.map