All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.vault.azure.kotlin.AzureFunctions.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.6.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.vault.azure.kotlin

import com.pulumi.vault.azure.AzureFunctions.getAccessCredentialsPlain
import com.pulumi.vault.azure.kotlin.inputs.GetAccessCredentialsPlainArgs
import com.pulumi.vault.azure.kotlin.inputs.GetAccessCredentialsPlainArgsBuilder
import com.pulumi.vault.azure.kotlin.outputs.GetAccessCredentialsResult
import com.pulumi.vault.azure.kotlin.outputs.GetAccessCredentialsResult.Companion.toKotlin
import kotlinx.coroutines.future.await
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

public object AzureFunctions {
    /**
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as vault from "@pulumi/vault";
     * const creds = vault.azure.getAccessCredentials({
     *     role: "my-role",
     *     validateCreds: true,
     *     numSequentialSuccesses: 8,
     *     numSecondsBetweenTests: 1,
     *     maxCredValidationSeconds: 300,
     * });
     * ```
     * ```python
     * import pulumi
     * import pulumi_vault as vault
     * creds = vault.azure.get_access_credentials(role="my-role",
     *     validate_creds=True,
     *     num_sequential_successes=8,
     *     num_seconds_between_tests=1,
     *     max_cred_validation_seconds=300)
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Vault = Pulumi.Vault;
     * return await Deployment.RunAsync(() =>
     * {
     *     var creds = Vault.Azure.GetAccessCredentials.Invoke(new()
     *     {
     *         Role = "my-role",
     *         ValidateCreds = true,
     *         NumSequentialSuccesses = 8,
     *         NumSecondsBetweenTests = 1,
     *         MaxCredValidationSeconds = 300,
     *     });
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/azure"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		_, err := azure.GetAccessCredentials(ctx, &azure.GetAccessCredentialsArgs{
     * 			Role:                     "my-role",
     * 			ValidateCreds:            pulumi.BoolRef(true),
     * 			NumSequentialSuccesses:   pulumi.IntRef(8),
     * 			NumSecondsBetweenTests:   pulumi.IntRef(1),
     * 			MaxCredValidationSeconds: pulumi.IntRef(300),
     * 		}, nil)
     * 		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.vault.azure.AzureFunctions;
     * import com.pulumi.vault.azure.inputs.GetAccessCredentialsArgs;
     * 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 creds = AzureFunctions.getAccessCredentials(GetAccessCredentialsArgs.builder()
     *             .role("my-role")
     *             .validateCreds(true)
     *             .numSequentialSuccesses(8)
     *             .numSecondsBetweenTests(1)
     *             .maxCredValidationSeconds(300)
     *             .build());
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   creds:
     *     fn::invoke:
     *       Function: vault:azure:getAccessCredentials
     *       Arguments:
     *         role: my-role
     *         validateCreds: true
     *         numSequentialSuccesses: 8
     *         numSecondsBetweenTests: 1
     *         maxCredValidationSeconds: 300
     * ```
     * 
     * ## Caveats
     * The `validate_creds` option requires read-access to the `backend` config endpoint.
     * If the effective Vault role does not have the required permissions then valid values
     * are required to be set for: `subscription_id`, `tenant_id`, `environment`.
     * @param argument A collection of arguments for invoking getAccessCredentials.
     * @return A collection of values returned by getAccessCredentials.
     */
    public suspend fun getAccessCredentials(argument: GetAccessCredentialsPlainArgs): GetAccessCredentialsResult = toKotlin(getAccessCredentialsPlain(argument.toJava()).await())

    /**
     * @see [getAccessCredentials].
     * @param backend The path to the Azure secret backend to
     * read credentials from, with no leading or trailing `/`s.
     * @param environment The Azure environment to use during credential validation.
     * Defaults to the environment configured in the Vault backend.
     * Some possible values: `AzurePublicCloud`, `AzureGovernmentCloud`
     * *See the caveats section for more information on this field.*
     * @param maxCredValidationSeconds If 'validate_creds' is true,
     * the number of seconds after which to give up validating credentials. Defaults
     * to 300.
     * @param namespace The namespace of the target resource.
     * The value should not contain leading or trailing forward slashes.
     * The `namespace` is always relative to the provider's configured [namespace](https://www.terraform.io/docs/providers/vault/index.html#namespace).
     * *Available only for Vault Enterprise*.
     * @param numSecondsBetweenTests If 'validate_creds' is true,
     * the number of seconds to wait between each test of generated credentials.
     * Defaults to 1.
     * @param numSequentialSuccesses If 'validate_creds' is true,
     * the number of sequential successes required to validate generated
     * credentials. Defaults to 8.
     * @param role The name of the Azure secret backend role to read
     * credentials from, with no leading or trailing `/`s.
     * @param subscriptionId The subscription ID to use during credential
     * validation. Defaults to the subscription ID configured in the Vault `backend`.
     * *See the caveats section for more information on this field.*
     * @param tenantId The tenant ID to use during credential validation.
     * Defaults to the tenant ID configured in the Vault `backend`.
     * *See the caveats section for more information on this field.*
     * @param validateCreds Whether generated credentials should be
     * validated before being returned. Defaults to `false`, which returns
     * credentials without checking whether they have fully propagated throughout
     * Azure Active Directory. Designating `true` activates testing.
     * @return A collection of values returned by getAccessCredentials.
     */
    public suspend fun getAccessCredentials(
        backend: String,
        environment: String? = null,
        maxCredValidationSeconds: Int? = null,
        namespace: String? = null,
        numSecondsBetweenTests: Int? = null,
        numSequentialSuccesses: Int? = null,
        role: String,
        subscriptionId: String? = null,
        tenantId: String? = null,
        validateCreds: Boolean? = null,
    ): GetAccessCredentialsResult {
        val argument = GetAccessCredentialsPlainArgs(
            backend = backend,
            environment = environment,
            maxCredValidationSeconds = maxCredValidationSeconds,
            namespace = namespace,
            numSecondsBetweenTests = numSecondsBetweenTests,
            numSequentialSuccesses = numSequentialSuccesses,
            role = role,
            subscriptionId = subscriptionId,
            tenantId = tenantId,
            validateCreds = validateCreds,
        )
        return toKotlin(getAccessCredentialsPlain(argument.toJava()).await())
    }

    /**
     * @see [getAccessCredentials].
     * @param argument Builder for [com.pulumi.vault.azure.kotlin.inputs.GetAccessCredentialsPlainArgs].
     * @return A collection of values returned by getAccessCredentials.
     */
    public suspend fun getAccessCredentials(argument: suspend GetAccessCredentialsPlainArgsBuilder.() -> Unit): GetAccessCredentialsResult {
        val builder = GetAccessCredentialsPlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return toKotlin(getAccessCredentialsPlain(builtArgument.toJava()).await())
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy