checkpoint.GenericApi
Explore with Pulumi AI
This resource allows you to execute Check Point generic Management API or GAIA API.
See the Management API reference or GAIA API reference for a complete list of APIs you can run on your Check Point server.
NOTE: When configure provider context to gaia_api
you can run only GAIA API. Management API will not be supported.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as checkpoint from "@pulumi/checkpoint";
// Run generic Management API when provider context is 'web_api'
const api1 = new checkpoint.GenericApi("api1", {
apiCommand: "add-host",
payload: ` {
"name": "host1",
"ip-address": "1.2.3.4"
}
`,
});
// Run generic Management API when provider context is 'web_api'
const api2 = new checkpoint.GenericApi("api2", {apiCommand: "show-hosts"});
// Run generic Management API when provider context is 'web_api'
const api3 = new checkpoint.GenericApi("api3", {
apiCommand: "gaia-api/show-proxy",
payload: ` {
"target": "gateway1"
}
`,
});
// Run generic GAIA API when provider context is 'gaia_api'
const api4 = new checkpoint.GenericApi("api4", {apiCommand: "show-proxy"});
import pulumi
import pulumi_checkpoint as checkpoint
# Run generic Management API when provider context is 'web_api'
api1 = checkpoint.GenericApi("api1",
api_command="add-host",
payload=""" {
"name": "host1",
"ip-address": "1.2.3.4"
}
""")
# Run generic Management API when provider context is 'web_api'
api2 = checkpoint.GenericApi("api2", api_command="show-hosts")
# Run generic Management API when provider context is 'web_api'
api3 = checkpoint.GenericApi("api3",
api_command="gaia-api/show-proxy",
payload=""" {
"target": "gateway1"
}
""")
# Run generic GAIA API when provider context is 'gaia_api'
api4 = checkpoint.GenericApi("api4", api_command="show-proxy")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/checkpoint/v2/checkpoint"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Run generic Management API when provider context is 'web_api'
_, err := checkpoint.NewGenericApi(ctx, "api1", &checkpoint.GenericApiArgs{
ApiCommand: pulumi.String("add-host"),
Payload: pulumi.String(` {
"name": "host1",
"ip-address": "1.2.3.4"
}
`),
})
if err != nil {
return err
}
// Run generic Management API when provider context is 'web_api'
_, err = checkpoint.NewGenericApi(ctx, "api2", &checkpoint.GenericApiArgs{
ApiCommand: pulumi.String("show-hosts"),
})
if err != nil {
return err
}
// Run generic Management API when provider context is 'web_api'
_, err = checkpoint.NewGenericApi(ctx, "api3", &checkpoint.GenericApiArgs{
ApiCommand: pulumi.String("gaia-api/show-proxy"),
Payload: pulumi.String(" {\n \"target\": \"gateway1\"\n }\n \n"),
})
if err != nil {
return err
}
// Run generic GAIA API when provider context is 'gaia_api'
_, err = checkpoint.NewGenericApi(ctx, "api4", &checkpoint.GenericApiArgs{
ApiCommand: pulumi.String("show-proxy"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Checkpoint = Pulumi.Checkpoint;
return await Deployment.RunAsync(() =>
{
// Run generic Management API when provider context is 'web_api'
var api1 = new Checkpoint.GenericApi("api1", new()
{
ApiCommand = "add-host",
Payload = @" {
""name"": ""host1"",
""ip-address"": ""1.2.3.4""
}
",
});
// Run generic Management API when provider context is 'web_api'
var api2 = new Checkpoint.GenericApi("api2", new()
{
ApiCommand = "show-hosts",
});
// Run generic Management API when provider context is 'web_api'
var api3 = new Checkpoint.GenericApi("api3", new()
{
ApiCommand = "gaia-api/show-proxy",
Payload = @" {
""target"": ""gateway1""
}
",
});
// Run generic GAIA API when provider context is 'gaia_api'
var api4 = new Checkpoint.GenericApi("api4", new()
{
ApiCommand = "show-proxy",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.checkpoint.GenericApi;
import com.pulumi.checkpoint.GenericApiArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
// Run generic Management API when provider context is 'web_api'
var api1 = new GenericApi("api1", GenericApiArgs.builder()
.apiCommand("add-host")
.payload("""
{
"name": "host1",
"ip-address": "1.2.3.4"
}
""")
.build());
// Run generic Management API when provider context is 'web_api'
var api2 = new GenericApi("api2", GenericApiArgs.builder()
.apiCommand("show-hosts")
.build());
// Run generic Management API when provider context is 'web_api'
var api3 = new GenericApi("api3", GenericApiArgs.builder()
.apiCommand("gaia-api/show-proxy")
.payload("""
{
"target": "gateway1"
}
""")
.build());
// Run generic GAIA API when provider context is 'gaia_api'
var api4 = new GenericApi("api4", GenericApiArgs.builder()
.apiCommand("show-proxy")
.build());
}
}
resources:
# Run generic Management API when provider context is 'web_api'
api1:
type: checkpoint:GenericApi
properties:
apiCommand: add-host
payload: " {\n \"name\": \"host1\",\n \"ip-address\": \"1.2.3.4\"\n }\n \n"
# Run generic Management API when provider context is 'web_api'
api2:
type: checkpoint:GenericApi
properties:
apiCommand: show-hosts
# Run generic Management API when provider context is 'web_api'
api3:
type: checkpoint:GenericApi
properties:
apiCommand: gaia-api/show-proxy
payload: " {\n \"target\": \"gateway1\"\n }\n \n"
# Run generic GAIA API when provider context is 'gaia_api'
api4:
type: checkpoint:GenericApi
properties:
apiCommand: show-proxy
Create GenericApi Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new GenericApi(name: string, args: GenericApiArgs, opts?: CustomResourceOptions);
@overload
def GenericApi(resource_name: str,
args: GenericApiArgs,
opts: Optional[ResourceOptions] = None)
@overload
def GenericApi(resource_name: str,
opts: Optional[ResourceOptions] = None,
api_command: Optional[str] = None,
generic_api_id: Optional[str] = None,
method: Optional[str] = None,
payload: Optional[str] = None)
func NewGenericApi(ctx *Context, name string, args GenericApiArgs, opts ...ResourceOption) (*GenericApi, error)
public GenericApi(string name, GenericApiArgs args, CustomResourceOptions? opts = null)
public GenericApi(String name, GenericApiArgs args)
public GenericApi(String name, GenericApiArgs args, CustomResourceOptions options)
type: checkpoint:GenericApi
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args GenericApiArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args GenericApiArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args GenericApiArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args GenericApiArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args GenericApiArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var genericApiResource = new Checkpoint.GenericApi("genericApiResource", new()
{
ApiCommand = "string",
GenericApiId = "string",
Method = "string",
Payload = "string",
});
example, err := checkpoint.NewGenericApi(ctx, "genericApiResource", &checkpoint.GenericApiArgs{
ApiCommand: pulumi.String("string"),
GenericApiId: pulumi.String("string"),
Method: pulumi.String("string"),
Payload: pulumi.String("string"),
})
var genericApiResource = new GenericApi("genericApiResource", GenericApiArgs.builder()
.apiCommand("string")
.genericApiId("string")
.method("string")
.payload("string")
.build());
generic_api_resource = checkpoint.GenericApi("genericApiResource",
api_command="string",
generic_api_id="string",
method="string",
payload="string")
const genericApiResource = new checkpoint.GenericApi("genericApiResource", {
apiCommand: "string",
genericApiId: "string",
method: "string",
payload: "string",
});
type: checkpoint:GenericApi
properties:
apiCommand: string
genericApiId: string
method: string
payload: string
GenericApi Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The GenericApi resource accepts the following input properties:
- Api
Command string - API command name or path.
- Generic
Api stringId - Method string
- HTTP request method. Default is
POST
. - Payload string
- Request payload in JSON format. You can use heredoc strings to write freestyle JSON.
- Api
Command string - API command name or path.
- Generic
Api stringId - Method string
- HTTP request method. Default is
POST
. - Payload string
- Request payload in JSON format. You can use heredoc strings to write freestyle JSON.
- api
Command String - API command name or path.
- generic
Api StringId - method String
- HTTP request method. Default is
POST
. - payload String
- Request payload in JSON format. You can use heredoc strings to write freestyle JSON.
- api
Command string - API command name or path.
- generic
Api stringId - method string
- HTTP request method. Default is
POST
. - payload string
- Request payload in JSON format. You can use heredoc strings to write freestyle JSON.
- api_
command str - API command name or path.
- generic_
api_ strid - method str
- HTTP request method. Default is
POST
. - payload str
- Request payload in JSON format. You can use heredoc strings to write freestyle JSON.
- api
Command String - API command name or path.
- generic
Api StringId - method String
- HTTP request method. Default is
POST
. - payload String
- Request payload in JSON format. You can use heredoc strings to write freestyle JSON.
Outputs
All input properties are implicitly available as output properties. Additionally, the GenericApi resource produces the following output properties:
Look up Existing GenericApi Resource
Get an existing GenericApi resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: GenericApiState, opts?: CustomResourceOptions): GenericApi
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
api_command: Optional[str] = None,
generic_api_id: Optional[str] = None,
method: Optional[str] = None,
payload: Optional[str] = None,
response: Optional[str] = None) -> GenericApi
func GetGenericApi(ctx *Context, name string, id IDInput, state *GenericApiState, opts ...ResourceOption) (*GenericApi, error)
public static GenericApi Get(string name, Input<string> id, GenericApiState? state, CustomResourceOptions? opts = null)
public static GenericApi get(String name, Output<String> id, GenericApiState state, CustomResourceOptions options)
resources: _: type: checkpoint:GenericApi get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Api
Command string - API command name or path.
- Generic
Api stringId - Method string
- HTTP request method. Default is
POST
. - Payload string
- Request payload in JSON format. You can use heredoc strings to write freestyle JSON.
- Response string
- Response message in JSON format.
- Api
Command string - API command name or path.
- Generic
Api stringId - Method string
- HTTP request method. Default is
POST
. - Payload string
- Request payload in JSON format. You can use heredoc strings to write freestyle JSON.
- Response string
- Response message in JSON format.
- api
Command String - API command name or path.
- generic
Api StringId - method String
- HTTP request method. Default is
POST
. - payload String
- Request payload in JSON format. You can use heredoc strings to write freestyle JSON.
- response String
- Response message in JSON format.
- api
Command string - API command name or path.
- generic
Api stringId - method string
- HTTP request method. Default is
POST
. - payload string
- Request payload in JSON format. You can use heredoc strings to write freestyle JSON.
- response string
- Response message in JSON format.
- api_
command str - API command name or path.
- generic_
api_ strid - method str
- HTTP request method. Default is
POST
. - payload str
- Request payload in JSON format. You can use heredoc strings to write freestyle JSON.
- response str
- Response message in JSON format.
- api
Command String - API command name or path.
- generic
Api StringId - method String
- HTTP request method. Default is
POST
. - payload String
- Request payload in JSON format. You can use heredoc strings to write freestyle JSON.
- response String
- Response message in JSON format.
Package Details
- Repository
- checkpoint checkpointsw/terraform-provider-checkpoint
- License
- Notes
- This Pulumi package is based on the
checkpoint
Terraform Provider.