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

com.pulumi.gcp.clouddeploy.kotlin.AutomationArgs.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.clouddeploy.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.clouddeploy.AutomationArgs.builder
import com.pulumi.gcp.clouddeploy.kotlin.inputs.AutomationRuleArgs
import com.pulumi.gcp.clouddeploy.kotlin.inputs.AutomationRuleArgsBuilder
import com.pulumi.gcp.clouddeploy.kotlin.inputs.AutomationSelectorArgs
import com.pulumi.gcp.clouddeploy.kotlin.inputs.AutomationSelectorArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * An `Automation` enables the automation of manually driven actions for a Delivery Pipeline, which includes Release promotion amongst Targets, Rollout repair and Rollout deployment strategy advancement.
 * To get more information about Automation, see:
 * * [API documentation](https://cloud.google.com/deploy/docs/api/reference/rest/v1/projects.locations.deliveryPipelines.automations)
 * * How-to Guides
 *     * [Automate your deployment](https://cloud.google.com/deploy/docs/automation)
 * ## Example Usage
 * ### Clouddeploy Automation Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const pipeline = new gcp.clouddeploy.DeliveryPipeline("pipeline", {
 *     name: "cd-pipeline",
 *     location: "us-central1",
 *     serialPipeline: {
 *         stages: [{
 *             targetId: "test",
 *             profiles: [],
 *         }],
 *     },
 * });
 * const b_automation = new gcp.clouddeploy.Automation("b-automation", {
 *     name: "cd-automation",
 *     project: pipeline.project,
 *     location: pipeline.location,
 *     deliveryPipeline: pipeline.name,
 *     serviceAccount: "[email protected]",
 *     selector: {
 *         targets: [{
 *             id: "*",
 *         }],
 *     },
 *     suspended: false,
 *     rules: [{
 *         promoteReleaseRule: {
 *             id: "promote-release",
 *         },
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * pipeline = gcp.clouddeploy.DeliveryPipeline("pipeline",
 *     name="cd-pipeline",
 *     location="us-central1",
 *     serial_pipeline=gcp.clouddeploy.DeliveryPipelineSerialPipelineArgs(
 *         stages=[gcp.clouddeploy.DeliveryPipelineSerialPipelineStageArgs(
 *             target_id="test",
 *             profiles=[],
 *         )],
 *     ))
 * b_automation = gcp.clouddeploy.Automation("b-automation",
 *     name="cd-automation",
 *     project=pipeline.project,
 *     location=pipeline.location,
 *     delivery_pipeline=pipeline.name,
 *     service_account="[email protected]",
 *     selector=gcp.clouddeploy.AutomationSelectorArgs(
 *         targets=[gcp.clouddeploy.AutomationSelectorTargetArgs(
 *             id="*",
 *         )],
 *     ),
 *     suspended=False,
 *     rules=[gcp.clouddeploy.AutomationRuleArgs(
 *         promote_release_rule=gcp.clouddeploy.AutomationRulePromoteReleaseRuleArgs(
 *             id="promote-release",
 *         ),
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var pipeline = new Gcp.CloudDeploy.DeliveryPipeline("pipeline", new()
 *     {
 *         Name = "cd-pipeline",
 *         Location = "us-central1",
 *         SerialPipeline = new Gcp.CloudDeploy.Inputs.DeliveryPipelineSerialPipelineArgs
 *         {
 *             Stages = new[]
 *             {
 *                 new Gcp.CloudDeploy.Inputs.DeliveryPipelineSerialPipelineStageArgs
 *                 {
 *                     TargetId = "test",
 *                     Profiles = new() { },
 *                 },
 *             },
 *         },
 *     });
 *     var b_automation = new Gcp.CloudDeploy.Automation("b-automation", new()
 *     {
 *         Name = "cd-automation",
 *         Project = pipeline.Project,
 *         Location = pipeline.Location,
 *         DeliveryPipeline = pipeline.Name,
 *         ServiceAccount = "[email protected]",
 *         Selector = new Gcp.CloudDeploy.Inputs.AutomationSelectorArgs
 *         {
 *             Targets = new[]
 *             {
 *                 new Gcp.CloudDeploy.Inputs.AutomationSelectorTargetArgs
 *                 {
 *                     Id = "*",
 *                 },
 *             },
 *         },
 *         Suspended = false,
 *         Rules = new[]
 *         {
 *             new Gcp.CloudDeploy.Inputs.AutomationRuleArgs
 *             {
 *                 PromoteReleaseRule = new Gcp.CloudDeploy.Inputs.AutomationRulePromoteReleaseRuleArgs
 *                 {
 *                     Id = "promote-release",
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/clouddeploy"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		pipeline, err := clouddeploy.NewDeliveryPipeline(ctx, "pipeline", &clouddeploy.DeliveryPipelineArgs{
 * 			Name:     pulumi.String("cd-pipeline"),
 * 			Location: pulumi.String("us-central1"),
 * 			SerialPipeline: &clouddeploy.DeliveryPipelineSerialPipelineArgs{
 * 				Stages: clouddeploy.DeliveryPipelineSerialPipelineStageArray{
 * 					&clouddeploy.DeliveryPipelineSerialPipelineStageArgs{
 * 						TargetId: pulumi.String("test"),
 * 						Profiles: pulumi.StringArray{},
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = clouddeploy.NewAutomation(ctx, "b-automation", &clouddeploy.AutomationArgs{
 * 			Name:             pulumi.String("cd-automation"),
 * 			Project:          pipeline.Project,
 * 			Location:         pipeline.Location,
 * 			DeliveryPipeline: pipeline.Name,
 * 			ServiceAccount:   pulumi.String("[email protected]"),
 * 			Selector: &clouddeploy.AutomationSelectorArgs{
 * 				Targets: clouddeploy.AutomationSelectorTargetArray{
 * 					&clouddeploy.AutomationSelectorTargetArgs{
 * 						Id: pulumi.String("*"),
 * 					},
 * 				},
 * 			},
 * 			Suspended: pulumi.Bool(false),
 * 			Rules: clouddeploy.AutomationRuleArray{
 * 				&clouddeploy.AutomationRuleArgs{
 * 					PromoteReleaseRule: &clouddeploy.AutomationRulePromoteReleaseRuleArgs{
 * 						Id: pulumi.String("promote-release"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.clouddeploy.DeliveryPipeline;
 * import com.pulumi.gcp.clouddeploy.DeliveryPipelineArgs;
 * import com.pulumi.gcp.clouddeploy.inputs.DeliveryPipelineSerialPipelineArgs;
 * import com.pulumi.gcp.clouddeploy.Automation;
 * import com.pulumi.gcp.clouddeploy.AutomationArgs;
 * import com.pulumi.gcp.clouddeploy.inputs.AutomationSelectorArgs;
 * import com.pulumi.gcp.clouddeploy.inputs.AutomationRuleArgs;
 * import com.pulumi.gcp.clouddeploy.inputs.AutomationRulePromoteReleaseRuleArgs;
 * 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 pipeline = new DeliveryPipeline("pipeline", DeliveryPipelineArgs.builder()
 *             .name("cd-pipeline")
 *             .location("us-central1")
 *             .serialPipeline(DeliveryPipelineSerialPipelineArgs.builder()
 *                 .stages(DeliveryPipelineSerialPipelineStageArgs.builder()
 *                     .targetId("test")
 *                     .profiles()
 *                     .build())
 *                 .build())
 *             .build());
 *         var b_automation = new Automation("b-automation", AutomationArgs.builder()
 *             .name("cd-automation")
 *             .project(pipeline.project())
 *             .location(pipeline.location())
 *             .deliveryPipeline(pipeline.name())
 *             .serviceAccount("[email protected]")
 *             .selector(AutomationSelectorArgs.builder()
 *                 .targets(AutomationSelectorTargetArgs.builder()
 *                     .id("*")
 *                     .build())
 *                 .build())
 *             .suspended(false)
 *             .rules(AutomationRuleArgs.builder()
 *                 .promoteReleaseRule(AutomationRulePromoteReleaseRuleArgs.builder()
 *                     .id("promote-release")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   b-automation:
 *     type: gcp:clouddeploy:Automation
 *     properties:
 *       name: cd-automation
 *       project: ${pipeline.project}
 *       location: ${pipeline.location}
 *       deliveryPipeline: ${pipeline.name}
 *       serviceAccount: [email protected]
 *       selector:
 *         targets:
 *           - id: '*'
 *       suspended: false
 *       rules:
 *         - promoteReleaseRule:
 *             id: promote-release
 *   pipeline:
 *     type: gcp:clouddeploy:DeliveryPipeline
 *     properties:
 *       name: cd-pipeline
 *       location: us-central1
 *       serialPipeline:
 *         stages:
 *           - targetId: test
 *             profiles: []
 * ```
 * 
 * ### Clouddeploy Automation Full
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const pipeline = new gcp.clouddeploy.DeliveryPipeline("pipeline", {
 *     name: "cd-pipeline",
 *     location: "us-central1",
 *     serialPipeline: {
 *         stages: [{
 *             targetId: "test",
 *             profiles: ["test-profile"],
 *         }],
 *     },
 * });
 * const f_automation = new gcp.clouddeploy.Automation("f-automation", {
 *     name: "cd-automation",
 *     location: "us-central1",
 *     deliveryPipeline: pipeline.name,
 *     serviceAccount: "[email protected]",
 *     annotations: {
 *         my_first_annotation: "example-annotation-1",
 *         my_second_annotation: "example-annotation-2",
 *     },
 *     labels: {
 *         my_first_label: "example-label-1",
 *         my_second_label: "example-label-2",
 *     },
 *     description: "automation resource",
 *     selector: {
 *         targets: [{
 *             id: "test",
 *             labels: {
 *                 foo: "bar",
 *             },
 *         }],
 *     },
 *     suspended: true,
 *     rules: [
 *         {
 *             promoteReleaseRule: {
 *                 id: "promote-release",
 *                 wait: "200s",
 *                 destinationTargetId: "@next",
 *                 destinationPhase: "stable",
 *             },
 *         },
 *         {
 *             advanceRolloutRule: {
 *                 id: "advance-rollout",
 *                 sourcePhases: ["deploy"],
 *                 wait: "200s",
 *             },
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * pipeline = gcp.clouddeploy.DeliveryPipeline("pipeline",
 *     name="cd-pipeline",
 *     location="us-central1",
 *     serial_pipeline=gcp.clouddeploy.DeliveryPipelineSerialPipelineArgs(
 *         stages=[gcp.clouddeploy.DeliveryPipelineSerialPipelineStageArgs(
 *             target_id="test",
 *             profiles=["test-profile"],
 *         )],
 *     ))
 * f_automation = gcp.clouddeploy.Automation("f-automation",
 *     name="cd-automation",
 *     location="us-central1",
 *     delivery_pipeline=pipeline.name,
 *     service_account="[email protected]",
 *     annotations={
 *         "my_first_annotation": "example-annotation-1",
 *         "my_second_annotation": "example-annotation-2",
 *     },
 *     labels={
 *         "my_first_label": "example-label-1",
 *         "my_second_label": "example-label-2",
 *     },
 *     description="automation resource",
 *     selector=gcp.clouddeploy.AutomationSelectorArgs(
 *         targets=[gcp.clouddeploy.AutomationSelectorTargetArgs(
 *             id="test",
 *             labels={
 *                 "foo": "bar",
 *             },
 *         )],
 *     ),
 *     suspended=True,
 *     rules=[
 *         gcp.clouddeploy.AutomationRuleArgs(
 *             promote_release_rule=gcp.clouddeploy.AutomationRulePromoteReleaseRuleArgs(
 *                 id="promote-release",
 *                 wait="200s",
 *                 destination_target_id="@next",
 *                 destination_phase="stable",
 *             ),
 *         ),
 *         gcp.clouddeploy.AutomationRuleArgs(
 *             advance_rollout_rule=gcp.clouddeploy.AutomationRuleAdvanceRolloutRuleArgs(
 *                 id="advance-rollout",
 *                 source_phases=["deploy"],
 *                 wait="200s",
 *             ),
 *         ),
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var pipeline = new Gcp.CloudDeploy.DeliveryPipeline("pipeline", new()
 *     {
 *         Name = "cd-pipeline",
 *         Location = "us-central1",
 *         SerialPipeline = new Gcp.CloudDeploy.Inputs.DeliveryPipelineSerialPipelineArgs
 *         {
 *             Stages = new[]
 *             {
 *                 new Gcp.CloudDeploy.Inputs.DeliveryPipelineSerialPipelineStageArgs
 *                 {
 *                     TargetId = "test",
 *                     Profiles = new[]
 *                     {
 *                         "test-profile",
 *                     },
 *                 },
 *             },
 *         },
 *     });
 *     var f_automation = new Gcp.CloudDeploy.Automation("f-automation", new()
 *     {
 *         Name = "cd-automation",
 *         Location = "us-central1",
 *         DeliveryPipeline = pipeline.Name,
 *         ServiceAccount = "[email protected]",
 *         Annotations =
 *         {
 *             { "my_first_annotation", "example-annotation-1" },
 *             { "my_second_annotation", "example-annotation-2" },
 *         },
 *         Labels =
 *         {
 *             { "my_first_label", "example-label-1" },
 *             { "my_second_label", "example-label-2" },
 *         },
 *         Description = "automation resource",
 *         Selector = new Gcp.CloudDeploy.Inputs.AutomationSelectorArgs
 *         {
 *             Targets = new[]
 *             {
 *                 new Gcp.CloudDeploy.Inputs.AutomationSelectorTargetArgs
 *                 {
 *                     Id = "test",
 *                     Labels =
 *                     {
 *                         { "foo", "bar" },
 *                     },
 *                 },
 *             },
 *         },
 *         Suspended = true,
 *         Rules = new[]
 *         {
 *             new Gcp.CloudDeploy.Inputs.AutomationRuleArgs
 *             {
 *                 PromoteReleaseRule = new Gcp.CloudDeploy.Inputs.AutomationRulePromoteReleaseRuleArgs
 *                 {
 *                     Id = "promote-release",
 *                     Wait = "200s",
 *                     DestinationTargetId = "@next",
 *                     DestinationPhase = "stable",
 *                 },
 *             },
 *             new Gcp.CloudDeploy.Inputs.AutomationRuleArgs
 *             {
 *                 AdvanceRolloutRule = new Gcp.CloudDeploy.Inputs.AutomationRuleAdvanceRolloutRuleArgs
 *                 {
 *                     Id = "advance-rollout",
 *                     SourcePhases = new[]
 *                     {
 *                         "deploy",
 *                     },
 *                     Wait = "200s",
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/clouddeploy"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		pipeline, err := clouddeploy.NewDeliveryPipeline(ctx, "pipeline", &clouddeploy.DeliveryPipelineArgs{
 * 			Name:     pulumi.String("cd-pipeline"),
 * 			Location: pulumi.String("us-central1"),
 * 			SerialPipeline: &clouddeploy.DeliveryPipelineSerialPipelineArgs{
 * 				Stages: clouddeploy.DeliveryPipelineSerialPipelineStageArray{
 * 					&clouddeploy.DeliveryPipelineSerialPipelineStageArgs{
 * 						TargetId: pulumi.String("test"),
 * 						Profiles: pulumi.StringArray{
 * 							pulumi.String("test-profile"),
 * 						},
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = clouddeploy.NewAutomation(ctx, "f-automation", &clouddeploy.AutomationArgs{
 * 			Name:             pulumi.String("cd-automation"),
 * 			Location:         pulumi.String("us-central1"),
 * 			DeliveryPipeline: pipeline.Name,
 * 			ServiceAccount:   pulumi.String("[email protected]"),
 * 			Annotations: pulumi.StringMap{
 * 				"my_first_annotation":  pulumi.String("example-annotation-1"),
 * 				"my_second_annotation": pulumi.String("example-annotation-2"),
 * 			},
 * 			Labels: pulumi.StringMap{
 * 				"my_first_label":  pulumi.String("example-label-1"),
 * 				"my_second_label": pulumi.String("example-label-2"),
 * 			},
 * 			Description: pulumi.String("automation resource"),
 * 			Selector: &clouddeploy.AutomationSelectorArgs{
 * 				Targets: clouddeploy.AutomationSelectorTargetArray{
 * 					&clouddeploy.AutomationSelectorTargetArgs{
 * 						Id: pulumi.String("test"),
 * 						Labels: pulumi.StringMap{
 * 							"foo": pulumi.String("bar"),
 * 						},
 * 					},
 * 				},
 * 			},
 * 			Suspended: pulumi.Bool(true),
 * 			Rules: clouddeploy.AutomationRuleArray{
 * 				&clouddeploy.AutomationRuleArgs{
 * 					PromoteReleaseRule: &clouddeploy.AutomationRulePromoteReleaseRuleArgs{
 * 						Id:                  pulumi.String("promote-release"),
 * 						Wait:                pulumi.String("200s"),
 * 						DestinationTargetId: pulumi.String("@next"),
 * 						DestinationPhase:    pulumi.String("stable"),
 * 					},
 * 				},
 * 				&clouddeploy.AutomationRuleArgs{
 * 					AdvanceRolloutRule: &clouddeploy.AutomationRuleAdvanceRolloutRuleArgs{
 * 						Id: pulumi.String("advance-rollout"),
 * 						SourcePhases: pulumi.StringArray{
 * 							pulumi.String("deploy"),
 * 						},
 * 						Wait: pulumi.String("200s"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.clouddeploy.DeliveryPipeline;
 * import com.pulumi.gcp.clouddeploy.DeliveryPipelineArgs;
 * import com.pulumi.gcp.clouddeploy.inputs.DeliveryPipelineSerialPipelineArgs;
 * import com.pulumi.gcp.clouddeploy.Automation;
 * import com.pulumi.gcp.clouddeploy.AutomationArgs;
 * import com.pulumi.gcp.clouddeploy.inputs.AutomationSelectorArgs;
 * import com.pulumi.gcp.clouddeploy.inputs.AutomationRuleArgs;
 * import com.pulumi.gcp.clouddeploy.inputs.AutomationRulePromoteReleaseRuleArgs;
 * import com.pulumi.gcp.clouddeploy.inputs.AutomationRuleAdvanceRolloutRuleArgs;
 * 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 pipeline = new DeliveryPipeline("pipeline", DeliveryPipelineArgs.builder()
 *             .name("cd-pipeline")
 *             .location("us-central1")
 *             .serialPipeline(DeliveryPipelineSerialPipelineArgs.builder()
 *                 .stages(DeliveryPipelineSerialPipelineStageArgs.builder()
 *                     .targetId("test")
 *                     .profiles("test-profile")
 *                     .build())
 *                 .build())
 *             .build());
 *         var f_automation = new Automation("f-automation", AutomationArgs.builder()
 *             .name("cd-automation")
 *             .location("us-central1")
 *             .deliveryPipeline(pipeline.name())
 *             .serviceAccount("[email protected]")
 *             .annotations(Map.ofEntries(
 *                 Map.entry("my_first_annotation", "example-annotation-1"),
 *                 Map.entry("my_second_annotation", "example-annotation-2")
 *             ))
 *             .labels(Map.ofEntries(
 *                 Map.entry("my_first_label", "example-label-1"),
 *                 Map.entry("my_second_label", "example-label-2")
 *             ))
 *             .description("automation resource")
 *             .selector(AutomationSelectorArgs.builder()
 *                 .targets(AutomationSelectorTargetArgs.builder()
 *                     .id("test")
 *                     .labels(Map.of("foo", "bar"))
 *                     .build())
 *                 .build())
 *             .suspended(true)
 *             .rules(
 *                 AutomationRuleArgs.builder()
 *                     .promoteReleaseRule(AutomationRulePromoteReleaseRuleArgs.builder()
 *                         .id("promote-release")
 *                         .wait("200s")
 *                         .destinationTargetId("@next")
 *                         .destinationPhase("stable")
 *                         .build())
 *                     .build(),
 *                 AutomationRuleArgs.builder()
 *                     .advanceRolloutRule(AutomationRuleAdvanceRolloutRuleArgs.builder()
 *                         .id("advance-rollout")
 *                         .sourcePhases("deploy")
 *                         .wait("200s")
 *                         .build())
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   f-automation:
 *     type: gcp:clouddeploy:Automation
 *     properties:
 *       name: cd-automation
 *       location: us-central1
 *       deliveryPipeline: ${pipeline.name}
 *       serviceAccount: [email protected]
 *       annotations:
 *         my_first_annotation: example-annotation-1
 *         my_second_annotation: example-annotation-2
 *       labels:
 *         my_first_label: example-label-1
 *         my_second_label: example-label-2
 *       description: automation resource
 *       selector:
 *         targets:
 *           - id: test
 *             labels:
 *               foo: bar
 *       suspended: true
 *       rules:
 *         - promoteReleaseRule:
 *             id: promote-release
 *             wait: 200s
 *             destinationTargetId: '@next'
 *             destinationPhase: stable
 *         - advanceRolloutRule:
 *             id: advance-rollout
 *             sourcePhases:
 *               - deploy
 *             wait: 200s
 *   pipeline:
 *     type: gcp:clouddeploy:DeliveryPipeline
 *     properties:
 *       name: cd-pipeline
 *       location: us-central1
 *       serialPipeline:
 *         stages:
 *           - targetId: test
 *             profiles:
 *               - test-profile
 * ```
 * 
 * ## Import
 * Automation can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/deliveryPipelines/{{delivery_pipeline}}/automations/{{name}}`
 * * `{{project}}/{{location}}/{{delivery_pipeline}}/{{name}}`
 * * `{{location}}/{{delivery_pipeline}}/{{name}}`
 * When using the `pulumi import` command, Automation can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:clouddeploy/automation:Automation default projects/{{project}}/locations/{{location}}/deliveryPipelines/{{delivery_pipeline}}/automations/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:clouddeploy/automation:Automation default {{project}}/{{location}}/{{delivery_pipeline}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:clouddeploy/automation:Automation default {{location}}/{{delivery_pipeline}}/{{name}}
 * ```
 * @property annotations Optional. User annotations. These attributes can only be set and used by the user, and not by Cloud Deploy. Annotations
 * must meet the following constraints: * Annotations are key/value pairs. * Valid annotation keys have two segments: an
 * optional prefix and name, separated by a slash ('/'). * The name segment is required and must be 63 characters or less,
 * beginning and ending with an alphanumeric character ('[a-z0-9A-Z]') with dashes ('-'), underscores ('_'), dots ('.'),
 * and alphanumerics between. * The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS
 * labels separated by dots('.'), not longer than 253 characters in total, followed by a slash ('/'). See
 * https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set for more
 * details. **Note**: This field is non-authoritative, and will only manage the annotations present in your configuration.
 * Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
 * @property deliveryPipeline The delivery_pipeline for the resource
 * @property description Optional. Description of the 'Automation'. Max length is 255 characters.
 * @property labels Optional. Labels are attributes that can be set and used by both the user and by Cloud Deploy. Labels must meet the
 * following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and
 * dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a
 * lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values
 * are additionally constrained to be <= 63 characters. **Note**: This field is non-authoritative, and will only manage the
 * labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the
 * resource.
 * @property location The location for the resource
 * @property name Name of the `Automation`.
 * @property project
 * @property rules Required. List of Automation rules associated with the Automation resource. Must have at least one rule and limited to 250 rules per Delivery Pipeline. Note: the order of the rules here is not the same as the order of execution.
 * Structure is documented below.
 * @property selector Required. Selected resources to which the automation will be applied.
 * Structure is documented below.
 * @property serviceAccount Required. Email address of the user-managed IAM service account that creates Cloud Deploy release and rollout resources.
 * @property suspended Optional. When Suspended, automation is deactivated from execution.
 */
public data class AutomationArgs(
    public val annotations: Output>? = null,
    public val deliveryPipeline: Output? = null,
    public val description: Output? = null,
    public val labels: Output>? = null,
    public val location: Output? = null,
    public val name: Output? = null,
    public val project: Output? = null,
    public val rules: Output>? = null,
    public val selector: Output? = null,
    public val serviceAccount: Output? = null,
    public val suspended: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.clouddeploy.AutomationArgs =
        com.pulumi.gcp.clouddeploy.AutomationArgs.builder()
            .annotations(
                annotations?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            )
            .deliveryPipeline(deliveryPipeline?.applyValue({ args0 -> args0 }))
            .description(description?.applyValue({ args0 -> args0 }))
            .labels(labels?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .location(location?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .project(project?.applyValue({ args0 -> args0 }))
            .rules(rules?.applyValue({ args0 -> args0.map({ args0 -> args0.let({ args0 -> args0.toJava() }) }) }))
            .selector(selector?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .serviceAccount(serviceAccount?.applyValue({ args0 -> args0 }))
            .suspended(suspended?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [AutomationArgs].
 */
@PulumiTagMarker
public class AutomationArgsBuilder internal constructor() {
    private var annotations: Output>? = null

    private var deliveryPipeline: Output? = null

    private var description: Output? = null

    private var labels: Output>? = null

    private var location: Output? = null

    private var name: Output? = null

    private var project: Output? = null

    private var rules: Output>? = null

    private var selector: Output? = null

    private var serviceAccount: Output? = null

    private var suspended: Output? = null

    /**
     * @param value Optional. User annotations. These attributes can only be set and used by the user, and not by Cloud Deploy. Annotations
     * must meet the following constraints: * Annotations are key/value pairs. * Valid annotation keys have two segments: an
     * optional prefix and name, separated by a slash ('/'). * The name segment is required and must be 63 characters or less,
     * beginning and ending with an alphanumeric character ('[a-z0-9A-Z]') with dashes ('-'), underscores ('_'), dots ('.'),
     * and alphanumerics between. * The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS
     * labels separated by dots('.'), not longer than 253 characters in total, followed by a slash ('/'). See
     * https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set for more
     * details. **Note**: This field is non-authoritative, and will only manage the annotations present in your configuration.
     * Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
     */
    @JvmName("btagwcajdfwaeoqe")
    public suspend fun annotations(`value`: Output>) {
        this.annotations = value
    }

    /**
     * @param value The delivery_pipeline for the resource
     */
    @JvmName("gnjttqiptwxsaelk")
    public suspend fun deliveryPipeline(`value`: Output) {
        this.deliveryPipeline = value
    }

    /**
     * @param value Optional. Description of the 'Automation'. Max length is 255 characters.
     */
    @JvmName("vxvvqnaeyxvbadcf")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value Optional. Labels are attributes that can be set and used by both the user and by Cloud Deploy. Labels must meet the
     * following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and
     * dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a
     * lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values
     * are additionally constrained to be <= 63 characters. **Note**: This field is non-authoritative, and will only manage the
     * labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the
     * resource.
     */
    @JvmName("cegvasbnhublxjfr")
    public suspend fun labels(`value`: Output>) {
        this.labels = value
    }

    /**
     * @param value The location for the resource
     */
    @JvmName("heijvmsqpixecuop")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value Name of the `Automation`.
     */
    @JvmName("ukpoeoidveiylssl")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value
     */
    @JvmName("alacqyerpbposlsq")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value Required. List of Automation rules associated with the Automation resource. Must have at least one rule and limited to 250 rules per Delivery Pipeline. Note: the order of the rules here is not the same as the order of execution.
     * Structure is documented below.
     */
    @JvmName("cmfdyjunmosksmle")
    public suspend fun rules(`value`: Output>) {
        this.rules = value
    }

    @JvmName("hhjeyyfmbffirhep")
    public suspend fun rules(vararg values: Output) {
        this.rules = Output.all(values.asList())
    }

    /**
     * @param values Required. List of Automation rules associated with the Automation resource. Must have at least one rule and limited to 250 rules per Delivery Pipeline. Note: the order of the rules here is not the same as the order of execution.
     * Structure is documented below.
     */
    @JvmName("dvqstgwjeqaprvtc")
    public suspend fun rules(values: List>) {
        this.rules = Output.all(values)
    }

    /**
     * @param value Required. Selected resources to which the automation will be applied.
     * Structure is documented below.
     */
    @JvmName("wpusbkkdwkoqujhp")
    public suspend fun selector(`value`: Output) {
        this.selector = value
    }

    /**
     * @param value Required. Email address of the user-managed IAM service account that creates Cloud Deploy release and rollout resources.
     */
    @JvmName("jcguxiftemkswsce")
    public suspend fun serviceAccount(`value`: Output) {
        this.serviceAccount = value
    }

    /**
     * @param value Optional. When Suspended, automation is deactivated from execution.
     */
    @JvmName("noyvyukncjvjprns")
    public suspend fun suspended(`value`: Output) {
        this.suspended = value
    }

    /**
     * @param value Optional. User annotations. These attributes can only be set and used by the user, and not by Cloud Deploy. Annotations
     * must meet the following constraints: * Annotations are key/value pairs. * Valid annotation keys have two segments: an
     * optional prefix and name, separated by a slash ('/'). * The name segment is required and must be 63 characters or less,
     * beginning and ending with an alphanumeric character ('[a-z0-9A-Z]') with dashes ('-'), underscores ('_'), dots ('.'),
     * and alphanumerics between. * The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS
     * labels separated by dots('.'), not longer than 253 characters in total, followed by a slash ('/'). See
     * https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set for more
     * details. **Note**: This field is non-authoritative, and will only manage the annotations present in your configuration.
     * Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
     */
    @JvmName("gdpirijbhybmrsca")
    public suspend fun annotations(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.annotations = mapped
    }

    /**
     * @param values Optional. User annotations. These attributes can only be set and used by the user, and not by Cloud Deploy. Annotations
     * must meet the following constraints: * Annotations are key/value pairs. * Valid annotation keys have two segments: an
     * optional prefix and name, separated by a slash ('/'). * The name segment is required and must be 63 characters or less,
     * beginning and ending with an alphanumeric character ('[a-z0-9A-Z]') with dashes ('-'), underscores ('_'), dots ('.'),
     * and alphanumerics between. * The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS
     * labels separated by dots('.'), not longer than 253 characters in total, followed by a slash ('/'). See
     * https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set for more
     * details. **Note**: This field is non-authoritative, and will only manage the annotations present in your configuration.
     * Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
     */
    @JvmName("kxijfvpmyvessfdy")
    public fun annotations(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.annotations = mapped
    }

    /**
     * @param value The delivery_pipeline for the resource
     */
    @JvmName("hkkvhwxshbayntuo")
    public suspend fun deliveryPipeline(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.deliveryPipeline = mapped
    }

    /**
     * @param value Optional. Description of the 'Automation'. Max length is 255 characters.
     */
    @JvmName("lftbeegfrvqknkan")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value Optional. Labels are attributes that can be set and used by both the user and by Cloud Deploy. Labels must meet the
     * following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and
     * dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a
     * lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values
     * are additionally constrained to be <= 63 characters. **Note**: This field is non-authoritative, and will only manage the
     * labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the
     * resource.
     */
    @JvmName("aoqroxiarmahvvgd")
    public suspend fun labels(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.labels = mapped
    }

    /**
     * @param values Optional. Labels are attributes that can be set and used by both the user and by Cloud Deploy. Labels must meet the
     * following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and
     * dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a
     * lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values
     * are additionally constrained to be <= 63 characters. **Note**: This field is non-authoritative, and will only manage the
     * labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the
     * resource.
     */
    @JvmName("nxobsnjcyecbwqwl")
    public fun labels(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.labels = mapped
    }

    /**
     * @param value The location for the resource
     */
    @JvmName("qgvhtkjyqiiqbaxc")
    public suspend fun location(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.location = mapped
    }

    /**
     * @param value Name of the `Automation`.
     */
    @JvmName("ctjuamyboqrluvgy")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value
     */
    @JvmName("etumaackovbrbewb")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value Required. List of Automation rules associated with the Automation resource. Must have at least one rule and limited to 250 rules per Delivery Pipeline. Note: the order of the rules here is not the same as the order of execution.
     * Structure is documented below.
     */
    @JvmName("hibglakjmweakmdh")
    public suspend fun rules(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.rules = mapped
    }

    /**
     * @param argument Required. List of Automation rules associated with the Automation resource. Must have at least one rule and limited to 250 rules per Delivery Pipeline. Note: the order of the rules here is not the same as the order of execution.
     * Structure is documented below.
     */
    @JvmName("cjalpokkuqbkanja")
    public suspend fun rules(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            AutomationRuleArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.rules = mapped
    }

    /**
     * @param argument Required. List of Automation rules associated with the Automation resource. Must have at least one rule and limited to 250 rules per Delivery Pipeline. Note: the order of the rules here is not the same as the order of execution.
     * Structure is documented below.
     */
    @JvmName("tkmndwdhlhttfbui")
    public suspend fun rules(vararg argument: suspend AutomationRuleArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            AutomationRuleArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.rules = mapped
    }

    /**
     * @param argument Required. List of Automation rules associated with the Automation resource. Must have at least one rule and limited to 250 rules per Delivery Pipeline. Note: the order of the rules here is not the same as the order of execution.
     * Structure is documented below.
     */
    @JvmName("flkfmhbdcsoqtgxq")
    public suspend fun rules(argument: suspend AutomationRuleArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(AutomationRuleArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.rules = mapped
    }

    /**
     * @param values Required. List of Automation rules associated with the Automation resource. Must have at least one rule and limited to 250 rules per Delivery Pipeline. Note: the order of the rules here is not the same as the order of execution.
     * Structure is documented below.
     */
    @JvmName("rljoqvfirwoxchyw")
    public suspend fun rules(vararg values: AutomationRuleArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.rules = mapped
    }

    /**
     * @param value Required. Selected resources to which the automation will be applied.
     * Structure is documented below.
     */
    @JvmName("xppnytrhxbhfpayn")
    public suspend fun selector(`value`: AutomationSelectorArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.selector = mapped
    }

    /**
     * @param argument Required. Selected resources to which the automation will be applied.
     * Structure is documented below.
     */
    @JvmName("fffvvfmkdbcatnvv")
    public suspend fun selector(argument: suspend AutomationSelectorArgsBuilder.() -> Unit) {
        val toBeMapped = AutomationSelectorArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.selector = mapped
    }

    /**
     * @param value Required. Email address of the user-managed IAM service account that creates Cloud Deploy release and rollout resources.
     */
    @JvmName("svyikjaujbelhrue")
    public suspend fun serviceAccount(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.serviceAccount = mapped
    }

    /**
     * @param value Optional. When Suspended, automation is deactivated from execution.
     */
    @JvmName("ivmxjxkqwkrtawpg")
    public suspend fun suspended(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.suspended = mapped
    }

    internal fun build(): AutomationArgs = AutomationArgs(
        annotations = annotations,
        deliveryPipeline = deliveryPipeline,
        description = description,
        labels = labels,
        location = location,
        name = name,
        project = project,
        rules = rules,
        selector = selector,
        serviceAccount = serviceAccount,
        suspended = suspended,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy