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

com.pulumi.gcp.firebase.kotlin.AndroidApp.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: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.firebase.kotlin

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 [AndroidApp].
 */
@PulumiTagMarker
public class AndroidAppResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: AndroidAppArgs = AndroidAppArgs()

    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 AndroidAppArgsBuilder.() -> Unit) {
        val builder = AndroidAppArgsBuilder()
        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(): AndroidApp {
        val builtJavaResource = com.pulumi.gcp.firebase.AndroidApp(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return AndroidApp(builtJavaResource)
    }
}

/**
 * ## Example Usage
 * ### Firebase Android App Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const basic = new gcp.firebase.AndroidApp("basic", {
 *     project: "my-project-name",
 *     displayName: "Display Name Basic",
 *     packageName: "android.package.app",
 *     sha1Hashes: ["2145bdf698b8715039bd0e83f2069bed435ac21c"],
 *     sha256Hashes: ["2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * basic = gcp.firebase.AndroidApp("basic",
 *     project="my-project-name",
 *     display_name="Display Name Basic",
 *     package_name="android.package.app",
 *     sha1_hashes=["2145bdf698b8715039bd0e83f2069bed435ac21c"],
 *     sha256_hashes=["2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var basic = new Gcp.Firebase.AndroidApp("basic", new()
 *     {
 *         Project = "my-project-name",
 *         DisplayName = "Display Name Basic",
 *         PackageName = "android.package.app",
 *         Sha1Hashes = new[]
 *         {
 *             "2145bdf698b8715039bd0e83f2069bed435ac21c",
 *         },
 *         Sha256Hashes = new[]
 *         {
 *             "2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firebase"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := firebase.NewAndroidApp(ctx, "basic", &firebase.AndroidAppArgs{
 * 			Project:     pulumi.String("my-project-name"),
 * 			DisplayName: pulumi.String("Display Name Basic"),
 * 			PackageName: pulumi.String("android.package.app"),
 * 			Sha1Hashes: pulumi.StringArray{
 * 				pulumi.String("2145bdf698b8715039bd0e83f2069bed435ac21c"),
 * 			},
 * 			Sha256Hashes: pulumi.StringArray{
 * 				pulumi.String("2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc"),
 * 			},
 * 		})
 * 		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.gcp.firebase.AndroidApp;
 * import com.pulumi.gcp.firebase.AndroidAppArgs;
 * 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) {
 *         var basic = new AndroidApp("basic", AndroidAppArgs.builder()
 *             .project("my-project-name")
 *             .displayName("Display Name Basic")
 *             .packageName("android.package.app")
 *             .sha1Hashes("2145bdf698b8715039bd0e83f2069bed435ac21c")
 *             .sha256Hashes("2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   basic:
 *     type: gcp:firebase:AndroidApp
 *     properties:
 *       project: my-project-name
 *       displayName: Display Name Basic
 *       packageName: android.package.app
 *       sha1Hashes:
 *         - 2145bdf698b8715039bd0e83f2069bed435ac21c
 *       sha256Hashes:
 *         - 2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc
 * ```
 * 
 * ### Firebase Android App Custom Api Key
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const android = new gcp.projects.ApiKey("android", {
 *     name: "api-key",
 *     displayName: "Display Name",
 *     project: "my-project-name",
 *     restrictions: {
 *         androidKeyRestrictions: {
 *             allowedApplications: [{
 *                 packageName: "android.package.app",
 *                 sha1Fingerprint: "2145bdf698b8715039bd0e83f2069bed435ac21c",
 *             }],
 *         },
 *     },
 * });
 * const _default = new gcp.firebase.AndroidApp("default", {
 *     project: "my-project-name",
 *     displayName: "Display Name",
 *     packageName: "android.package.app",
 *     sha1Hashes: ["2145bdf698b8715039bd0e83f2069bed435ac21c"],
 *     sha256Hashes: ["2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc"],
 *     apiKeyId: android.uid,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * android = gcp.projects.ApiKey("android",
 *     name="api-key",
 *     display_name="Display Name",
 *     project="my-project-name",
 *     restrictions=gcp.projects.ApiKeyRestrictionsArgs(
 *         android_key_restrictions=gcp.projects.ApiKeyRestrictionsAndroidKeyRestrictionsArgs(
 *             allowed_applications=[gcp.projects.ApiKeyRestrictionsAndroidKeyRestrictionsAllowedApplicationArgs(
 *                 package_name="android.package.app",
 *                 sha1_fingerprint="2145bdf698b8715039bd0e83f2069bed435ac21c",
 *             )],
 *         ),
 *     ))
 * default = gcp.firebase.AndroidApp("default",
 *     project="my-project-name",
 *     display_name="Display Name",
 *     package_name="android.package.app",
 *     sha1_hashes=["2145bdf698b8715039bd0e83f2069bed435ac21c"],
 *     sha256_hashes=["2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc"],
 *     api_key_id=android.uid)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var android = new Gcp.Projects.ApiKey("android", new()
 *     {
 *         Name = "api-key",
 *         DisplayName = "Display Name",
 *         Project = "my-project-name",
 *         Restrictions = new Gcp.Projects.Inputs.ApiKeyRestrictionsArgs
 *         {
 *             AndroidKeyRestrictions = new Gcp.Projects.Inputs.ApiKeyRestrictionsAndroidKeyRestrictionsArgs
 *             {
 *                 AllowedApplications = new[]
 *                 {
 *                     new Gcp.Projects.Inputs.ApiKeyRestrictionsAndroidKeyRestrictionsAllowedApplicationArgs
 *                     {
 *                         PackageName = "android.package.app",
 *                         Sha1Fingerprint = "2145bdf698b8715039bd0e83f2069bed435ac21c",
 *                     },
 *                 },
 *             },
 *         },
 *     });
 *     var @default = new Gcp.Firebase.AndroidApp("default", new()
 *     {
 *         Project = "my-project-name",
 *         DisplayName = "Display Name",
 *         PackageName = "android.package.app",
 *         Sha1Hashes = new[]
 *         {
 *             "2145bdf698b8715039bd0e83f2069bed435ac21c",
 *         },
 *         Sha256Hashes = new[]
 *         {
 *             "2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc",
 *         },
 *         ApiKeyId = android.Uid,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firebase"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		android, err := projects.NewApiKey(ctx, "android", &projects.ApiKeyArgs{
 * 			Name:        pulumi.String("api-key"),
 * 			DisplayName: pulumi.String("Display Name"),
 * 			Project:     pulumi.String("my-project-name"),
 * 			Restrictions: &projects.ApiKeyRestrictionsArgs{
 * 				AndroidKeyRestrictions: &projects.ApiKeyRestrictionsAndroidKeyRestrictionsArgs{
 * 					AllowedApplications: projects.ApiKeyRestrictionsAndroidKeyRestrictionsAllowedApplicationArray{
 * 						&projects.ApiKeyRestrictionsAndroidKeyRestrictionsAllowedApplicationArgs{
 * 							PackageName:     pulumi.String("android.package.app"),
 * 							Sha1Fingerprint: pulumi.String("2145bdf698b8715039bd0e83f2069bed435ac21c"),
 * 						},
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = firebase.NewAndroidApp(ctx, "default", &firebase.AndroidAppArgs{
 * 			Project:     pulumi.String("my-project-name"),
 * 			DisplayName: pulumi.String("Display Name"),
 * 			PackageName: pulumi.String("android.package.app"),
 * 			Sha1Hashes: pulumi.StringArray{
 * 				pulumi.String("2145bdf698b8715039bd0e83f2069bed435ac21c"),
 * 			},
 * 			Sha256Hashes: pulumi.StringArray{
 * 				pulumi.String("2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc"),
 * 			},
 * 			ApiKeyId: android.Uid,
 * 		})
 * 		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.gcp.projects.ApiKey;
 * import com.pulumi.gcp.projects.ApiKeyArgs;
 * import com.pulumi.gcp.projects.inputs.ApiKeyRestrictionsArgs;
 * import com.pulumi.gcp.projects.inputs.ApiKeyRestrictionsAndroidKeyRestrictionsArgs;
 * import com.pulumi.gcp.firebase.AndroidApp;
 * import com.pulumi.gcp.firebase.AndroidAppArgs;
 * 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) {
 *         var android = new ApiKey("android", ApiKeyArgs.builder()
 *             .name("api-key")
 *             .displayName("Display Name")
 *             .project("my-project-name")
 *             .restrictions(ApiKeyRestrictionsArgs.builder()
 *                 .androidKeyRestrictions(ApiKeyRestrictionsAndroidKeyRestrictionsArgs.builder()
 *                     .allowedApplications(ApiKeyRestrictionsAndroidKeyRestrictionsAllowedApplicationArgs.builder()
 *                         .packageName("android.package.app")
 *                         .sha1Fingerprint("2145bdf698b8715039bd0e83f2069bed435ac21c")
 *                         .build())
 *                     .build())
 *                 .build())
 *             .build());
 *         var default_ = new AndroidApp("default", AndroidAppArgs.builder()
 *             .project("my-project-name")
 *             .displayName("Display Name")
 *             .packageName("android.package.app")
 *             .sha1Hashes("2145bdf698b8715039bd0e83f2069bed435ac21c")
 *             .sha256Hashes("2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc")
 *             .apiKeyId(android.uid())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:firebase:AndroidApp
 *     properties:
 *       project: my-project-name
 *       displayName: Display Name
 *       packageName: android.package.app
 *       sha1Hashes:
 *         - 2145bdf698b8715039bd0e83f2069bed435ac21c
 *       sha256Hashes:
 *         - 2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc
 *       apiKeyId: ${android.uid}
 *   android:
 *     type: gcp:projects:ApiKey
 *     properties:
 *       name: api-key
 *       displayName: Display Name
 *       project: my-project-name
 *       restrictions:
 *         androidKeyRestrictions:
 *           allowedApplications:
 *             - packageName: android.package.app
 *               sha1Fingerprint: 2145bdf698b8715039bd0e83f2069bed435ac21c
 * ```
 * 
 * ## Import
 * AndroidApp can be imported using any of these accepted formats:
 * * `{{project}} projects/{{project}}/androidApps/{{app_id}}`
 * * `projects/{{project}}/androidApps/{{app_id}}`
 * * `{{project}}/{{project}}/{{app_id}}`
 * * `androidApps/{{app_id}}`
 * * `{{app_id}}`
 * When using the `pulumi import` command, AndroidApp can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:firebase/androidApp:AndroidApp default {{project}} projects/{{project}}/androidApps/{{app_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:firebase/androidApp:AndroidApp default projects/{{project}}/androidApps/{{app_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:firebase/androidApp:AndroidApp default {{project}}/{{project}}/{{app_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:firebase/androidApp:AndroidApp default androidApps/{{app_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:firebase/androidApp:AndroidApp default {{app_id}}
 * ```
 */
public class AndroidApp internal constructor(
    override val javaResource: com.pulumi.gcp.firebase.AndroidApp,
) : KotlinCustomResource(javaResource, AndroidAppMapper) {
    /**
     * The globally unique, Google-assigned identifier (UID) for the Firebase API key associated with the AndroidApp.
     * If apiKeyId is not set during creation, then Firebase automatically associates an apiKeyId with the AndroidApp.
     * This auto-associated key may be an existing valid key or, if no valid key exists, a new one will be provisioned.
     */
    public val apiKeyId: Output
        get() = javaResource.apiKeyId().applyValue({ args0 -> args0 })

    /**
     * The globally unique, Firebase-assigned identifier of the AndroidApp.
     * This identifier should be treated as an opaque token, as the data format is not specified.
     */
    public val appId: Output
        get() = javaResource.appId().applyValue({ args0 -> args0 })

    public val deletionPolicy: Output?
        get() = javaResource.deletionPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The user-assigned display name of the AndroidApp.
     */
    public val displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

    /**
     * This checksum is computed by the server based on the value of other fields, and it may be sent
     * with update requests to ensure the client has an up-to-date value before proceeding.
     */
    public val etag: Output
        get() = javaResource.etag().applyValue({ args0 -> args0 })

    /**
     * The fully qualified resource name of the AndroidApp, for example:
     * projects/projectId/androidApps/appId
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The canonical package name of the Android app as would appear in the Google Play
     * Developer Console.
     * - - -
     */
    public val packageName: Output
        get() = javaResource.packageName().applyValue({ args0 -> args0 })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The SHA1 certificate hashes for the AndroidApp.
     */
    public val sha1Hashes: Output>?
        get() = javaResource.sha1Hashes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * The SHA256 certificate hashes for the AndroidApp.
     */
    public val sha256Hashes: Output>?
        get() = javaResource.sha256Hashes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })
}

public object AndroidAppMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.firebase.AndroidApp::class == javaResource::class

    override fun map(javaResource: Resource): AndroidApp = AndroidApp(
        javaResource as
            com.pulumi.gcp.firebase.AndroidApp,
    )
}

/**
 * @see [AndroidApp].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [AndroidApp].
 */
public suspend fun androidApp(name: String, block: suspend AndroidAppResourceBuilder.() -> Unit): AndroidApp {
    val builder = AndroidAppResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [AndroidApp].
 * @param name The _unique_ name of the resulting resource.
 */
public fun androidApp(name: String): AndroidApp {
    val builder = AndroidAppResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy