UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

416 lines (415 loc) • 19.3 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * A `DeployPolicy` inhibits manual or DeployPolicy-driven actions within a Delivery Pipeline or Target. * * To get more information about DeployPolicy, see: * * * [API documentation](https://cloud.google.com/deploy/docs/api/reference/rest/v1/projects.locations.deployPolicies) * * How-to Guides * * [Restrict deploy behavior using policies](https://cloud.google.com/deploy/docs/deploy-policy) * * ## Example Usage * * ### Clouddeploy Deploy Policy Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const b_deploy_policy = new gcp.clouddeploy.DeployPolicy("b-deploy-policy", { * name: "cd-policy", * location: "us-central1", * selectors: [{ * deliveryPipeline: { * id: "cd-pipeline", * }, * }], * rules: [{ * rolloutRestriction: { * id: "rule", * timeWindows: { * timeZone: "America/Los_Angeles", * weeklyWindows: [{ * startTime: { * hours: 0, * minutes: 0, * }, * endTime: { * hours: 24, * minutes: 0, * }, * }], * }, * }, * }], * }); * ``` * ### Clouddeploy Deploy Policy Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const f_deploy_policy = new gcp.clouddeploy.DeployPolicy("f-deploy-policy", { * name: "cd-policy", * location: "us-central1", * 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: "policy resource", * selectors: [ * { * deliveryPipeline: { * id: "cd-pipeline", * labels: { * foo: "bar", * }, * }, * }, * { * target: { * id: "dev", * labels: { * foo: "bar", * }, * }, * }, * ], * suspended: true, * rules: [ * { * rolloutRestriction: { * id: "rule", * timeWindows: { * timeZone: "America/Los_Angeles", * weeklyWindows: [{ * startTime: { * hours: 0, * minutes: 0, * }, * endTime: { * hours: 13, * minutes: 0, * }, * }], * }, * }, * }, * { * rolloutRestriction: { * id: "rule2", * invokers: ["USER"], * actions: ["CREATE"], * timeWindows: { * timeZone: "America/Los_Angeles", * weeklyWindows: [{ * startTime: { * hours: 13, * minutes: 0, * }, * endTime: { * hours: 14, * minutes: 0, * seconds: 0, * nanos: 0, * }, * daysOfWeeks: ["MONDAY"], * }], * oneTimeWindows: [{ * startTime: { * hours: 0, * minutes: 0, * }, * endTime: { * hours: 16, * minutes: 0, * }, * startDate: { * year: 2019, * month: 1, * day: 1, * }, * endDate: { * year: 2019, * month: 12, * day: 31, * }, * }], * }, * }, * }, * ], * }); * ``` * * ## Import * * DeployPolicy can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/deployPolicies/{{name}}` * * * `{{project}}/{{location}}/{{name}}` * * * `{{location}}/{{name}}` * * When using the `pulumi import` command, DeployPolicy can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:clouddeploy/deployPolicy:DeployPolicy default projects/{{project}}/locations/{{location}}/deployPolicies/{{name}} * ``` * * ```sh * $ pulumi import gcp:clouddeploy/deployPolicy:DeployPolicy default {{project}}/{{location}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:clouddeploy/deployPolicy:DeployPolicy default {{location}}/{{name}} * ``` */ export declare class DeployPolicy extends pulumi.CustomResource { /** * Get an existing DeployPolicy resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: DeployPolicyState, opts?: pulumi.CustomResourceOptions): DeployPolicy; /** * Returns true if the given object is an instance of DeployPolicy. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is DeployPolicy; /** * 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 `effectiveAnnotations` for all of the annotations present on the resource. */ readonly annotations: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Output only. Time at which the DeployPolicy was created. */ readonly createTime: pulumi.Output<string>; /** * Description of the `DeployPolicy`. Max length is 255 characters. */ readonly description: pulumi.Output<string | undefined>; readonly effectiveAnnotations: pulumi.Output<{ [key: string]: string; }>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ readonly effectiveLabels: pulumi.Output<{ [key: string]: string; }>; /** * The weak etag of the `DeployPolicy` resource. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. */ readonly etag: pulumi.Output<string>; /** * 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 `effectiveLabels` for all of the labels present on the resource. */ readonly labels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * The location for the resource */ readonly location: pulumi.Output<string>; /** * Name of the `DeployPolicy`. */ readonly name: pulumi.Output<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output<string>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ readonly pulumiLabels: pulumi.Output<{ [key: string]: string; }>; /** * Rules to apply. At least one rule must be present. * Structure is documented below. */ readonly rules: pulumi.Output<outputs.clouddeploy.DeployPolicyRule[]>; /** * Selected resources to which the policy will be applied. At least one selector is required. If one selector matches the resource the policy applies. For example, if there are two selectors and the action being attempted matches one of them, the policy will apply to that action. * Structure is documented below. */ readonly selectors: pulumi.Output<outputs.clouddeploy.DeployPolicySelector[]>; /** * When suspended, the policy will not prevent actions from occurring, even if the action violates the policy. */ readonly suspended: pulumi.Output<boolean | undefined>; /** * Output only. Unique identifier of the `DeployPolicy`. */ readonly uid: pulumi.Output<string>; /** * Output only. Time at which the DeployPolicy was updated. */ readonly updateTime: pulumi.Output<string>; /** * Create a DeployPolicy resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: DeployPolicyArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering DeployPolicy resources. */ export interface DeployPolicyState { /** * 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 `effectiveAnnotations` for all of the annotations present on the resource. */ annotations?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Output only. Time at which the DeployPolicy was created. */ createTime?: pulumi.Input<string>; /** * Description of the `DeployPolicy`. Max length is 255 characters. */ description?: pulumi.Input<string>; effectiveAnnotations?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ effectiveLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The weak etag of the `DeployPolicy` resource. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. */ etag?: pulumi.Input<string>; /** * 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 `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The location for the resource */ location?: pulumi.Input<string>; /** * Name of the `DeployPolicy`. */ name?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Rules to apply. At least one rule must be present. * Structure is documented below. */ rules?: pulumi.Input<pulumi.Input<inputs.clouddeploy.DeployPolicyRule>[]>; /** * Selected resources to which the policy will be applied. At least one selector is required. If one selector matches the resource the policy applies. For example, if there are two selectors and the action being attempted matches one of them, the policy will apply to that action. * Structure is documented below. */ selectors?: pulumi.Input<pulumi.Input<inputs.clouddeploy.DeployPolicySelector>[]>; /** * When suspended, the policy will not prevent actions from occurring, even if the action violates the policy. */ suspended?: pulumi.Input<boolean>; /** * Output only. Unique identifier of the `DeployPolicy`. */ uid?: pulumi.Input<string>; /** * Output only. Time at which the DeployPolicy was updated. */ updateTime?: pulumi.Input<string>; } /** * The set of arguments for constructing a DeployPolicy resource. */ export interface DeployPolicyArgs { /** * 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 `effectiveAnnotations` for all of the annotations present on the resource. */ annotations?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Description of the `DeployPolicy`. Max length is 255 characters. */ description?: pulumi.Input<string>; /** * 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 `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The location for the resource */ location: pulumi.Input<string>; /** * Name of the `DeployPolicy`. */ name?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * Rules to apply. At least one rule must be present. * Structure is documented below. */ rules: pulumi.Input<pulumi.Input<inputs.clouddeploy.DeployPolicyRule>[]>; /** * Selected resources to which the policy will be applied. At least one selector is required. If one selector matches the resource the policy applies. For example, if there are two selectors and the action being attempted matches one of them, the policy will apply to that action. * Structure is documented below. */ selectors: pulumi.Input<pulumi.Input<inputs.clouddeploy.DeployPolicySelector>[]>; /** * When suspended, the policy will not prevent actions from occurring, even if the action violates the policy. */ suspended?: pulumi.Input<boolean>; }