EndpointPolicyArgs

data class EndpointPolicyArgs(val authorizationPolicy: Output<String>? = null, val clientTlsPolicy: Output<String>? = null, val description: Output<String>? = null, val endpointMatcher: Output<EndpointPolicyEndpointMatcherArgs>? = null, val labels: Output<Map<String, String>>? = null, val name: Output<String>? = null, val project: Output<String>? = null, val serverTlsPolicy: Output<String>? = null, val trafficPortSelector: Output<EndpointPolicyTrafficPortSelectorArgs>? = null, val type: Output<String>? = null) : ConvertibleToJava<EndpointPolicyArgs>

EndpointPolicy is a resource that helps apply desired configuration on the endpoints that match specific criteria. To get more information about EndpointPolicy, see:

Example Usage

Network Services Endpoint Policy Basic

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",
}],
},
},
});
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={
"ports": ["8081"],
},
endpoint_matcher={
"metadata_label_matcher": {
"metadata_label_match_criteria": "MATCH_ANY",
"metadata_labels": [{
"label_name": "foo",
"label_value": "bar",
}],
},
})
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",
},
},
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/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
})
}
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());
}
}
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

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",
},
},
});
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={
"ports": ["8081"],
},
endpoint_matcher={
"metadata_label_matcher": {
"metadata_label_match_criteria": "MATCH_ANY",
},
})
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",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/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
})
}
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());
}
}
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:

$ pulumi import gcp:networkservices/endpointPolicy:EndpointPolicy default projects/{{project}}/locations/global/endpointPolicies/{{name}}
$ pulumi import gcp:networkservices/endpointPolicy:EndpointPolicy default {{project}}/{{name}}
$ pulumi import gcp:networkservices/endpointPolicy:EndpointPolicy default {{name}}

Constructors

Link copied to clipboard
constructor(authorizationPolicy: Output<String>? = null, clientTlsPolicy: Output<String>? = null, description: Output<String>? = null, endpointMatcher: Output<EndpointPolicyEndpointMatcherArgs>? = null, labels: Output<Map<String, String>>? = null, name: Output<String>? = null, project: Output<String>? = null, serverTlsPolicy: Output<String>? = null, trafficPortSelector: Output<EndpointPolicyTrafficPortSelectorArgs>? = null, type: Output<String>? = null)

Properties

Link copied to clipboard
val authorizationPolicy: Output<String>? = null

This field specifies the URL of AuthorizationPolicy resource that applies authorization policies to the inbound traffic at the matched endpoints.

Link copied to clipboard
val clientTlsPolicy: Output<String>? = 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.

Link copied to clipboard
val description: Output<String>? = null

A free-text description of the resource. Max length 1024 characters.

Link copied to clipboard

Required. A matcher that selects endpoints to which the policies should be applied. Structure is documented below.

Link copied to clipboard
val labels: Output<Map<String, String>>? = null

Set of label tags associated with the TcpRoute resource. 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.

Link copied to clipboard
val name: Output<String>? = null

Name of the EndpointPolicy resource.

Link copied to clipboard
val project: Output<String>? = null
Link copied to clipboard
val serverTlsPolicy: Output<String>? = null

A URL referring to ServerTlsPolicy resource. ServerTlsPolicy is used to determine the authentication policy to be applied to terminate the inbound traffic at the identified backends.

Link copied to clipboard

Port selector for the (matched) endpoints. If no port selector is provided, the matched config is applied to all ports.

Link copied to clipboard
val type: Output<String>? = null

The type of endpoint policy. This is primarily used to validate the configuration. Possible values are: SIDECAR_PROXY, GRPC_SERVER.

Functions

Link copied to clipboard
open override fun toJava(): EndpointPolicyArgs