com.pulumi.gcp.networkservices.kotlin.EndpointPolicy.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.networkservices.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.networkservices.kotlin.outputs.EndpointPolicyEndpointMatcher
import com.pulumi.gcp.networkservices.kotlin.outputs.EndpointPolicyTrafficPortSelector
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.Map
import com.pulumi.gcp.networkservices.kotlin.outputs.EndpointPolicyEndpointMatcher.Companion.toKotlin as endpointPolicyEndpointMatcherToKotlin
import com.pulumi.gcp.networkservices.kotlin.outputs.EndpointPolicyTrafficPortSelector.Companion.toKotlin as endpointPolicyTrafficPortSelectorToKotlin
/**
* Builder for [EndpointPolicy].
*/
@PulumiTagMarker
public class EndpointPolicyResourceBuilder internal constructor() {
public var name: String? = null
public var args: EndpointPolicyArgs = EndpointPolicyArgs()
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 EndpointPolicyArgsBuilder.() -> Unit) {
val builder = EndpointPolicyArgsBuilder()
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(): EndpointPolicy {
val builtJavaResource = com.pulumi.gcp.networkservices.EndpointPolicy(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return EndpointPolicy(builtJavaResource)
}
}
/**
* ## Example Usage
* ### Network Services Endpoint Policy Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.networkservices.EndpointPolicy("default", {
* name: "my-endpoint-policy",
* labels: {
* foo: "bar",
* },
* description: "my description",
* type: "SIDECAR_PROXY",
* trafficPortSelector: {
* ports: ["8081"],
* },
* endpointMatcher: {
* metadataLabelMatcher: {
* metadataLabelMatchCriteria: "MATCH_ANY",
* metadataLabels: [{
* labelName: "foo",
* labelValue: "bar",
* }],
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.networkservices.EndpointPolicy("default",
* name="my-endpoint-policy",
* labels={
* "foo": "bar",
* },
* description="my description",
* type="SIDECAR_PROXY",
* traffic_port_selector=gcp.networkservices.EndpointPolicyTrafficPortSelectorArgs(
* ports=["8081"],
* ),
* endpoint_matcher=gcp.networkservices.EndpointPolicyEndpointMatcherArgs(
* metadata_label_matcher=gcp.networkservices.EndpointPolicyEndpointMatcherMetadataLabelMatcherArgs(
* metadata_label_match_criteria="MATCH_ANY",
* metadata_labels=[gcp.networkservices.EndpointPolicyEndpointMatcherMetadataLabelMatcherMetadataLabelArgs(
* label_name="foo",
* label_value="bar",
* )],
* ),
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.NetworkServices.EndpointPolicy("default", new()
* {
* Name = "my-endpoint-policy",
* Labels =
* {
* { "foo", "bar" },
* },
* Description = "my description",
* Type = "SIDECAR_PROXY",
* TrafficPortSelector = new Gcp.NetworkServices.Inputs.EndpointPolicyTrafficPortSelectorArgs
* {
* Ports = new[]
* {
* "8081",
* },
* },
* EndpointMatcher = new Gcp.NetworkServices.Inputs.EndpointPolicyEndpointMatcherArgs
* {
* MetadataLabelMatcher = new Gcp.NetworkServices.Inputs.EndpointPolicyEndpointMatcherMetadataLabelMatcherArgs
* {
* MetadataLabelMatchCriteria = "MATCH_ANY",
* MetadataLabels = new[]
* {
* new Gcp.NetworkServices.Inputs.EndpointPolicyEndpointMatcherMetadataLabelMatcherMetadataLabelArgs
* {
* LabelName = "foo",
* LabelValue = "bar",
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networkservices"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := networkservices.NewEndpointPolicy(ctx, "default", &networkservices.EndpointPolicyArgs{
* Name: pulumi.String("my-endpoint-policy"),
* Labels: pulumi.StringMap{
* "foo": pulumi.String("bar"),
* },
* Description: pulumi.String("my description"),
* Type: pulumi.String("SIDECAR_PROXY"),
* TrafficPortSelector: &networkservices.EndpointPolicyTrafficPortSelectorArgs{
* Ports: pulumi.StringArray{
* pulumi.String("8081"),
* },
* },
* EndpointMatcher: &networkservices.EndpointPolicyEndpointMatcherArgs{
* MetadataLabelMatcher: &networkservices.EndpointPolicyEndpointMatcherMetadataLabelMatcherArgs{
* MetadataLabelMatchCriteria: pulumi.String("MATCH_ANY"),
* MetadataLabels: networkservices.EndpointPolicyEndpointMatcherMetadataLabelMatcherMetadataLabelArray{
* &networkservices.EndpointPolicyEndpointMatcherMetadataLabelMatcherMetadataLabelArgs{
* LabelName: pulumi.String("foo"),
* LabelValue: pulumi.String("bar"),
* },
* },
* },
* },
* })
* 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.networkservices.EndpointPolicy;
* import com.pulumi.gcp.networkservices.EndpointPolicyArgs;
* import com.pulumi.gcp.networkservices.inputs.EndpointPolicyTrafficPortSelectorArgs;
* import com.pulumi.gcp.networkservices.inputs.EndpointPolicyEndpointMatcherArgs;
* import com.pulumi.gcp.networkservices.inputs.EndpointPolicyEndpointMatcherMetadataLabelMatcherArgs;
* 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 default_ = new EndpointPolicy("default", EndpointPolicyArgs.builder()
* .name("my-endpoint-policy")
* .labels(Map.of("foo", "bar"))
* .description("my description")
* .type("SIDECAR_PROXY")
* .trafficPortSelector(EndpointPolicyTrafficPortSelectorArgs.builder()
* .ports("8081")
* .build())
* .endpointMatcher(EndpointPolicyEndpointMatcherArgs.builder()
* .metadataLabelMatcher(EndpointPolicyEndpointMatcherMetadataLabelMatcherArgs.builder()
* .metadataLabelMatchCriteria("MATCH_ANY")
* .metadataLabels(EndpointPolicyEndpointMatcherMetadataLabelMatcherMetadataLabelArgs.builder()
* .labelName("foo")
* .labelValue("bar")
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:networkservices:EndpointPolicy
* properties:
* name: my-endpoint-policy
* labels:
* foo: bar
* description: my description
* type: SIDECAR_PROXY
* trafficPortSelector:
* ports:
* - '8081'
* endpointMatcher:
* metadataLabelMatcher:
* metadataLabelMatchCriteria: MATCH_ANY
* metadataLabels:
* - labelName: foo
* labelValue: bar
* ```
*
* ### Network Services Endpoint Policy Empty Match
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.networkservices.EndpointPolicy("default", {
* name: "my-endpoint-policy",
* labels: {
* foo: "bar",
* },
* description: "my description",
* type: "SIDECAR_PROXY",
* trafficPortSelector: {
* ports: ["8081"],
* },
* endpointMatcher: {
* metadataLabelMatcher: {
* metadataLabelMatchCriteria: "MATCH_ANY",
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.networkservices.EndpointPolicy("default",
* name="my-endpoint-policy",
* labels={
* "foo": "bar",
* },
* description="my description",
* type="SIDECAR_PROXY",
* traffic_port_selector=gcp.networkservices.EndpointPolicyTrafficPortSelectorArgs(
* ports=["8081"],
* ),
* endpoint_matcher=gcp.networkservices.EndpointPolicyEndpointMatcherArgs(
* metadata_label_matcher=gcp.networkservices.EndpointPolicyEndpointMatcherMetadataLabelMatcherArgs(
* metadata_label_match_criteria="MATCH_ANY",
* ),
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.NetworkServices.EndpointPolicy("default", new()
* {
* Name = "my-endpoint-policy",
* Labels =
* {
* { "foo", "bar" },
* },
* Description = "my description",
* Type = "SIDECAR_PROXY",
* TrafficPortSelector = new Gcp.NetworkServices.Inputs.EndpointPolicyTrafficPortSelectorArgs
* {
* Ports = new[]
* {
* "8081",
* },
* },
* EndpointMatcher = new Gcp.NetworkServices.Inputs.EndpointPolicyEndpointMatcherArgs
* {
* MetadataLabelMatcher = new Gcp.NetworkServices.Inputs.EndpointPolicyEndpointMatcherMetadataLabelMatcherArgs
* {
* MetadataLabelMatchCriteria = "MATCH_ANY",
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networkservices"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := networkservices.NewEndpointPolicy(ctx, "default", &networkservices.EndpointPolicyArgs{
* Name: pulumi.String("my-endpoint-policy"),
* Labels: pulumi.StringMap{
* "foo": pulumi.String("bar"),
* },
* Description: pulumi.String("my description"),
* Type: pulumi.String("SIDECAR_PROXY"),
* TrafficPortSelector: &networkservices.EndpointPolicyTrafficPortSelectorArgs{
* Ports: pulumi.StringArray{
* pulumi.String("8081"),
* },
* },
* EndpointMatcher: &networkservices.EndpointPolicyEndpointMatcherArgs{
* MetadataLabelMatcher: &networkservices.EndpointPolicyEndpointMatcherMetadataLabelMatcherArgs{
* MetadataLabelMatchCriteria: pulumi.String("MATCH_ANY"),
* },
* },
* })
* 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.networkservices.EndpointPolicy;
* import com.pulumi.gcp.networkservices.EndpointPolicyArgs;
* import com.pulumi.gcp.networkservices.inputs.EndpointPolicyTrafficPortSelectorArgs;
* import com.pulumi.gcp.networkservices.inputs.EndpointPolicyEndpointMatcherArgs;
* import com.pulumi.gcp.networkservices.inputs.EndpointPolicyEndpointMatcherMetadataLabelMatcherArgs;
* 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 default_ = new EndpointPolicy("default", EndpointPolicyArgs.builder()
* .name("my-endpoint-policy")
* .labels(Map.of("foo", "bar"))
* .description("my description")
* .type("SIDECAR_PROXY")
* .trafficPortSelector(EndpointPolicyTrafficPortSelectorArgs.builder()
* .ports("8081")
* .build())
* .endpointMatcher(EndpointPolicyEndpointMatcherArgs.builder()
* .metadataLabelMatcher(EndpointPolicyEndpointMatcherMetadataLabelMatcherArgs.builder()
* .metadataLabelMatchCriteria("MATCH_ANY")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:networkservices:EndpointPolicy
* properties:
* name: my-endpoint-policy
* labels:
* foo: bar
* description: my description
* type: SIDECAR_PROXY
* trafficPortSelector:
* ports:
* - '8081'
* endpointMatcher:
* metadataLabelMatcher:
* metadataLabelMatchCriteria: MATCH_ANY
* ```
*
* ## Import
* EndpointPolicy can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/global/endpointPolicies/{{name}}`
* * `{{project}}/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, EndpointPolicy can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:networkservices/endpointPolicy:EndpointPolicy default projects/{{project}}/locations/global/endpointPolicies/{{name}}
* ```
* ```sh
* $ pulumi import gcp:networkservices/endpointPolicy:EndpointPolicy default {{project}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:networkservices/endpointPolicy:EndpointPolicy default {{name}}
* ```
*/
public class EndpointPolicy internal constructor(
override val javaResource: com.pulumi.gcp.networkservices.EndpointPolicy,
) : KotlinCustomResource(javaResource, EndpointPolicyMapper) {
/**
* This field specifies the URL of AuthorizationPolicy resource that applies authorization policies to the inbound traffic
* at the matched endpoints.
*/
public val authorizationPolicy: Output?
get() = javaResource.authorizationPolicy().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* A URL referring to a ClientTlsPolicy resource. ClientTlsPolicy can be set to specify the authentication for traffic from
* the proxy to the actual endpoints.
*/
public val clientTlsPolicy: Output?
get() = javaResource.clientTlsPolicy().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Time the TcpRoute was created in UTC.
*/
public val createTime: Output
get() = javaResource.createTime().applyValue({ args0 -> args0 })
/**
* A free-text description of the resource. Max length 1024 characters.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
*/
public val effectiveLabels: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy