import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * The `http.getHttp` data source makes an HTTP GET request to the given URL and exports * information about the response. * * The given URL may be either an `http.getHttp` or `https` URL. This resource * will issue a warning if the result is not UTF-8 encoded. * * > **Important** Although `https` URLs can be used, there is currently no * mechanism to authenticate the remote server except for general verification of * the server certificate's chain of trust. Data retrieved from servers not under * your control should be treated as untrustworthy. * * By default, there are no retries. Configuring the retry block will result in * retries if an error is returned by the client (e.g., connection errors) or if * a 5xx-range (except 501) status code is received. For further details see * [go-retryablehttp](https://pkg.go.dev/github.com/hashicorp/go-retryablehttp). * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as http from "@pulumi/http"; * * // The following example shows how to issue an HTTP GET request supplying * // an optional request header. * const example = http.getHttp({ * url: "https://checkpoint-api.hashicorp.com/v1/check/terraform", * requestHeaders: { * Accept: "application/json", * }, * }); * // The following example shows how to issue an HTTP HEAD request. * const exampleHead = http.getHttp({ * url: "https://checkpoint-api.hashicorp.com/v1/check/terraform", * method: "HEAD", * }); * // The following example shows how to issue an HTTP POST request * // supplying an optional request body. * const examplePost = http.getHttp({ * url: "https://checkpoint-api.hashicorp.com/v1/check/terraform", * method: "POST", * requestBody: "request body", * }); * ``` * * ## Usage with Postcondition * * Precondition and Postcondition * checks are available with Terraform v1.2.0 and later. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as http from "@pulumi/http"; * * const example = http.getHttp({ * url: "https://checkpoint-api.hashicorp.com/v1/check/terraform", * requestHeaders: { * Accept: "application/json", * }, * }); * ``` * * ## Usage with Precondition * * Precondition and Postcondition * checks are available with Terraform v1.2.0 and later. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as http from "@pulumi/http"; * import * as random from "@pulumi/random"; * * const example = http.getHttp({ * url: "https://checkpoint-api.hashicorp.com/v1/check/terraform", * requestHeaders: { * Accept: "application/json", * }, * }); * const exampleUuid = new random.index.Uuid("example", {}); * ``` * * ## Usage with Provisioner * * Failure Behaviour * can be leveraged within a provisioner in order to raise an error and stop applying. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as _null from "@pulumi/null"; * import * as command from "@pulumi/command"; * import * as http from "@pulumi/http"; * import * as std from "@pulumi/std"; * * const example = http.getHttp({ * url: "https://checkpoint-api.hashicorp.com/v1/check/terraform", * requestHeaders: { * Accept: "application/json", * }, * }); * const exampleResource = new _null.index.Resource("example", {}); * const exampleResourceProvisioner0 = new command.local.Command("exampleResourceProvisioner0", {create: std.index.contains({ * input: [ * 201, * 204, * ], * element: example.statusCode, * }).result}, { * dependsOn: [exampleResource], * }); * ``` */ export declare function getHttp(args: GetHttpArgs, opts?: pulumi.InvokeOptions): Promise; /** * A collection of arguments for invoking getHttp. */ export interface GetHttpArgs { /** * Certificate Authority (CA) in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. */ caCertPem?: string; /** * Client certificate in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. */ clientCertPem?: string; /** * Client key in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. */ clientKeyPem?: string; /** * Disables verification of the server's certificate chain and hostname. Defaults to `false` */ insecure?: boolean; /** * The HTTP Method for the request. Allowed methods are a subset of methods defined in [RFC7231](https://datatracker.ietf.org/doc/html/rfc7231#section-4.3) namely, `GET`, `HEAD`, and `POST`. `POST` support is only intended for read-only URLs, such as submitting a search. */ method?: string; /** * The request body as a string. */ requestBody?: string; /** * A map of request header field names and values. */ requestHeaders?: { [key: string]: string; }; /** * The request timeout in milliseconds. */ requestTimeoutMs?: number; /** * Retry request configuration. By default there are no retries. Configuring this block will result in retries if an error is returned by the client (e.g., connection errors) or if a 5xx-range (except 501) status code is received. For further details see [go-retryablehttp](https://pkg.go.dev/github.com/hashicorp/go-retryablehttp). */ retry?: inputs.GetHttpRetry; /** * The URL for the request. Supported schemes are `http.getHttp` and `https`. */ url: string; } /** * A collection of values returned by getHttp. */ export interface GetHttpResult { /** * The response body returned as a string. **NOTE**: This is deprecated, use `responseBody` instead. * * @deprecated Use responseBody instead */ readonly body: string; /** * Certificate Authority (CA) in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. */ readonly caCertPem?: string; /** * Client certificate in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. */ readonly clientCertPem?: string; /** * Client key in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. */ readonly clientKeyPem?: string; /** * The URL used for the request. */ readonly id: string; /** * Disables verification of the server's certificate chain and hostname. Defaults to `false` */ readonly insecure?: boolean; /** * The HTTP Method for the request. Allowed methods are a subset of methods defined in [RFC7231](https://datatracker.ietf.org/doc/html/rfc7231#section-4.3) namely, `GET`, `HEAD`, and `POST`. `POST` support is only intended for read-only URLs, such as submitting a search. */ readonly method?: string; /** * The request body as a string. */ readonly requestBody?: string; /** * A map of request header field names and values. */ readonly requestHeaders?: { [key: string]: string; }; /** * The request timeout in milliseconds. */ readonly requestTimeoutMs?: number; /** * The response body returned as a string. */ readonly responseBody: string; /** * The response body encoded as base64 (standard) as defined in [RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648#section-4). */ readonly responseBodyBase64: string; /** * A map of response header field names and values. Duplicate headers are concatenated according to [RFC2616](https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2). */ readonly responseHeaders: { [key: string]: string; }; /** * Retry request configuration. By default there are no retries. Configuring this block will result in retries if an error is returned by the client (e.g., connection errors) or if a 5xx-range (except 501) status code is received. For further details see [go-retryablehttp](https://pkg.go.dev/github.com/hashicorp/go-retryablehttp). */ readonly retry?: outputs.GetHttpRetry; /** * The HTTP response status code. */ readonly statusCode: number; /** * The URL for the request. Supported schemes are `http.getHttp` and `https`. */ readonly url: string; } /** * The `http.getHttp` data source makes an HTTP GET request to the given URL and exports * information about the response. * * The given URL may be either an `http.getHttp` or `https` URL. This resource * will issue a warning if the result is not UTF-8 encoded. * * > **Important** Although `https` URLs can be used, there is currently no * mechanism to authenticate the remote server except for general verification of * the server certificate's chain of trust. Data retrieved from servers not under * your control should be treated as untrustworthy. * * By default, there are no retries. Configuring the retry block will result in * retries if an error is returned by the client (e.g., connection errors) or if * a 5xx-range (except 501) status code is received. For further details see * [go-retryablehttp](https://pkg.go.dev/github.com/hashicorp/go-retryablehttp). * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as http from "@pulumi/http"; * * // The following example shows how to issue an HTTP GET request supplying * // an optional request header. * const example = http.getHttp({ * url: "https://checkpoint-api.hashicorp.com/v1/check/terraform", * requestHeaders: { * Accept: "application/json", * }, * }); * // The following example shows how to issue an HTTP HEAD request. * const exampleHead = http.getHttp({ * url: "https://checkpoint-api.hashicorp.com/v1/check/terraform", * method: "HEAD", * }); * // The following example shows how to issue an HTTP POST request * // supplying an optional request body. * const examplePost = http.getHttp({ * url: "https://checkpoint-api.hashicorp.com/v1/check/terraform", * method: "POST", * requestBody: "request body", * }); * ``` * * ## Usage with Postcondition * * Precondition and Postcondition * checks are available with Terraform v1.2.0 and later. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as http from "@pulumi/http"; * * const example = http.getHttp({ * url: "https://checkpoint-api.hashicorp.com/v1/check/terraform", * requestHeaders: { * Accept: "application/json", * }, * }); * ``` * * ## Usage with Precondition * * Precondition and Postcondition * checks are available with Terraform v1.2.0 and later. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as http from "@pulumi/http"; * import * as random from "@pulumi/random"; * * const example = http.getHttp({ * url: "https://checkpoint-api.hashicorp.com/v1/check/terraform", * requestHeaders: { * Accept: "application/json", * }, * }); * const exampleUuid = new random.index.Uuid("example", {}); * ``` * * ## Usage with Provisioner * * Failure Behaviour * can be leveraged within a provisioner in order to raise an error and stop applying. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as _null from "@pulumi/null"; * import * as command from "@pulumi/command"; * import * as http from "@pulumi/http"; * import * as std from "@pulumi/std"; * * const example = http.getHttp({ * url: "https://checkpoint-api.hashicorp.com/v1/check/terraform", * requestHeaders: { * Accept: "application/json", * }, * }); * const exampleResource = new _null.index.Resource("example", {}); * const exampleResourceProvisioner0 = new command.local.Command("exampleResourceProvisioner0", {create: std.index.contains({ * input: [ * 201, * 204, * ], * element: example.statusCode, * }).result}, { * dependsOn: [exampleResource], * }); * ``` */ export declare function getHttpOutput(args: GetHttpOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output; /** * A collection of arguments for invoking getHttp. */ export interface GetHttpOutputArgs { /** * Certificate Authority (CA) in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. */ caCertPem?: pulumi.Input; /** * Client certificate in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. */ clientCertPem?: pulumi.Input; /** * Client key in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. */ clientKeyPem?: pulumi.Input; /** * Disables verification of the server's certificate chain and hostname. Defaults to `false` */ insecure?: pulumi.Input; /** * The HTTP Method for the request. Allowed methods are a subset of methods defined in [RFC7231](https://datatracker.ietf.org/doc/html/rfc7231#section-4.3) namely, `GET`, `HEAD`, and `POST`. `POST` support is only intended for read-only URLs, such as submitting a search. */ method?: pulumi.Input; /** * The request body as a string. */ requestBody?: pulumi.Input; /** * A map of request header field names and values. */ requestHeaders?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * The request timeout in milliseconds. */ requestTimeoutMs?: pulumi.Input; /** * Retry request configuration. By default there are no retries. Configuring this block will result in retries if an error is returned by the client (e.g., connection errors) or if a 5xx-range (except 501) status code is received. For further details see [go-retryablehttp](https://pkg.go.dev/github.com/hashicorp/go-retryablehttp). */ retry?: pulumi.Input; /** * The URL for the request. Supported schemes are `http.getHttp` and `https`. */ url: pulumi.Input; }