@pulumi/sumologic
Version:
A Pulumi package for creating and managing sumologic cloud resources.
128 lines • 5.44 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Connection = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides the ability to create, read, delete, update connections.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as sumologic from "@pulumi/sumologic";
*
* const connection = new sumologic.Connection("connection", {
* type: "WebhookConnection",
* name: "test-connection",
* description: "My description",
* url: "https://connection-endpoint.com",
* headers: {
* "X-Header": "my-header",
* },
* customHeaders: {
* "X-custom": "my-custom-header",
* },
* defaultPayload: `{
* "client" : "Sumo Logic",
* "eventType" : "{{Name}}",
* "description" : "{{Description}}",
* "search_url" : "{{QueryUrl}}",
* "num_records" : "{{NumRawResults}}",
* "search_results" : "{{AggregateResultsJson}}"
* }
* `,
* resolutionPayload: `{
* "client" : "Sumo Logic",
* "eventType" : "{{Name}}",
* "description" : "{{Description}}",
* "search_url" : "{{QueryUrl}}"
* }
* `,
* webhookType: "Webhook",
* });
* ```
*
* ## Import
*
* Connections can be imported using the connection id, e.g.:
*
* hcl
*
* ```sh
* $ pulumi import sumologic:index/connection:Connection test 1234567890
* ```
*/
class Connection extends pulumi.CustomResource {
/**
* Get an existing Connection 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 Connection(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Connection. 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'] === Connection.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["connectionSubtype"] = state ? state.connectionSubtype : undefined;
resourceInputs["customHeaders"] = state ? state.customHeaders : undefined;
resourceInputs["defaultPayload"] = state ? state.defaultPayload : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["headers"] = state ? state.headers : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["resolutionPayload"] = state ? state.resolutionPayload : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["url"] = state ? state.url : undefined;
resourceInputs["webhookType"] = state ? state.webhookType : undefined;
}
else {
const args = argsOrState;
if ((!args || args.defaultPayload === undefined) && !opts.urn) {
throw new Error("Missing required property 'defaultPayload'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
if ((!args || args.url === undefined) && !opts.urn) {
throw new Error("Missing required property 'url'");
}
resourceInputs["connectionSubtype"] = args ? args.connectionSubtype : undefined;
resourceInputs["customHeaders"] = args ? args.customHeaders : undefined;
resourceInputs["defaultPayload"] = args ? args.defaultPayload : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["headers"] = (args === null || args === void 0 ? void 0 : args.headers) ? pulumi.secret(args.headers) : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["resolutionPayload"] = args ? args.resolutionPayload : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["url"] = args ? args.url : undefined;
resourceInputs["webhookType"] = args ? args.webhookType : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["headers"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Connection.__pulumiType, name, resourceInputs, opts);
}
}
exports.Connection = Connection;
/** @internal */
Connection.__pulumiType = 'sumologic:index/connection:Connection';
//# sourceMappingURL=connection.js.map