UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

422 lines (421 loc) 19.4 kB
import * as pulumi from "@pulumi/pulumi"; import { input as inputs, output as outputs } from "../types"; /** * Manages an ELB L7 Policy resource within HuaweiCloud. * * ## Example Usage * ### ELB L7 Policy redirect to pool * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const listenerId = config.requireObject("listenerId"); * const poolId = config.requireObject("poolId"); * const policy1 = new huaweicloud.dedicatedelb.L7policy("policy1", { * action: "REDIRECT_TO_POOL", * priority: 20, * description: "test description", * listenerId: listenerId, * redirectPoolId: poolId, * redirectPoolsExtendConfig: { * rewriteUrlEnabled: true, * rewriteUrlConfig: { * host: "test.com", * path: "/path", * query: "abc", * }, * }, * }); * ``` * ### ELB L7 Policy redirect to listener * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const listenerId = config.requireObject("listenerId"); * const redirectListenerId = config.requireObject("redirectListenerId"); * const policy1 = new huaweicloud.dedicatedelb.L7policy("policy1", { * action: "REDIRECT_TO_LISTENER", * description: "test description", * listenerId: listenerId, * redirectListenerId: redirectListenerId, * }); * ``` * ### ELB L7 Policy redirect to URL * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const listenerId = config.requireObject("listenerId"); * const policy1 = new huaweicloud.dedicatedelb.L7policy("policy1", { * action: "REDIRECT_TO_URL", * priority: 20, * description: "test description", * listenerId: listenerId, * redirectUrlConfig: { * protocol: "HTTP", * host: "test.com", * port: "6666", * path: "/test_policy", * query: "test_query", * statusCode: "301", * }, * }); * ``` * ### ELB L7 Policy redirect to fixed response * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const listenerId = config.requireObject("listenerId"); * const policy1 = new huaweicloud.dedicatedelb.L7policy("policy1", { * action: "FIXED_RESPONSE", * priority: 20, * description: "test description", * listenerId: listenerId, * fixedResponseConfig: { * statusCode: "200", * contentType: "application/json", * messageBody: "it is a test", * }, * }); * ``` * * ## Import * * ELB policy can be imported using the `id`, e.g. bash * * ```sh * $ pulumi import huaweicloud:DedicatedElb/l7policy:L7policy policy_1 <id> * ``` */ export declare class L7policy extends pulumi.CustomResource { /** * Get an existing L7policy 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?: L7policyState, opts?: pulumi.CustomResourceOptions): L7policy; /** * Returns true if the given object is an instance of L7policy. 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 L7policy; /** * Whether requests are forwarded to another backend server group * or redirected to an HTTPS listener. Changing this creates a new L7 Policy. The value ranges: * + **REDIRECT_TO_POOL**: Requests are forwarded to the backend server group specified by `redirectPoolId` or * `redirectPoolsConfig`, the `protocol` of the listener must be **HTTP** or **HTTPS**. * + **REDIRECT_TO_LISTENER**: Requests are redirected from the HTTP listener specified by `listenerId` to the * HTTPS listener specified by `redirectListenerId`, the `protocol` of the listener must be **HTTP**. * + **REDIRECT_TO_URL**: Requests are forwarded to another URL whose config specified by `redirectUrlConfig`. * + **FIXED_RESPONSE**: Requests are forwarded to a fixed response body specified by `fixedResponseConfig`. * Defaults to **REDIRECT_TO_POOL**. */ readonly action: pulumi.Output<string | undefined>; /** * The creation time of the L7 policy. */ readonly createdAt: pulumi.Output<string>; /** * Human-readable description for the L7 Policy. */ readonly description: pulumi.Output<string | undefined>; /** * The ID of the enterprise project. */ readonly enterpriseProjectId: pulumi.Output<string>; /** * The fixed configuration of the page to which the traffic is * redirected. This parameter is mandatory when `action` is set to **FIXED_RESPONSE**. The `enhanceL7policyEnable` of * the listener must be set to **true**. * The fixedResponseConfig structure is documented below. */ readonly fixedResponseConfig: pulumi.Output<outputs.DedicatedElb.L7policyFixedResponseConfig>; /** * The Listener on which the L7 Policy will be associated with. Changing * this creates a new L7 Policy. */ readonly listenerId: pulumi.Output<string>; /** * Human-readable name for the L7 Policy. Does not have to be unique. */ readonly name: pulumi.Output<string>; /** * The forwarding policy priority. A smaller value indicates a higher priority. The value * must be unique for forwarding policies of the same listener. This parameter will take effect only when * `enhanceL7policyEnable` of the listener is set to **true**. If `action` is set to **REDIRECT_TO_LISTENER**, * the value can only be 0. */ readonly priority: pulumi.Output<number>; /** * The provisioning status of the forwarding policy. */ readonly provisioningStatus: pulumi.Output<string>; /** * The ID of the listener to which the traffic is redirected. * This parameter is mandatory when `action` is set to **REDIRECT_TO_LISTENER**. The listener must meet the * following requirements: * + Can only be an HTTPS listener. * + Can only be a listener of the same load balancer. */ readonly redirectListenerId: pulumi.Output<string>; /** * The ID of the backend server group to which traffic is forwarded. * This parameter will take effect when `action` is set to **REDIRECT_TO_POOL**. The backend server group must meet the * following requirements: * + Cannot be the default backend server group of the listener. * + Cannot be the backend server group used by forwarding policies of other listeners. */ readonly redirectPoolId: pulumi.Output<string>; /** * The list of the backend server groups to which traffic is forwarded. * traffic is redirected. This parameter will take effect when `action` is set to **REDIRECT_TO_POOL**. * The redirectPoolsConfig structure is documented below. */ readonly redirectPoolsConfigs: pulumi.Output<outputs.DedicatedElb.L7policyRedirectPoolsConfig[]>; /** * The config of the backend server group to which the * traffic is redirected. This parameter will take effect when `action` is set to **REDIRECT_TO_POOL**. * The redirectPoolsExtendConfig structure is documented below. */ readonly redirectPoolsExtendConfig: pulumi.Output<outputs.DedicatedElb.L7policyRedirectPoolsExtendConfig>; /** * The session persistence between backend server groups which * associated with the policy. This parameter will take effect when `action` is set to **REDIRECT_TO_POOL**. * The redirectPoolsStickySessionConfig structure is documented below. */ readonly redirectPoolsStickySessionConfig: pulumi.Output<outputs.DedicatedElb.L7policyRedirectPoolsStickySessionConfig>; /** * The URL config to which the traffic is redirected. * This parameter is mandatory when `action` is set to **REDIRECT_TO_URL**. The `enhanceL7policyEnable` of the * listener must be set to **true**. * The redirectUrlConfig structure is documented below. */ readonly redirectUrlConfig: pulumi.Output<outputs.DedicatedElb.L7policyRedirectUrlConfig>; /** * The region in which to create the L7 Policy resource. If omitted, the * provider-level region will be used. Changing this creates a new L7 Policy. */ readonly region: pulumi.Output<string>; /** * The update time of the L7 policy. */ readonly updatedAt: pulumi.Output<string>; /** * Create a L7policy 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: L7policyArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering L7policy resources. */ export interface L7policyState { /** * Whether requests are forwarded to another backend server group * or redirected to an HTTPS listener. Changing this creates a new L7 Policy. The value ranges: * + **REDIRECT_TO_POOL**: Requests are forwarded to the backend server group specified by `redirectPoolId` or * `redirectPoolsConfig`, the `protocol` of the listener must be **HTTP** or **HTTPS**. * + **REDIRECT_TO_LISTENER**: Requests are redirected from the HTTP listener specified by `listenerId` to the * HTTPS listener specified by `redirectListenerId`, the `protocol` of the listener must be **HTTP**. * + **REDIRECT_TO_URL**: Requests are forwarded to another URL whose config specified by `redirectUrlConfig`. * + **FIXED_RESPONSE**: Requests are forwarded to a fixed response body specified by `fixedResponseConfig`. * Defaults to **REDIRECT_TO_POOL**. */ action?: pulumi.Input<string>; /** * The creation time of the L7 policy. */ createdAt?: pulumi.Input<string>; /** * Human-readable description for the L7 Policy. */ description?: pulumi.Input<string>; /** * The ID of the enterprise project. */ enterpriseProjectId?: pulumi.Input<string>; /** * The fixed configuration of the page to which the traffic is * redirected. This parameter is mandatory when `action` is set to **FIXED_RESPONSE**. The `enhanceL7policyEnable` of * the listener must be set to **true**. * The fixedResponseConfig structure is documented below. */ fixedResponseConfig?: pulumi.Input<inputs.DedicatedElb.L7policyFixedResponseConfig>; /** * The Listener on which the L7 Policy will be associated with. Changing * this creates a new L7 Policy. */ listenerId?: pulumi.Input<string>; /** * Human-readable name for the L7 Policy. Does not have to be unique. */ name?: pulumi.Input<string>; /** * The forwarding policy priority. A smaller value indicates a higher priority. The value * must be unique for forwarding policies of the same listener. This parameter will take effect only when * `enhanceL7policyEnable` of the listener is set to **true**. If `action` is set to **REDIRECT_TO_LISTENER**, * the value can only be 0. */ priority?: pulumi.Input<number>; /** * The provisioning status of the forwarding policy. */ provisioningStatus?: pulumi.Input<string>; /** * The ID of the listener to which the traffic is redirected. * This parameter is mandatory when `action` is set to **REDIRECT_TO_LISTENER**. The listener must meet the * following requirements: * + Can only be an HTTPS listener. * + Can only be a listener of the same load balancer. */ redirectListenerId?: pulumi.Input<string>; /** * The ID of the backend server group to which traffic is forwarded. * This parameter will take effect when `action` is set to **REDIRECT_TO_POOL**. The backend server group must meet the * following requirements: * + Cannot be the default backend server group of the listener. * + Cannot be the backend server group used by forwarding policies of other listeners. */ redirectPoolId?: pulumi.Input<string>; /** * The list of the backend server groups to which traffic is forwarded. * traffic is redirected. This parameter will take effect when `action` is set to **REDIRECT_TO_POOL**. * The redirectPoolsConfig structure is documented below. */ redirectPoolsConfigs?: pulumi.Input<pulumi.Input<inputs.DedicatedElb.L7policyRedirectPoolsConfig>[]>; /** * The config of the backend server group to which the * traffic is redirected. This parameter will take effect when `action` is set to **REDIRECT_TO_POOL**. * The redirectPoolsExtendConfig structure is documented below. */ redirectPoolsExtendConfig?: pulumi.Input<inputs.DedicatedElb.L7policyRedirectPoolsExtendConfig>; /** * The session persistence between backend server groups which * associated with the policy. This parameter will take effect when `action` is set to **REDIRECT_TO_POOL**. * The redirectPoolsStickySessionConfig structure is documented below. */ redirectPoolsStickySessionConfig?: pulumi.Input<inputs.DedicatedElb.L7policyRedirectPoolsStickySessionConfig>; /** * The URL config to which the traffic is redirected. * This parameter is mandatory when `action` is set to **REDIRECT_TO_URL**. The `enhanceL7policyEnable` of the * listener must be set to **true**. * The redirectUrlConfig structure is documented below. */ redirectUrlConfig?: pulumi.Input<inputs.DedicatedElb.L7policyRedirectUrlConfig>; /** * The region in which to create the L7 Policy resource. If omitted, the * provider-level region will be used. Changing this creates a new L7 Policy. */ region?: pulumi.Input<string>; /** * The update time of the L7 policy. */ updatedAt?: pulumi.Input<string>; } /** * The set of arguments for constructing a L7policy resource. */ export interface L7policyArgs { /** * Whether requests are forwarded to another backend server group * or redirected to an HTTPS listener. Changing this creates a new L7 Policy. The value ranges: * + **REDIRECT_TO_POOL**: Requests are forwarded to the backend server group specified by `redirectPoolId` or * `redirectPoolsConfig`, the `protocol` of the listener must be **HTTP** or **HTTPS**. * + **REDIRECT_TO_LISTENER**: Requests are redirected from the HTTP listener specified by `listenerId` to the * HTTPS listener specified by `redirectListenerId`, the `protocol` of the listener must be **HTTP**. * + **REDIRECT_TO_URL**: Requests are forwarded to another URL whose config specified by `redirectUrlConfig`. * + **FIXED_RESPONSE**: Requests are forwarded to a fixed response body specified by `fixedResponseConfig`. * Defaults to **REDIRECT_TO_POOL**. */ action?: pulumi.Input<string>; /** * Human-readable description for the L7 Policy. */ description?: pulumi.Input<string>; /** * The fixed configuration of the page to which the traffic is * redirected. This parameter is mandatory when `action` is set to **FIXED_RESPONSE**. The `enhanceL7policyEnable` of * the listener must be set to **true**. * The fixedResponseConfig structure is documented below. */ fixedResponseConfig?: pulumi.Input<inputs.DedicatedElb.L7policyFixedResponseConfig>; /** * The Listener on which the L7 Policy will be associated with. Changing * this creates a new L7 Policy. */ listenerId: pulumi.Input<string>; /** * Human-readable name for the L7 Policy. Does not have to be unique. */ name?: pulumi.Input<string>; /** * The forwarding policy priority. A smaller value indicates a higher priority. The value * must be unique for forwarding policies of the same listener. This parameter will take effect only when * `enhanceL7policyEnable` of the listener is set to **true**. If `action` is set to **REDIRECT_TO_LISTENER**, * the value can only be 0. */ priority?: pulumi.Input<number>; /** * The ID of the listener to which the traffic is redirected. * This parameter is mandatory when `action` is set to **REDIRECT_TO_LISTENER**. The listener must meet the * following requirements: * + Can only be an HTTPS listener. * + Can only be a listener of the same load balancer. */ redirectListenerId?: pulumi.Input<string>; /** * The ID of the backend server group to which traffic is forwarded. * This parameter will take effect when `action` is set to **REDIRECT_TO_POOL**. The backend server group must meet the * following requirements: * + Cannot be the default backend server group of the listener. * + Cannot be the backend server group used by forwarding policies of other listeners. */ redirectPoolId?: pulumi.Input<string>; /** * The list of the backend server groups to which traffic is forwarded. * traffic is redirected. This parameter will take effect when `action` is set to **REDIRECT_TO_POOL**. * The redirectPoolsConfig structure is documented below. */ redirectPoolsConfigs?: pulumi.Input<pulumi.Input<inputs.DedicatedElb.L7policyRedirectPoolsConfig>[]>; /** * The config of the backend server group to which the * traffic is redirected. This parameter will take effect when `action` is set to **REDIRECT_TO_POOL**. * The redirectPoolsExtendConfig structure is documented below. */ redirectPoolsExtendConfig?: pulumi.Input<inputs.DedicatedElb.L7policyRedirectPoolsExtendConfig>; /** * The session persistence between backend server groups which * associated with the policy. This parameter will take effect when `action` is set to **REDIRECT_TO_POOL**. * The redirectPoolsStickySessionConfig structure is documented below. */ redirectPoolsStickySessionConfig?: pulumi.Input<inputs.DedicatedElb.L7policyRedirectPoolsStickySessionConfig>; /** * The URL config to which the traffic is redirected. * This parameter is mandatory when `action` is set to **REDIRECT_TO_URL**. The `enhanceL7policyEnable` of the * listener must be set to **true**. * The redirectUrlConfig structure is documented below. */ redirectUrlConfig?: pulumi.Input<inputs.DedicatedElb.L7policyRedirectUrlConfig>; /** * The region in which to create the L7 Policy resource. If omitted, the * provider-level region will be used. Changing this creates a new L7 Policy. */ region?: pulumi.Input<string>; }