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

com.pulumi.gcp.storage.kotlin.TransferAgentPool.kt Maven / Gradle / Ivy

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

package com.pulumi.gcp.storage.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.storage.kotlin.outputs.TransferAgentPoolBandwidthLimit
import com.pulumi.gcp.storage.kotlin.outputs.TransferAgentPoolBandwidthLimit.Companion.toKotlin
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

/**
 * Builder for [TransferAgentPool].
 */
@PulumiTagMarker
public class TransferAgentPoolResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: TransferAgentPoolArgs = TransferAgentPoolArgs()

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

/**
 * Represents an On-Premises Agent pool.
 * To get more information about AgentPool, see:
 * * [API documentation](https://cloud.google.com/storage-transfer/docs/reference/rest/v1/projects.agentPools)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/storage-transfer/docs/on-prem-agent-pools)
 * ## Example Usage
 * ### Agent Pool Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const default = gcp.storage.getTransferProjectServiceAccount({
 *     project: "my-project-name",
 * });
 * const pubsubEditorRole = new gcp.projects.IAMMember("pubsub_editor_role", {
 *     project: "my-project-name",
 *     role: "roles/pubsub.editor",
 *     member: _default.then(_default => `serviceAccount:${_default.email}`),
 * });
 * const example = new gcp.storage.TransferAgentPool("example", {
 *     name: "agent-pool-example",
 *     displayName: "Source A to destination Z",
 *     bandwidthLimit: {
 *         limitMbps: "120",
 *     },
 * }, {
 *     dependsOn: [pubsubEditorRole],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.storage.get_transfer_project_service_account(project="my-project-name")
 * pubsub_editor_role = gcp.projects.IAMMember("pubsub_editor_role",
 *     project="my-project-name",
 *     role="roles/pubsub.editor",
 *     member=f"serviceAccount:{default.email}")
 * example = gcp.storage.TransferAgentPool("example",
 *     name="agent-pool-example",
 *     display_name="Source A to destination Z",
 *     bandwidth_limit={
 *         "limit_mbps": "120",
 *     },
 *     opts = pulumi.ResourceOptions(depends_on=[pubsub_editor_role]))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = Gcp.Storage.GetTransferProjectServiceAccount.Invoke(new()
 *     {
 *         Project = "my-project-name",
 *     });
 *     var pubsubEditorRole = new Gcp.Projects.IAMMember("pubsub_editor_role", new()
 *     {
 *         Project = "my-project-name",
 *         Role = "roles/pubsub.editor",
 *         Member = @default.Apply(@default => $"serviceAccount:{@default.Apply(getTransferProjectServiceAccountResult => getTransferProjectServiceAccountResult.Email)}"),
 *     });
 *     var example = new Gcp.Storage.TransferAgentPool("example", new()
 *     {
 *         Name = "agent-pool-example",
 *         DisplayName = "Source A to destination Z",
 *         BandwidthLimit = new Gcp.Storage.Inputs.TransferAgentPoolBandwidthLimitArgs
 *         {
 *             LimitMbps = "120",
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             pubsubEditorRole,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_default, err := storage.GetTransferProjectServiceAccount(ctx, &storage.GetTransferProjectServiceAccountArgs{
 * 			Project: pulumi.StringRef("my-project-name"),
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		pubsubEditorRole, err := projects.NewIAMMember(ctx, "pubsub_editor_role", &projects.IAMMemberArgs{
 * 			Project: pulumi.String("my-project-name"),
 * 			Role:    pulumi.String("roles/pubsub.editor"),
 * 			Member:  pulumi.Sprintf("serviceAccount:%v", _default.Email),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = storage.NewTransferAgentPool(ctx, "example", &storage.TransferAgentPoolArgs{
 * 			Name:        pulumi.String("agent-pool-example"),
 * 			DisplayName: pulumi.String("Source A to destination Z"),
 * 			BandwidthLimit: &storage.TransferAgentPoolBandwidthLimitArgs{
 * 				LimitMbps: pulumi.String("120"),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			pubsubEditorRole,
 * 		}))
 * 		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.storage.StorageFunctions;
 * import com.pulumi.gcp.storage.inputs.GetTransferProjectServiceAccountArgs;
 * import com.pulumi.gcp.projects.IAMMember;
 * import com.pulumi.gcp.projects.IAMMemberArgs;
 * import com.pulumi.gcp.storage.TransferAgentPool;
 * import com.pulumi.gcp.storage.TransferAgentPoolArgs;
 * import com.pulumi.gcp.storage.inputs.TransferAgentPoolBandwidthLimitArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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 default = StorageFunctions.getTransferProjectServiceAccount(GetTransferProjectServiceAccountArgs.builder()
 *             .project("my-project-name")
 *             .build());
 *         var pubsubEditorRole = new IAMMember("pubsubEditorRole", IAMMemberArgs.builder()
 *             .project("my-project-name")
 *             .role("roles/pubsub.editor")
 *             .member(String.format("serviceAccount:%s", default_.email()))
 *             .build());
 *         var example = new TransferAgentPool("example", TransferAgentPoolArgs.builder()
 *             .name("agent-pool-example")
 *             .displayName("Source A to destination Z")
 *             .bandwidthLimit(TransferAgentPoolBandwidthLimitArgs.builder()
 *                 .limitMbps("120")
 *                 .build())
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(pubsubEditorRole)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   pubsubEditorRole:
 *     type: gcp:projects:IAMMember
 *     name: pubsub_editor_role
 *     properties:
 *       project: my-project-name
 *       role: roles/pubsub.editor
 *       member: serviceAccount:${default.email}
 *   example:
 *     type: gcp:storage:TransferAgentPool
 *     properties:
 *       name: agent-pool-example
 *       displayName: Source A to destination Z
 *       bandwidthLimit:
 *         limitMbps: '120'
 *     options:
 *       dependson:
 *         - ${pubsubEditorRole}
 * variables:
 *   default:
 *     fn::invoke:
 *       Function: gcp:storage:getTransferProjectServiceAccount
 *       Arguments:
 *         project: my-project-name
 * ```
 * 
 * ## Import
 * AgentPool can be imported using any of these accepted formats:
 * * `projects/{{project}}/agentPools/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, AgentPool can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:storage/transferAgentPool:TransferAgentPool default projects/{{project}}/agentPools/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:storage/transferAgentPool:TransferAgentPool default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:storage/transferAgentPool:TransferAgentPool default {{name}}
 * ```
 */
public class TransferAgentPool internal constructor(
    override val javaResource: com.pulumi.gcp.storage.TransferAgentPool,
) : KotlinCustomResource(javaResource, TransferAgentPoolMapper) {
    /**
     * Specifies the bandwidth limit details. If this field is unspecified, the default value is set as 'No Limit'.
     * Structure is documented below.
     */
    public val bandwidthLimit: Output?
        get() = javaResource.bandwidthLimit().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Specifies the client-specified AgentPool description.
     */
    public val displayName: Output?
        get() = javaResource.displayName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of the agent pool to create.
     * The agentPoolId must meet the following requirements:
     * * Length of 128 characters or less.
     * * Not start with the string goog.
     * * Start with a lowercase ASCII character, followed by:
     * * Zero or more: lowercase Latin alphabet characters, numerals, hyphens (-), periods (.), underscores (_), or tildes (~).
     * * One or more numerals or lowercase ASCII characters.
     * As expressed by the regular expression: ^(?!goog)a-z?$.
     * - - -
     */
    public val name: Output
        get() = javaResource.name().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 })

    /**
     * Specifies the state of the AgentPool.
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })
}

public object TransferAgentPoolMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.storage.TransferAgentPool::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy