@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
478 lines (477 loc) • 16.7 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* HttpRoute is the resource defining how HTTP traffic should be routed by a Mesh or Gateway resource.
*
* To get more information about HttpRoute, see:
*
* * [API documentation](https://cloud.google.com/traffic-director/docs/reference/network-services/rest/v1beta1/projects.locations.httpRoutes)
* * How-to Guides
* * [Setup HTTP Services](https://cloud.google.com/traffic-director/docs/set-up-envoy-http-mesh)
*
* ## Example Usage
*
* ### Network Services Http Route Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.networkservices.HttpRoute("default", {
* name: "my-http-route",
* labels: {
* foo: "bar",
* },
* description: "my description",
* hostnames: ["example"],
* rules: [{
* matches: [{
* queryParameters: [{
* queryParameter: "key",
* exactMatch: "value",
* }],
* fullPathMatch: "example",
* }],
* }],
* });
* ```
* ### Network Services Http Route Matches And Actions
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.networkservices.HttpRoute("default", {
* name: "my-http-route",
* labels: {
* foo: "bar",
* },
* description: "my description",
* hostnames: ["example"],
* rules: [{
* matches: [
* {
* headers: [{
* header: "header",
* invertMatch: false,
* regexMatch: "header-value",
* }],
* queryParameters: [{
* queryParameter: "key",
* exactMatch: "value",
* }],
* prefixMatch: "example",
* ignoreCase: false,
* },
* {
* headers: [{
* header: "header",
* invertMatch: false,
* presentMatch: true,
* }],
* queryParameters: [{
* queryParameter: "key",
* regexMatch: "value",
* }],
* regexMatch: "example",
* ignoreCase: false,
* },
* {
* headers: [{
* header: "header",
* invertMatch: false,
* presentMatch: true,
* }],
* queryParameters: [{
* queryParameter: "key",
* presentMatch: true,
* }],
* fullPathMatch: "example",
* ignoreCase: false,
* },
* ],
* action: {
* redirect: {
* hostRedirect: "new-host",
* pathRedirect: "new-path",
* prefixRewrite: "new-prefix",
* httpsRedirect: true,
* stripQuery: true,
* portRedirect: 8081,
* },
* urlRewrite: {
* pathPrefixRewrite: "new-prefix",
* hostRewrite: "new-host",
* },
* retryPolicy: {
* retryConditions: ["server_error"],
* numRetries: 1,
* perTryTimeout: "1s",
* },
* requestMirrorPolicy: {
* destination: {
* serviceName: "new",
* weight: 1,
* },
* },
* corsPolicy: {
* allowOrigins: ["example"],
* allowMethods: [
* "GET",
* "PUT",
* ],
* allowHeaders: [
* "version",
* "type",
* ],
* exposeHeaders: [
* "version",
* "type",
* ],
* maxAge: "1s",
* allowCredentials: true,
* disabled: false,
* },
* },
* }],
* });
* ```
* ### Network Services Http Route Actions
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.networkservices.HttpRoute("default", {
* name: "my-http-route",
* labels: {
* foo: "bar",
* },
* description: "my description",
* hostnames: ["example"],
* rules: [{
* action: {
* faultInjectionPolicy: {
* delay: {
* fixedDelay: "1s",
* percentage: 1,
* },
* abort: {
* httpStatus: 500,
* percentage: 1,
* },
* },
* urlRewrite: {
* pathPrefixRewrite: "new-prefix",
* hostRewrite: "new-host",
* },
* retryPolicy: {
* retryConditions: ["server_error"],
* numRetries: 1,
* perTryTimeout: "1s",
* },
* requestMirrorPolicy: {
* destination: {
* serviceName: "new",
* weight: 1,
* },
* },
* corsPolicy: {
* allowOrigins: ["example"],
* allowMethods: [
* "GET",
* "PUT",
* ],
* allowHeaders: [
* "version",
* "type",
* ],
* exposeHeaders: [
* "version",
* "type",
* ],
* maxAge: "1s",
* allowCredentials: true,
* disabled: false,
* },
* requestHeaderModifier: {
* set: {
* version: "1",
* type: "json",
* },
* add: {
* "minor-version": "1",
* },
* removes: ["arg"],
* },
* responseHeaderModifier: {
* set: {
* version: "1",
* type: "json",
* },
* add: {
* "minor-version": "1",
* },
* removes: ["removearg"],
* },
* },
* }],
* });
* ```
* ### Network Services Http Route Mesh Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.networkservices.Mesh("default", {
* name: "my-http-route",
* labels: {
* foo: "bar",
* },
* description: "my description",
* });
* const defaultHttpRoute = new gcp.networkservices.HttpRoute("default", {
* name: "my-http-route",
* labels: {
* foo: "bar",
* },
* description: "my description",
* hostnames: ["example"],
* meshes: [_default.id],
* rules: [{
* matches: [{
* queryParameters: [{
* queryParameter: "key",
* exactMatch: "value",
* }],
* fullPathMatch: "example",
* }],
* }],
* });
* ```
*
* ## Import
*
* HttpRoute can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/global/httpRoutes/{{name}}`
*
* * `{{project}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, HttpRoute can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:networkservices/httpRoute:HttpRoute default projects/{{project}}/locations/global/httpRoutes/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:networkservices/httpRoute:HttpRoute default {{project}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:networkservices/httpRoute:HttpRoute default {{name}}
* ```
*/
export declare class HttpRoute extends pulumi.CustomResource {
/**
* Get an existing HttpRoute 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?: HttpRouteState, opts?: pulumi.CustomResourceOptions): HttpRoute;
/**
* Returns true if the given object is an instance of HttpRoute. 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 HttpRoute;
/**
* Time the HttpRoute was created in UTC.
*/
readonly createTime: pulumi.Output<string>;
/**
* A free-text description of the resource. Max length 1024 characters.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* 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;
}>;
/**
* Gateways defines a list of gateways this HttpRoute is attached to, as one of the routing rules to route the requests
* served by the gateway. Each gateway reference should match the pattern:
* projects/*/locations/global/gateways/<gateway_name>
*/
readonly gateways: pulumi.Output<string[] | undefined>;
/**
* Set of hosts that should match against the HTTP host header to select a HttpRoute to process the request.
*/
readonly hostnames: pulumi.Output<string[]>;
/**
* Set of label tags associated with the HttpRoute 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.
*/
readonly labels: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* Meshes defines a list of meshes this HttpRoute is attached to, as one of the routing rules to route the requests served
* by the mesh. Each mesh reference should match the pattern: projects/*/locations/global/meshes/<mesh_name>. The attached
* Mesh should be of a type SIDECAR.
*/
readonly meshes: pulumi.Output<string[] | undefined>;
/**
* Name of the HttpRoute resource.
*/
readonly name: pulumi.Output<string>;
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 that define how traffic is routed and handled.
* Structure is documented below.
*/
readonly rules: pulumi.Output<outputs.networkservices.HttpRouteRule[]>;
/**
* Server-defined URL of this resource.
*/
readonly selfLink: pulumi.Output<string>;
/**
* Time the HttpRoute was updated in UTC.
*/
readonly updateTime: pulumi.Output<string>;
/**
* Create a HttpRoute 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: HttpRouteArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering HttpRoute resources.
*/
export interface HttpRouteState {
/**
* Time the HttpRoute was created in UTC.
*/
createTime?: pulumi.Input<string>;
/**
* A free-text description of the resource. Max length 1024 characters.
*/
description?: 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>;
}>;
/**
* Gateways defines a list of gateways this HttpRoute is attached to, as one of the routing rules to route the requests
* served by the gateway. Each gateway reference should match the pattern:
* projects/*/locations/global/gateways/<gateway_name>
*/
gateways?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Set of hosts that should match against the HTTP host header to select a HttpRoute to process the request.
*/
hostnames?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Set of label tags associated with the HttpRoute 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.
*/
labels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Meshes defines a list of meshes this HttpRoute is attached to, as one of the routing rules to route the requests served
* by the mesh. Each mesh reference should match the pattern: projects/*/locations/global/meshes/<mesh_name>. The attached
* Mesh should be of a type SIDECAR.
*/
meshes?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Name of the HttpRoute resource.
*/
name?: pulumi.Input<string>;
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 that define how traffic is routed and handled.
* Structure is documented below.
*/
rules?: pulumi.Input<pulumi.Input<inputs.networkservices.HttpRouteRule>[]>;
/**
* Server-defined URL of this resource.
*/
selfLink?: pulumi.Input<string>;
/**
* Time the HttpRoute was updated in UTC.
*/
updateTime?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a HttpRoute resource.
*/
export interface HttpRouteArgs {
/**
* A free-text description of the resource. Max length 1024 characters.
*/
description?: pulumi.Input<string>;
/**
* Gateways defines a list of gateways this HttpRoute is attached to, as one of the routing rules to route the requests
* served by the gateway. Each gateway reference should match the pattern:
* projects/*/locations/global/gateways/<gateway_name>
*/
gateways?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Set of hosts that should match against the HTTP host header to select a HttpRoute to process the request.
*/
hostnames: pulumi.Input<pulumi.Input<string>[]>;
/**
* Set of label tags associated with the HttpRoute 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.
*/
labels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Meshes defines a list of meshes this HttpRoute is attached to, as one of the routing rules to route the requests served
* by the mesh. Each mesh reference should match the pattern: projects/*/locations/global/meshes/<mesh_name>. The attached
* Mesh should be of a type SIDECAR.
*/
meshes?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Name of the HttpRoute resource.
*/
name?: pulumi.Input<string>;
project?: pulumi.Input<string>;
/**
* Rules that define how traffic is routed and handled.
* Structure is documented below.
*/
rules: pulumi.Input<pulumi.Input<inputs.networkservices.HttpRouteRule>[]>;
}