@pulumi/azuredevops
Version:
A Pulumi package for creating and managing Azure DevOps.
178 lines • 8.7 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 azuredevops from "@pulumi/azuredevops";
* import * as azurerm from "@pulumi/azurerm";
*
* const example = new azuredevops.Project("example", {
* name: "Example Project",
* visibility: "private",
* versionControl: "Git",
* workItemTemplate: "Agile",
* description: "Managed by Pulumi",
* });
* const identity = new azurerm.index.ResourceGroup("identity", {
* name: "identity",
* location: "UK South",
* });
* const exampleUserAssignedIdentity = new azurerm.index.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 azurerm.index.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, { ...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?.appObjectId;
resourceInputs["authorization"] = state?.authorization;
resourceInputs["azSpnRoleAssignmentId"] = state?.azSpnRoleAssignmentId;
resourceInputs["azSpnRolePermissions"] = state?.azSpnRolePermissions;
resourceInputs["azurecrName"] = state?.azurecrName;
resourceInputs["azurecrSpnTenantid"] = state?.azurecrSpnTenantid;
resourceInputs["azurecrSubscriptionId"] = state?.azurecrSubscriptionId;
resourceInputs["azurecrSubscriptionName"] = state?.azurecrSubscriptionName;
resourceInputs["credentials"] = state?.credentials;
resourceInputs["description"] = state?.description;
resourceInputs["projectId"] = state?.projectId;
resourceInputs["resourceGroup"] = state?.resourceGroup;
resourceInputs["serviceEndpointAuthenticationScheme"] = state?.serviceEndpointAuthenticationScheme;
resourceInputs["serviceEndpointName"] = state?.serviceEndpointName;
resourceInputs["servicePrincipalId"] = state?.servicePrincipalId;
resourceInputs["spnObjectId"] = state?.spnObjectId;
resourceInputs["workloadIdentityFederationIssuer"] = state?.workloadIdentityFederationIssuer;
resourceInputs["workloadIdentityFederationSubject"] = state?.workloadIdentityFederationSubject;
}
else {
const args = argsOrState;
if (args?.projectId === undefined && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
if (args?.serviceEndpointName === undefined && !opts.urn) {
throw new Error("Missing required property 'serviceEndpointName'");
}
resourceInputs["azurecrName"] = args?.azurecrName;
resourceInputs["azurecrSpnTenantid"] = args?.azurecrSpnTenantid;
resourceInputs["azurecrSubscriptionId"] = args?.azurecrSubscriptionId;
resourceInputs["azurecrSubscriptionName"] = args?.azurecrSubscriptionName;
resourceInputs["credentials"] = args?.credentials;
resourceInputs["description"] = args?.description;
resourceInputs["projectId"] = args?.projectId;
resourceInputs["resourceGroup"] = args?.resourceGroup;
resourceInputs["serviceEndpointAuthenticationScheme"] = args?.serviceEndpointAuthenticationScheme;
resourceInputs["serviceEndpointName"] = args?.serviceEndpointName;
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