@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
317 lines • 10.8 kB
JavaScript
"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.UptimeCheckConfig = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* This message configures which resources and services to monitor for availability.
*
* To get more information about UptimeCheckConfig, see:
*
* * [API documentation](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.uptimeCheckConfigs)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/monitoring/uptime-checks/)
*
* ## Example Usage
*
* ### Uptime Check Config Http
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const http = new gcp.monitoring.UptimeCheckConfig("http", {
* displayName: "http-uptime-check",
* timeout: "60s",
* logCheckFailures: true,
* userLabels: {
* "example-key": "example-value",
* },
* httpCheck: {
* path: "some-path",
* port: 8010,
* requestMethod: "POST",
* contentType: "USER_PROVIDED",
* customContentType: "application/json",
* body: "Zm9vJTI1M0RiYXI=",
* pingConfig: {
* pingsCount: 1,
* },
* },
* monitoredResource: {
* type: "uptime_url",
* labels: {
* project_id: "my-project-name",
* host: "192.168.1.1",
* },
* },
* contentMatchers: [{
* content: "\"example\"",
* matcher: "MATCHES_JSON_PATH",
* jsonPathMatcher: {
* jsonPath: "$.path",
* jsonMatcher: "EXACT_MATCH",
* },
* }],
* checkerType: "STATIC_IP_CHECKERS",
* });
* ```
* ### Uptime Check Config Status Code
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const statusCode = new gcp.monitoring.UptimeCheckConfig("status_code", {
* displayName: "http-uptime-check",
* timeout: "60s",
* httpCheck: {
* path: "some-path",
* port: 8010,
* requestMethod: "POST",
* contentType: "URL_ENCODED",
* body: "Zm9vJTI1M0RiYXI=",
* acceptedResponseStatusCodes: [
* {
* statusClass: "STATUS_CLASS_2XX",
* },
* {
* statusValue: 301,
* },
* {
* statusValue: 302,
* },
* ],
* },
* monitoredResource: {
* type: "uptime_url",
* labels: {
* project_id: "my-project-name",
* host: "192.168.1.1",
* },
* },
* contentMatchers: [{
* content: "\"example\"",
* matcher: "MATCHES_JSON_PATH",
* jsonPathMatcher: {
* jsonPath: "$.path",
* jsonMatcher: "EXACT_MATCH",
* },
* }],
* checkerType: "STATIC_IP_CHECKERS",
* });
* ```
* ### Uptime Check Config Https
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const https = new gcp.monitoring.UptimeCheckConfig("https", {
* displayName: "https-uptime-check",
* timeout: "60s",
* httpCheck: {
* path: "/some-path",
* port: 443,
* useSsl: true,
* validateSsl: true,
* serviceAgentAuthentication: {
* type: "OIDC_TOKEN",
* },
* },
* monitoredResource: {
* type: "uptime_url",
* labels: {
* project_id: "my-project-name",
* host: "192.168.1.1",
* },
* },
* contentMatchers: [{
* content: "example",
* matcher: "MATCHES_JSON_PATH",
* jsonPathMatcher: {
* jsonPath: "$.path",
* jsonMatcher: "REGEX_MATCH",
* },
* }],
* });
* ```
* ### Uptime Check Tcp
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const check = new gcp.monitoring.Group("check", {
* displayName: "uptime-check-group",
* filter: "resource.metadata.name=has_substring(\"foo\")",
* });
* const tcpGroup = new gcp.monitoring.UptimeCheckConfig("tcp_group", {
* displayName: "tcp-uptime-check",
* timeout: "60s",
* tcpCheck: {
* port: 888,
* pingConfig: {
* pingsCount: 2,
* },
* },
* resourceGroup: {
* resourceType: "INSTANCE",
* groupId: check.name,
* },
* });
* ```
* ### Uptime Check Config Synthetic Monitor
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const bucket = new gcp.storage.Bucket("bucket", {
* name: "my-project-name-gcf-source",
* location: "US",
* uniformBucketLevelAccess: true,
* });
* const object = new gcp.storage.BucketObject("object", {
* name: "function-source.zip",
* bucket: bucket.name,
* source: new pulumi.asset.FileAsset("synthetic-fn-source.zip"),
* });
* const _function = new gcp.cloudfunctionsv2.Function("function", {
* name: "synthetic_function",
* location: "us-central1",
* buildConfig: {
* runtime: "nodejs20",
* entryPoint: "SyntheticFunction",
* source: {
* storageSource: {
* bucket: bucket.name,
* object: object.name,
* },
* },
* },
* serviceConfig: {
* maxInstanceCount: 1,
* availableMemory: "256M",
* timeoutSeconds: 60,
* },
* });
* const syntheticMonitor = new gcp.monitoring.UptimeCheckConfig("synthetic_monitor", {
* displayName: "synthetic_monitor",
* timeout: "60s",
* syntheticMonitor: {
* cloudFunctionV2: {
* name: _function.id,
* },
* },
* });
* ```
*
* ## Ephemeral Attributes Reference
*
* The following write-only attributes are supported:
*
* ## Import
*
* UptimeCheckConfig can be imported using any of these accepted formats:
*
* * `{{project}}/{{name}}`
*
* * `{{project}} {{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, UptimeCheckConfig can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:monitoring/uptimeCheckConfig:UptimeCheckConfig default {{project}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:monitoring/uptimeCheckConfig:UptimeCheckConfig default "{{project}} {{name}}"
* ```
*
* ```sh
* $ pulumi import gcp:monitoring/uptimeCheckConfig:UptimeCheckConfig default {{name}}
* ```
*/
class UptimeCheckConfig extends pulumi.CustomResource {
/**
* Get an existing UptimeCheckConfig 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, id, state, opts) {
return new UptimeCheckConfig(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of UptimeCheckConfig. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === UptimeCheckConfig.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["checkerType"] = state?.checkerType;
resourceInputs["contentMatchers"] = state?.contentMatchers;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["httpCheck"] = state?.httpCheck;
resourceInputs["logCheckFailures"] = state?.logCheckFailures;
resourceInputs["monitoredResource"] = state?.monitoredResource;
resourceInputs["name"] = state?.name;
resourceInputs["period"] = state?.period;
resourceInputs["project"] = state?.project;
resourceInputs["resourceGroup"] = state?.resourceGroup;
resourceInputs["selectedRegions"] = state?.selectedRegions;
resourceInputs["syntheticMonitor"] = state?.syntheticMonitor;
resourceInputs["tcpCheck"] = state?.tcpCheck;
resourceInputs["timeout"] = state?.timeout;
resourceInputs["uptimeCheckId"] = state?.uptimeCheckId;
resourceInputs["userLabels"] = state?.userLabels;
}
else {
const args = argsOrState;
if (args?.displayName === undefined && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if (args?.timeout === undefined && !opts.urn) {
throw new Error("Missing required property 'timeout'");
}
resourceInputs["checkerType"] = args?.checkerType;
resourceInputs["contentMatchers"] = args?.contentMatchers;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["httpCheck"] = args?.httpCheck;
resourceInputs["logCheckFailures"] = args?.logCheckFailures;
resourceInputs["monitoredResource"] = args?.monitoredResource;
resourceInputs["period"] = args?.period;
resourceInputs["project"] = args?.project;
resourceInputs["resourceGroup"] = args?.resourceGroup;
resourceInputs["selectedRegions"] = args?.selectedRegions;
resourceInputs["syntheticMonitor"] = args?.syntheticMonitor;
resourceInputs["tcpCheck"] = args?.tcpCheck;
resourceInputs["timeout"] = args?.timeout;
resourceInputs["userLabels"] = args?.userLabels;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["uptimeCheckId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(UptimeCheckConfig.__pulumiType, name, resourceInputs, opts);
}
}
exports.UptimeCheckConfig = UptimeCheckConfig;
/** @internal */
UptimeCheckConfig.__pulumiType = 'gcp:monitoring/uptimeCheckConfig:UptimeCheckConfig';
//# sourceMappingURL=uptimeCheckConfig.js.map