@pulumi/azuredevops
Version:
A Pulumi package for creating and managing Azure DevOps.
178 lines • 9.27 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.ServiceEndpointAzureEcr = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a Azure Container Registry service endpoint within Azure DevOps.
*
* ## Example Usage
*
* ### Authorize with Service Principal
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuredevops from "@pulumi/azuredevops";
*
* const example = new azuredevops.Project("example", {
* name: "Example Project",
* visibility: "private",
* versionControl: "Git",
* workItemTemplate: "Agile",
* description: "Managed by Pulumi",
* });
* // azure container registry service connection
* const exampleServiceEndpointAzureEcr = new azuredevops.ServiceEndpointAzureEcr("example", {
* projectId: example.id,
* serviceEndpointName: "Example AzureCR",
* resourceGroup: "example-rg",
* azurecrSpnTenantid: "00000000-0000-0000-0000-000000000000",
* azurecrName: "ExampleAcr",
* azurecrSubscriptionId: "00000000-0000-0000-0000-000000000000",
* azurecrSubscriptionName: "subscription name",
* });
* ```
*
* ### Authorize with WorkloadIdentityFederation
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* import * as azuredevops from "@pulumi/azuredevops";
*
* const example = new azuredevops.Project("example", {
* name: "Example Project",
* visibility: "private",
* versionControl: "Git",
* workItemTemplate: "Agile",
* description: "Managed by Pulumi",
* });
* const identity = new azure.core.ResourceGroup("identity", {
* name: "identity",
* location: "UK South",
* });
* const exampleUserAssignedIdentity = new azure.authorization.UserAssignedIdentity("example", {
* location: identity.location,
* name: "example-identity",
* resourceGroupName: identity.name,
* });
* // azure container registry service connection
* const exampleServiceEndpointAzureEcr = new azuredevops.ServiceEndpointAzureEcr("example", {
* projectId: example.id,
* resourceGroup: "Example AzureCR ResourceGroup",
* serviceEndpointName: "Example AzureCR",
* serviceEndpointAuthenticationScheme: "WorkloadIdentityFederation",
* azurecrSpnTenantid: "00000000-0000-0000-0000-000000000000",
* azurecrName: "ExampleAcr",
* azurecrSubscriptionId: "00000000-0000-0000-0000-000000000000",
* azurecrSubscriptionName: "subscription name",
* credentials: {
* serviceprincipalid: exampleUserAssignedIdentity.clientId,
* },
* });
* const exampleFederatedIdentityCredential = new azure.armmsi.FederatedIdentityCredential("example", {
* name: "example-federated-credential",
* resourceGroupName: identity.name,
* parentId: exampleUserAssignedIdentity.id,
* audience: "api://AzureADTokenExchange",
* issuer: exampleServiceEndpointAzureEcr.workloadIdentityFederationIssuer,
* subject: exampleServiceEndpointAzureEcr.workloadIdentityFederationSubject,
* });
* ```
*
* ## Relevant Links
*
* - [Azure DevOps Service REST API 7.0 - Service Endpoints](https://docs.microsoft.com/en-us/rest/api/azure/devops/serviceendpoint/endpoints?view=azure-devops-rest-7.0)
* - [Azure Container Registry REST API](https://docs.microsoft.com/en-us/rest/api/containerregistry/)
*
* ## Import
*
* Azure DevOps Azure Container Registry Service Endpoint can be imported using **projectID/serviceEndpointID** or **projectName/serviceEndpointID**
*
* ```sh
* $ pulumi import azuredevops:index/serviceEndpointAzureEcr:ServiceEndpointAzureEcr example 00000000-0000-0000-0000-000000000000/00000000-0000-0000-0000-000000000000
* ```
*/
class ServiceEndpointAzureEcr extends pulumi.CustomResource {
/**
* Get an existing ServiceEndpointAzureEcr 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 ServiceEndpointAzureEcr(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ServiceEndpointAzureEcr. 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'] === ServiceEndpointAzureEcr.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["appObjectId"] = state ? state.appObjectId : undefined;
resourceInputs["authorization"] = state ? state.authorization : undefined;
resourceInputs["azSpnRoleAssignmentId"] = state ? state.azSpnRoleAssignmentId : undefined;
resourceInputs["azSpnRolePermissions"] = state ? state.azSpnRolePermissions : undefined;
resourceInputs["azurecrName"] = state ? state.azurecrName : undefined;
resourceInputs["azurecrSpnTenantid"] = state ? state.azurecrSpnTenantid : undefined;
resourceInputs["azurecrSubscriptionId"] = state ? state.azurecrSubscriptionId : undefined;
resourceInputs["azurecrSubscriptionName"] = state ? state.azurecrSubscriptionName : undefined;
resourceInputs["credentials"] = state ? state.credentials : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["resourceGroup"] = state ? state.resourceGroup : undefined;
resourceInputs["serviceEndpointAuthenticationScheme"] = state ? state.serviceEndpointAuthenticationScheme : undefined;
resourceInputs["serviceEndpointName"] = state ? state.serviceEndpointName : undefined;
resourceInputs["servicePrincipalId"] = state ? state.servicePrincipalId : undefined;
resourceInputs["spnObjectId"] = state ? state.spnObjectId : undefined;
resourceInputs["workloadIdentityFederationIssuer"] = state ? state.workloadIdentityFederationIssuer : undefined;
resourceInputs["workloadIdentityFederationSubject"] = state ? state.workloadIdentityFederationSubject : undefined;
}
else {
const args = argsOrState;
if ((!args || args.projectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
if ((!args || args.serviceEndpointName === undefined) && !opts.urn) {
throw new Error("Missing required property 'serviceEndpointName'");
}
resourceInputs["azurecrName"] = args ? args.azurecrName : undefined;
resourceInputs["azurecrSpnTenantid"] = args ? args.azurecrSpnTenantid : undefined;
resourceInputs["azurecrSubscriptionId"] = args ? args.azurecrSubscriptionId : undefined;
resourceInputs["azurecrSubscriptionName"] = args ? args.azurecrSubscriptionName : undefined;
resourceInputs["credentials"] = args ? args.credentials : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["resourceGroup"] = args ? args.resourceGroup : undefined;
resourceInputs["serviceEndpointAuthenticationScheme"] = args ? args.serviceEndpointAuthenticationScheme : undefined;
resourceInputs["serviceEndpointName"] = args ? args.serviceEndpointName : undefined;
resourceInputs["appObjectId"] = undefined /*out*/;
resourceInputs["authorization"] = undefined /*out*/;
resourceInputs["azSpnRoleAssignmentId"] = undefined /*out*/;
resourceInputs["azSpnRolePermissions"] = undefined /*out*/;
resourceInputs["servicePrincipalId"] = undefined /*out*/;
resourceInputs["spnObjectId"] = undefined /*out*/;
resourceInputs["workloadIdentityFederationIssuer"] = undefined /*out*/;
resourceInputs["workloadIdentityFederationSubject"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ServiceEndpointAzureEcr.__pulumiType, name, resourceInputs, opts);
}
}
exports.ServiceEndpointAzureEcr = ServiceEndpointAzureEcr;
/** @internal */
ServiceEndpointAzureEcr.__pulumiType = 'azuredevops:index/serviceEndpointAzureEcr:ServiceEndpointAzureEcr';
//# sourceMappingURL=serviceEndpointAzureEcr.js.map