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

com.pulumi.azure.cognitive.kotlin.CognitiveFunctions.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.cognitive.kotlin

import com.pulumi.azure.cognitive.CognitiveFunctions.getAccountPlain
import com.pulumi.azure.cognitive.kotlin.inputs.GetAccountPlainArgs
import com.pulumi.azure.cognitive.kotlin.inputs.GetAccountPlainArgsBuilder
import com.pulumi.azure.cognitive.kotlin.outputs.GetAccountResult
import com.pulumi.azure.cognitive.kotlin.outputs.GetAccountResult.Companion.toKotlin
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map

public object CognitiveFunctions {
    /**
     * Use this data source to access information about an existing Cognitive Services Account.
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as azure from "@pulumi/azure";
     * const test = azure.cognitive.getAccount({
     *     name: "example-account",
     *     resourceGroupName: "cognitive_account_rg",
     * });
     * export const primaryAccessKey = test.then(test => test.primaryAccessKey);
     * ```
     * ```python
     * import pulumi
     * import pulumi_azure as azure
     * test = azure.cognitive.get_account(name="example-account",
     *     resource_group_name="cognitive_account_rg")
     * pulumi.export("primaryAccessKey", test.primary_access_key)
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Azure = Pulumi.Azure;
     * return await Deployment.RunAsync(() =>
     * {
     *     var test = Azure.Cognitive.GetAccount.Invoke(new()
     *     {
     *         Name = "example-account",
     *         ResourceGroupName = "cognitive_account_rg",
     *     });
     *     return new Dictionary
     *     {
     *         ["primaryAccessKey"] = test.Apply(getAccountResult => getAccountResult.PrimaryAccessKey),
     *     };
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/cognitive"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		test, err := cognitive.LookupAccount(ctx, &cognitive.LookupAccountArgs{
     * 			Name:              "example-account",
     * 			ResourceGroupName: "cognitive_account_rg",
     * 		}, nil)
     * 		if err != nil {
     * 			return err
     * 		}
     * 		ctx.Export("primaryAccessKey", test.PrimaryAccessKey)
     * 		return nil
     * 	})
     * }
     * ```
     * ```java
     * package generated_program;
     * import com.pulumi.Context;
     * import com.pulumi.Pulumi;
     * import com.pulumi.core.Output;
     * import com.pulumi.azure.cognitive.CognitiveFunctions;
     * import com.pulumi.azure.cognitive.inputs.GetAccountArgs;
     * 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 test = CognitiveFunctions.getAccount(GetAccountArgs.builder()
     *             .name("example-account")
     *             .resourceGroupName("cognitive_account_rg")
     *             .build());
     *         ctx.export("primaryAccessKey", test.applyValue(getAccountResult -> getAccountResult.primaryAccessKey()));
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   test:
     *     fn::invoke:
     *       Function: azure:cognitive:getAccount
     *       Arguments:
     *         name: example-account
     *         resourceGroupName: cognitive_account_rg
     * outputs:
     *   primaryAccessKey: ${test.primaryAccessKey}
     * ```
     * 
     * @param argument A collection of arguments for invoking getAccount.
     * @return A collection of values returned by getAccount.
     */
    public suspend fun getAccount(argument: GetAccountPlainArgs): GetAccountResult =
        toKotlin(getAccountPlain(argument.toJava()).await())

    /**
     * @see [getAccount].
     * @param name Specifies the name of the Cognitive Services Account.
     * @param resourceGroupName Specifies the name of the resource group where the Cognitive Services Account resides.
     * @param tags A mapping of tags to assigned to the resource.
     * @return A collection of values returned by getAccount.
     */
    public suspend fun getAccount(
        name: String,
        resourceGroupName: String,
        tags: Map? = null,
    ): GetAccountResult {
        val argument = GetAccountPlainArgs(
            name = name,
            resourceGroupName = resourceGroupName,
            tags = tags,
        )
        return toKotlin(getAccountPlain(argument.toJava()).await())
    }

    /**
     * @see [getAccount].
     * @param argument Builder for [com.pulumi.azure.cognitive.kotlin.inputs.GetAccountPlainArgs].
     * @return A collection of values returned by getAccount.
     */
    public suspend fun getAccount(argument: suspend GetAccountPlainArgsBuilder.() -> Unit): GetAccountResult {
        val builder = GetAccountPlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return toKotlin(getAccountPlain(builtArgument.toJava()).await())
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy