Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.azure.datafactory.kotlin.CredentialServicePrincipal.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.datafactory.kotlin
import com.pulumi.azure.datafactory.kotlin.outputs.CredentialServicePrincipalServicePrincipalKey
import com.pulumi.azure.datafactory.kotlin.outputs.CredentialServicePrincipalServicePrincipalKey.Companion.toKotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
/**
* Builder for [CredentialServicePrincipal].
*/
@PulumiTagMarker
public class CredentialServicePrincipalResourceBuilder internal constructor() {
public var name: String? = null
public var args: CredentialServicePrincipalArgs = CredentialServicePrincipalArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend CredentialServicePrincipalArgsBuilder.() -> Unit) {
val builder = CredentialServicePrincipalArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): CredentialServicePrincipal {
val builtJavaResource =
com.pulumi.azure.datafactory.CredentialServicePrincipal(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return CredentialServicePrincipal(builtJavaResource)
}
}
/**
* Manage a Data Factory Service Principal credential resource. These resources are used by Data Factory to access data sources.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const current = azure.core.getClientConfig({});
* const example = new azure.core.ResourceGroup("example", {
* name: "example-resources",
* location: "westeurope",
* });
* const exampleFactory = new azure.datafactory.Factory("example", {
* name: "example",
* location: example.location,
* resourceGroupName: example.name,
* });
* const exampleKeyVault = new azure.keyvault.KeyVault("example", {
* name: "example",
* location: example.location,
* resourceGroupName: example.name,
* tenantId: current.then(current => current.tenantId),
* skuName: "premium",
* softDeleteRetentionDays: 7,
* accessPolicies: [{
* tenantId: current.then(current => current.tenantId),
* objectId: current.then(current => current.objectId),
* keyPermissions: [
* "Create",
* "Get",
* ],
* secretPermissions: [
* "Set",
* "Get",
* "Delete",
* "Purge",
* "Recover",
* ],
* }],
* });
* const exampleSecret = new azure.keyvault.Secret("example", {
* name: "example",
* value: "example-secret",
* keyVaultId: exampleKeyVault.id,
* });
* const exampleLinkedServiceKeyVault = new azure.datafactory.LinkedServiceKeyVault("example", {
* name: "example",
* dataFactoryId: exampleFactory.id,
* keyVaultId: exampleKeyVault.id,
* });
* const exampleCredentialServicePrincipal = new azure.datafactory.CredentialServicePrincipal("example", {
* name: "example",
* description: "example description",
* dataFactoryId: exampleFactory.id,
* tenantId: current.then(current => current.tenantId),
* servicePrincipalId: current.then(current => current.clientId),
* servicePrincipalKey: {
* linkedServiceName: exampleLinkedServiceKeyVault.name,
* secretName: exampleSecret.name,
* secretVersion: exampleSecret.version,
* },
* annotations: [
* "1",
* "2",
* ],
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* current = azure.core.get_client_config()
* example = azure.core.ResourceGroup("example",
* name="example-resources",
* location="westeurope")
* example_factory = azure.datafactory.Factory("example",
* name="example",
* location=example.location,
* resource_group_name=example.name)
* example_key_vault = azure.keyvault.KeyVault("example",
* name="example",
* location=example.location,
* resource_group_name=example.name,
* tenant_id=current.tenant_id,
* sku_name="premium",
* soft_delete_retention_days=7,
* access_policies=[{
* "tenant_id": current.tenant_id,
* "object_id": current.object_id,
* "key_permissions": [
* "Create",
* "Get",
* ],
* "secret_permissions": [
* "Set",
* "Get",
* "Delete",
* "Purge",
* "Recover",
* ],
* }])
* example_secret = azure.keyvault.Secret("example",
* name="example",
* value="example-secret",
* key_vault_id=example_key_vault.id)
* example_linked_service_key_vault = azure.datafactory.LinkedServiceKeyVault("example",
* name="example",
* data_factory_id=example_factory.id,
* key_vault_id=example_key_vault.id)
* example_credential_service_principal = azure.datafactory.CredentialServicePrincipal("example",
* name="example",
* description="example description",
* data_factory_id=example_factory.id,
* tenant_id=current.tenant_id,
* service_principal_id=current.client_id,
* service_principal_key={
* "linked_service_name": example_linked_service_key_vault.name,
* "secret_name": example_secret.name,
* "secret_version": example_secret.version,
* },
* annotations=[
* "1",
* "2",
* ])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var current = Azure.Core.GetClientConfig.Invoke();
* var example = new Azure.Core.ResourceGroup("example", new()
* {
* Name = "example-resources",
* Location = "westeurope",
* });
* var exampleFactory = new Azure.DataFactory.Factory("example", new()
* {
* Name = "example",
* Location = example.Location,
* ResourceGroupName = example.Name,
* });
* var exampleKeyVault = new Azure.KeyVault.KeyVault("example", new()
* {
* Name = "example",
* Location = example.Location,
* ResourceGroupName = example.Name,
* TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
* SkuName = "premium",
* SoftDeleteRetentionDays = 7,
* AccessPolicies = new[]
* {
* new Azure.KeyVault.Inputs.KeyVaultAccessPolicyArgs
* {
* TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
* ObjectId = current.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
* KeyPermissions = new[]
* {
* "Create",
* "Get",
* },
* SecretPermissions = new[]
* {
* "Set",
* "Get",
* "Delete",
* "Purge",
* "Recover",
* },
* },
* },
* });
* var exampleSecret = new Azure.KeyVault.Secret("example", new()
* {
* Name = "example",
* Value = "example-secret",
* KeyVaultId = exampleKeyVault.Id,
* });
* var exampleLinkedServiceKeyVault = new Azure.DataFactory.LinkedServiceKeyVault("example", new()
* {
* Name = "example",
* DataFactoryId = exampleFactory.Id,
* KeyVaultId = exampleKeyVault.Id,
* });
* var exampleCredentialServicePrincipal = new Azure.DataFactory.CredentialServicePrincipal("example", new()
* {
* Name = "example",
* Description = "example description",
* DataFactoryId = exampleFactory.Id,
* TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
* ServicePrincipalId = current.Apply(getClientConfigResult => getClientConfigResult.ClientId),
* ServicePrincipalKey = new Azure.DataFactory.Inputs.CredentialServicePrincipalServicePrincipalKeyArgs
* {
* LinkedServiceName = exampleLinkedServiceKeyVault.Name,
* SecretName = exampleSecret.Name,
* SecretVersion = exampleSecret.Version,
* },
* Annotations = new[]
* {
* "1",
* "2",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/datafactory"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/keyvault"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* current, err := core.GetClientConfig(ctx, nil, nil)
* if err != nil {
* return err
* }
* example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
* Name: pulumi.String("example-resources"),
* Location: pulumi.String("westeurope"),
* })
* if err != nil {
* return err
* }
* exampleFactory, err := datafactory.NewFactory(ctx, "example", &datafactory.FactoryArgs{
* Name: pulumi.String("example"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* })
* if err != nil {
* return err
* }
* exampleKeyVault, err := keyvault.NewKeyVault(ctx, "example", &keyvault.KeyVaultArgs{
* Name: pulumi.String("example"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* TenantId: pulumi.String(current.TenantId),
* SkuName: pulumi.String("premium"),
* SoftDeleteRetentionDays: pulumi.Int(7),
* AccessPolicies: keyvault.KeyVaultAccessPolicyArray{
* &keyvault.KeyVaultAccessPolicyArgs{
* TenantId: pulumi.String(current.TenantId),
* ObjectId: pulumi.String(current.ObjectId),
* KeyPermissions: pulumi.StringArray{
* pulumi.String("Create"),
* pulumi.String("Get"),
* },
* SecretPermissions: pulumi.StringArray{
* pulumi.String("Set"),
* pulumi.String("Get"),
* pulumi.String("Delete"),
* pulumi.String("Purge"),
* pulumi.String("Recover"),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* exampleSecret, err := keyvault.NewSecret(ctx, "example", &keyvault.SecretArgs{
* Name: pulumi.String("example"),
* Value: pulumi.String("example-secret"),
* KeyVaultId: exampleKeyVault.ID(),
* })
* if err != nil {
* return err
* }
* exampleLinkedServiceKeyVault, err := datafactory.NewLinkedServiceKeyVault(ctx, "example", &datafactory.LinkedServiceKeyVaultArgs{
* Name: pulumi.String("example"),
* DataFactoryId: exampleFactory.ID(),
* KeyVaultId: exampleKeyVault.ID(),
* })
* if err != nil {
* return err
* }
* _, err = datafactory.NewCredentialServicePrincipal(ctx, "example", &datafactory.CredentialServicePrincipalArgs{
* Name: pulumi.String("example"),
* Description: pulumi.String("example description"),
* DataFactoryId: exampleFactory.ID(),
* TenantId: pulumi.String(current.TenantId),
* ServicePrincipalId: pulumi.String(current.ClientId),
* ServicePrincipalKey: &datafactory.CredentialServicePrincipalServicePrincipalKeyArgs{
* LinkedServiceName: exampleLinkedServiceKeyVault.Name,
* SecretName: exampleSecret.Name,
* SecretVersion: exampleSecret.Version,
* },
* Annotations: pulumi.StringArray{
* pulumi.String("1"),
* pulumi.String("2"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azure.core.CoreFunctions;
* import com.pulumi.azure.core.ResourceGroup;
* import com.pulumi.azure.core.ResourceGroupArgs;
* import com.pulumi.azure.datafactory.Factory;
* import com.pulumi.azure.datafactory.FactoryArgs;
* import com.pulumi.azure.keyvault.KeyVault;
* import com.pulumi.azure.keyvault.KeyVaultArgs;
* import com.pulumi.azure.keyvault.inputs.KeyVaultAccessPolicyArgs;
* import com.pulumi.azure.keyvault.Secret;
* import com.pulumi.azure.keyvault.SecretArgs;
* import com.pulumi.azure.datafactory.LinkedServiceKeyVault;
* import com.pulumi.azure.datafactory.LinkedServiceKeyVaultArgs;
* import com.pulumi.azure.datafactory.CredentialServicePrincipal;
* import com.pulumi.azure.datafactory.CredentialServicePrincipalArgs;
* import com.pulumi.azure.datafactory.inputs.CredentialServicePrincipalServicePrincipalKeyArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* final var current = CoreFunctions.getClientConfig();
* var example = new ResourceGroup("example", ResourceGroupArgs.builder()
* .name("example-resources")
* .location("westeurope")
* .build());
* var exampleFactory = new Factory("exampleFactory", FactoryArgs.builder()
* .name("example")
* .location(example.location())
* .resourceGroupName(example.name())
* .build());
* var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()
* .name("example")
* .location(example.location())
* .resourceGroupName(example.name())
* .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
* .skuName("premium")
* .softDeleteRetentionDays(7)
* .accessPolicies(KeyVaultAccessPolicyArgs.builder()
* .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
* .objectId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
* .keyPermissions(
* "Create",
* "Get")
* .secretPermissions(
* "Set",
* "Get",
* "Delete",
* "Purge",
* "Recover")
* .build())
* .build());
* var exampleSecret = new Secret("exampleSecret", SecretArgs.builder()
* .name("example")
* .value("example-secret")
* .keyVaultId(exampleKeyVault.id())
* .build());
* var exampleLinkedServiceKeyVault = new LinkedServiceKeyVault("exampleLinkedServiceKeyVault", LinkedServiceKeyVaultArgs.builder()
* .name("example")
* .dataFactoryId(exampleFactory.id())
* .keyVaultId(exampleKeyVault.id())
* .build());
* var exampleCredentialServicePrincipal = new CredentialServicePrincipal("exampleCredentialServicePrincipal", CredentialServicePrincipalArgs.builder()
* .name("example")
* .description("example description")
* .dataFactoryId(exampleFactory.id())
* .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
* .servicePrincipalId(current.applyValue(getClientConfigResult -> getClientConfigResult.clientId()))
* .servicePrincipalKey(CredentialServicePrincipalServicePrincipalKeyArgs.builder()
* .linkedServiceName(exampleLinkedServiceKeyVault.name())
* .secretName(exampleSecret.name())
* .secretVersion(exampleSecret.version())
* .build())
* .annotations(
* "1",
* "2")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* location: westeurope
* exampleFactory:
* type: azure:datafactory:Factory
* name: example
* properties:
* name: example
* location: ${example.location}
* resourceGroupName: ${example.name}
* exampleKeyVault:
* type: azure:keyvault:KeyVault
* name: example
* properties:
* name: example
* location: ${example.location}
* resourceGroupName: ${example.name}
* tenantId: ${current.tenantId}
* skuName: premium
* softDeleteRetentionDays: 7
* accessPolicies:
* - tenantId: ${current.tenantId}
* objectId: ${current.objectId}
* keyPermissions:
* - Create
* - Get
* secretPermissions:
* - Set
* - Get
* - Delete
* - Purge
* - Recover
* exampleSecret:
* type: azure:keyvault:Secret
* name: example
* properties:
* name: example
* value: example-secret
* keyVaultId: ${exampleKeyVault.id}
* exampleLinkedServiceKeyVault:
* type: azure:datafactory:LinkedServiceKeyVault
* name: example
* properties:
* name: example
* dataFactoryId: ${exampleFactory.id}
* keyVaultId: ${exampleKeyVault.id}
* exampleCredentialServicePrincipal:
* type: azure:datafactory:CredentialServicePrincipal
* name: example
* properties:
* name: example
* description: example description
* dataFactoryId: ${exampleFactory.id}
* tenantId: ${current.tenantId}
* servicePrincipalId: ${current.clientId}
* servicePrincipalKey:
* linkedServiceName: ${exampleLinkedServiceKeyVault.name}
* secretName: ${exampleSecret.name}
* secretVersion: ${exampleSecret.version}
* annotations:
* - '1'
* - '2'
* variables:
* current:
* fn::invoke:
* Function: azure:core:getClientConfig
* Arguments: {}
* ```
*
* ## Import
* Data Factory Credentials can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:datafactory/credentialServicePrincipal:CredentialServicePrincipal example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resources/providers/Microsoft.DataFactory/factories/example/credentials/credential1
* ```
*/
public class CredentialServicePrincipal internal constructor(
override val javaResource: com.pulumi.azure.datafactory.CredentialServicePrincipal,
) : KotlinCustomResource(javaResource, CredentialServicePrincipalMapper) {
/**
* List of tags that can be used for describing the Data Factory Credential.
*/
public val annotations: Output>?
get() = javaResource.annotations().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0
})
}).orElse(null)
})
/**
* The Data Factory ID in which to associate the Credential with. Changing this forces a new resource.
*/
public val dataFactoryId: Output
get() = javaResource.dataFactoryId().applyValue({ args0 -> args0 })
/**
* The description for the Data Factory Credential.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Specifies the name of the Credential. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The Client ID of the Service Principal.
*/
public val servicePrincipalId: Output
get() = javaResource.servicePrincipalId().applyValue({ args0 -> args0 })
/**
* A `service_principal_key` block as defined below.
*/
public val servicePrincipalKey: Output?
get() = javaResource.servicePrincipalKey().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> toKotlin(args0) })
}).orElse(null)
})
/**
* The Tenant ID of the Service Principal.
*/
public val tenantId: Output
get() = javaResource.tenantId().applyValue({ args0 -> args0 })
}
public object CredentialServicePrincipalMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.datafactory.CredentialServicePrincipal::class == javaResource::class
override fun map(javaResource: Resource): CredentialServicePrincipal =
CredentialServicePrincipal(
javaResource as
com.pulumi.azure.datafactory.CredentialServicePrincipal,
)
}
/**
* @see [CredentialServicePrincipal].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [CredentialServicePrincipal].
*/
public suspend fun credentialServicePrincipal(
name: String,
block: suspend CredentialServicePrincipalResourceBuilder.() -> Unit,
): CredentialServicePrincipal {
val builder = CredentialServicePrincipalResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [CredentialServicePrincipal].
* @param name The _unique_ name of the resulting resource.
*/
public fun credentialServicePrincipal(name: String): CredentialServicePrincipal {
val builder = CredentialServicePrincipalResourceBuilder()
builder.name(name)
return builder.build()
}