sumologic.Macro
Provides a Sumologic Macro (Beta).
The feature is in beta, will not function if not enabled for your org. Please reach out to sumologic support engineer to have the feature enabled for your org.
Example Usage
Single macro
import * as pulumi from "@pulumi/pulumi";
import * as sumologic from "@pulumi/sumologic";
const ipMacro = new sumologic.Macro("ipMacro", {
arguments: [{
name: "ip_address",
type: "String",
}],
argumentValidations: [{
errorMessage: "The ip you provided is invalid",
evalExpression: "isValidIP(ip_address)",
}],
definition: "_sourceCategory=yourcategory | where ip = {{ip_address}} | timeslice 5m | count by _timeslice",
});
import pulumi
import pulumi_sumologic as sumologic
ip_macro = sumologic.Macro("ipMacro",
arguments=[{
"name": "ip_address",
"type": "String",
}],
argument_validations=[{
"error_message": "The ip you provided is invalid",
"eval_expression": "isValidIP(ip_address)",
}],
definition="_sourceCategory=yourcategory | where ip = {{ip_address}} | timeslice 5m | count by _timeslice")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/sumologic/v3/sumologic"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sumologic.NewMacro(ctx, "ipMacro", &sumologic.MacroArgs{
Arguments: sumologic.MacroArgumentArray{
&sumologic.MacroArgumentArgs{
Name: pulumi.String("ip_address"),
Type: pulumi.String("String"),
},
},
ArgumentValidations: sumologic.MacroArgumentValidationArray{
&sumologic.MacroArgumentValidationArgs{
ErrorMessage: pulumi.String("The ip you provided is invalid"),
EvalExpression: pulumi.String("isValidIP(ip_address)"),
},
},
Definition: pulumi.String("_sourceCategory=yourcategory | where ip = {{ip_address}} | timeslice 5m | count by _timeslice"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Sumologic = Pulumi.Sumologic;
return await Deployment.RunAsync(() =>
{
var ipMacro = new Sumologic.Macro("ipMacro", new()
{
Arguments = new[]
{
new Sumologic.Inputs.MacroArgumentArgs
{
Name = "ip_address",
Type = "String",
},
},
ArgumentValidations = new[]
{
new Sumologic.Inputs.MacroArgumentValidationArgs
{
ErrorMessage = "The ip you provided is invalid",
EvalExpression = "isValidIP(ip_address)",
},
},
Definition = "_sourceCategory=yourcategory | where ip = {{ip_address}} | timeslice 5m | count by _timeslice",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.sumologic.Macro;
import com.pulumi.sumologic.MacroArgs;
import com.pulumi.sumologic.inputs.MacroArgumentArgs;
import com.pulumi.sumologic.inputs.MacroArgumentValidationArgs;
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) {
var ipMacro = new Macro("ipMacro", MacroArgs.builder()
.arguments(MacroArgumentArgs.builder()
.name("ip_address")
.type("String")
.build())
.argumentValidations(MacroArgumentValidationArgs.builder()
.errorMessage("The ip you provided is invalid")
.evalExpression("isValidIP(ip_address)")
.build())
.definition("_sourceCategory=yourcategory | where ip = {{ip_address}} | timeslice 5m | count by _timeslice")
.build());
}
}
resources:
ipMacro:
type: sumologic:Macro
properties:
arguments:
- name: ip_address
type: String
argumentValidations:
- errorMessage: The ip you provided is invalid
evalExpression: isValidIP(ip_address)
definition: _sourceCategory=yourcategory | where ip = {{ip_address}} | timeslice 5m | count by _timeslice
Macros with dependencies
import * as pulumi from "@pulumi/pulumi";
import * as sumologic from "@pulumi/sumologic";
const ipMacroNested = new sumologic.Macro("ipMacroNested", {definition: "_sourceCategory=yourcategory | count"});
const ipMacro = new sumologic.Macro("ipMacro", {definition: "_sourceCategory=yourcategory | `ip_macro_nested`"}, {
dependsOn: [ipMacroNested],
});
import pulumi
import pulumi_sumologic as sumologic
ip_macro_nested = sumologic.Macro("ipMacroNested", definition="_sourceCategory=yourcategory | count")
ip_macro = sumologic.Macro("ipMacro", definition="_sourceCategory=yourcategory | `ip_macro_nested`",
opts = pulumi.ResourceOptions(depends_on=[ip_macro_nested]))
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/sumologic/v3/sumologic"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ipMacroNested, err := sumologic.NewMacro(ctx, "ipMacroNested", &sumologic.MacroArgs{
Definition: pulumi.String("_sourceCategory=yourcategory | count"),
})
if err != nil {
return err
}
_, err = sumologic.NewMacro(ctx, "ipMacro", &sumologic.MacroArgs{
Definition: pulumi.String("_sourceCategory=yourcategory | `ip_macro_nested`"),
}, pulumi.DependsOn([]pulumi.Resource{
ipMacroNested,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Sumologic = Pulumi.Sumologic;
return await Deployment.RunAsync(() =>
{
var ipMacroNested = new Sumologic.Macro("ipMacroNested", new()
{
Definition = "_sourceCategory=yourcategory | count",
});
var ipMacro = new Sumologic.Macro("ipMacro", new()
{
Definition = "_sourceCategory=yourcategory | `ip_macro_nested`",
}, new CustomResourceOptions
{
DependsOn =
{
ipMacroNested,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.sumologic.Macro;
import com.pulumi.sumologic.MacroArgs;
import com.pulumi.resources.CustomResourceOptions;
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) {
var ipMacroNested = new Macro("ipMacroNested", MacroArgs.builder()
.definition("_sourceCategory=yourcategory | count")
.build());
var ipMacro = new Macro("ipMacro", MacroArgs.builder()
.definition("_sourceCategory=yourcategory | `ip_macro_nested`")
.build(), CustomResourceOptions.builder()
.dependsOn(ipMacroNested)
.build());
}
}
resources:
ipMacro:
type: sumologic:Macro
properties:
definition: _sourceCategory=yourcategory | `ip_macro_nested`
options:
dependsOn:
- ${ipMacroNested}
ipMacroNested:
type: sumologic:Macro
properties:
definition: _sourceCategory=yourcategory | count
Attributes reference
In addition to all arguments above, the following attributes are exported:
id- The ID of the macro.
Schema for argument
name- (Required) Name of the argument.type- (Required) Type of the argument. Must be String, Any, Number or Keyword
Schema for argumentValidation
evalExpression- (Required) The expression to validate a macro argument.errorMessage- (Required) Error message to show when the argument validation failed.
Create Macro Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Macro(name: string, args: MacroArgs, opts?: CustomResourceOptions);@overload
def Macro(resource_name: str,
args: MacroArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Macro(resource_name: str,
opts: Optional[ResourceOptions] = None,
definition: Optional[str] = None,
argument_validations: Optional[Sequence[MacroArgumentValidationArgs]] = None,
arguments: Optional[Sequence[MacroArgumentArgs]] = None,
description: Optional[str] = None,
enabled: Optional[bool] = None,
macro_id: Optional[str] = None,
name: Optional[str] = None)func NewMacro(ctx *Context, name string, args MacroArgs, opts ...ResourceOption) (*Macro, error)public Macro(string name, MacroArgs args, CustomResourceOptions? opts = null)type: sumologic:Macro
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 MacroArgs
- 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 MacroArgs
- 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 MacroArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MacroArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MacroArgs
- 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 macroResource = new Sumologic.Macro("macroResource", new()
{
Definition = "string",
ArgumentValidations = new[]
{
new Sumologic.Inputs.MacroArgumentValidationArgs
{
EvalExpression = "string",
ErrorMessage = "string",
},
},
Arguments = new[]
{
new Sumologic.Inputs.MacroArgumentArgs
{
Name = "string",
Type = "string",
},
},
Description = "string",
Enabled = false,
MacroId = "string",
Name = "string",
});
example, err := sumologic.NewMacro(ctx, "macroResource", &sumologic.MacroArgs{
Definition: pulumi.String("string"),
ArgumentValidations: sumologic.MacroArgumentValidationArray{
&sumologic.MacroArgumentValidationArgs{
EvalExpression: pulumi.String("string"),
ErrorMessage: pulumi.String("string"),
},
},
Arguments: sumologic.MacroArgumentArray{
&sumologic.MacroArgumentArgs{
Name: pulumi.String("string"),
Type: pulumi.String("string"),
},
},
Description: pulumi.String("string"),
Enabled: pulumi.Bool(false),
MacroId: pulumi.String("string"),
Name: pulumi.String("string"),
})
var macroResource = new Macro("macroResource", MacroArgs.builder()
.definition("string")
.argumentValidations(MacroArgumentValidationArgs.builder()
.evalExpression("string")
.errorMessage("string")
.build())
.arguments(MacroArgumentArgs.builder()
.name("string")
.type("string")
.build())
.description("string")
.enabled(false)
.macroId("string")
.name("string")
.build());
macro_resource = sumologic.Macro("macroResource",
definition="string",
argument_validations=[{
"eval_expression": "string",
"error_message": "string",
}],
arguments=[{
"name": "string",
"type": "string",
}],
description="string",
enabled=False,
macro_id="string",
name="string")
const macroResource = new sumologic.Macro("macroResource", {
definition: "string",
argumentValidations: [{
evalExpression: "string",
errorMessage: "string",
}],
arguments: [{
name: "string",
type: "string",
}],
description: "string",
enabled: false,
macroId: "string",
name: "string",
});
type: sumologic:Macro
properties:
argumentValidations:
- errorMessage: string
evalExpression: string
arguments:
- name: string
type: string
definition: string
description: string
enabled: false
macroId: string
name: string
Macro 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 Macro resource accepts the following input properties:
- Definition string
- The definition of your macro
- Argument
Validations List<MacroArgument Validation> - Arguments
List<Macro
Argument> - A list of arguments for the macro. They must match the arguments in the definition. See argument schema for details.
argumentValidations- (Block List, Optional) A list validations for the arguments in the macro. See argumentValidation schema for details.
- Description string
- Description of the macro.
- Enabled bool
- Whether the macro will be enabled. Default true.
- Macro
Id string - Name string
- Name of the macro.
- Definition string
- The definition of your macro
- Argument
Validations []MacroArgument Validation Args - Arguments
[]Macro
Argument Args - A list of arguments for the macro. They must match the arguments in the definition. See argument schema for details.
argumentValidations- (Block List, Optional) A list validations for the arguments in the macro. See argumentValidation schema for details.
- Description string
- Description of the macro.
- Enabled bool
- Whether the macro will be enabled. Default true.
- Macro
Id string - Name string
- Name of the macro.
- definition String
- The definition of your macro
- argument
Validations List<MacroArgument Validation> - arguments
List<Macro
Argument> - A list of arguments for the macro. They must match the arguments in the definition. See argument schema for details.
argumentValidations- (Block List, Optional) A list validations for the arguments in the macro. See argumentValidation schema for details.
- description String
- Description of the macro.
- enabled Boolean
- Whether the macro will be enabled. Default true.
- macro
Id String - name String
- Name of the macro.
- definition string
- The definition of your macro
- argument
Validations MacroArgument Validation[] - arguments
Macro
Argument[] - A list of arguments for the macro. They must match the arguments in the definition. See argument schema for details.
argumentValidations- (Block List, Optional) A list validations for the arguments in the macro. See argumentValidation schema for details.
- description string
- Description of the macro.
- enabled boolean
- Whether the macro will be enabled. Default true.
- macro
Id string - name string
- Name of the macro.
- definition str
- The definition of your macro
- argument_
validations Sequence[MacroArgument Validation Args] - arguments
Sequence[Macro
Argument Args] - A list of arguments for the macro. They must match the arguments in the definition. See argument schema for details.
argumentValidations- (Block List, Optional) A list validations for the arguments in the macro. See argumentValidation schema for details.
- description str
- Description of the macro.
- enabled bool
- Whether the macro will be enabled. Default true.
- macro_
id str - name str
- Name of the macro.
- definition String
- The definition of your macro
- argument
Validations List<Property Map> - arguments List<Property Map>
- A list of arguments for the macro. They must match the arguments in the definition. See argument schema for details.
argumentValidations- (Block List, Optional) A list validations for the arguments in the macro. See argumentValidation schema for details.
- description String
- Description of the macro.
- enabled Boolean
- Whether the macro will be enabled. Default true.
- macro
Id String - name String
- Name of the macro.
Outputs
All input properties are implicitly available as output properties. Additionally, the Macro resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Macro Resource
Get an existing Macro 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?: MacroState, opts?: CustomResourceOptions): Macro@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
argument_validations: Optional[Sequence[MacroArgumentValidationArgs]] = None,
arguments: Optional[Sequence[MacroArgumentArgs]] = None,
definition: Optional[str] = None,
description: Optional[str] = None,
enabled: Optional[bool] = None,
macro_id: Optional[str] = None,
name: Optional[str] = None) -> Macrofunc GetMacro(ctx *Context, name string, id IDInput, state *MacroState, opts ...ResourceOption) (*Macro, error)public static Macro Get(string name, Input<string> id, MacroState? state, CustomResourceOptions? opts = null)public static Macro get(String name, Output<String> id, MacroState state, CustomResourceOptions options)resources: _: type: sumologic:Macro 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.
- Argument
Validations List<MacroArgument Validation> - Arguments
List<Macro
Argument> - A list of arguments for the macro. They must match the arguments in the definition. See argument schema for details.
argumentValidations- (Block List, Optional) A list validations for the arguments in the macro. See argumentValidation schema for details.
- Definition string
- The definition of your macro
- Description string
- Description of the macro.
- Enabled bool
- Whether the macro will be enabled. Default true.
- Macro
Id string - Name string
- Name of the macro.
- Argument
Validations []MacroArgument Validation Args - Arguments
[]Macro
Argument Args - A list of arguments for the macro. They must match the arguments in the definition. See argument schema for details.
argumentValidations- (Block List, Optional) A list validations for the arguments in the macro. See argumentValidation schema for details.
- Definition string
- The definition of your macro
- Description string
- Description of the macro.
- Enabled bool
- Whether the macro will be enabled. Default true.
- Macro
Id string - Name string
- Name of the macro.
- argument
Validations List<MacroArgument Validation> - arguments
List<Macro
Argument> - A list of arguments for the macro. They must match the arguments in the definition. See argument schema for details.
argumentValidations- (Block List, Optional) A list validations for the arguments in the macro. See argumentValidation schema for details.
- definition String
- The definition of your macro
- description String
- Description of the macro.
- enabled Boolean
- Whether the macro will be enabled. Default true.
- macro
Id String - name String
- Name of the macro.
- argument
Validations MacroArgument Validation[] - arguments
Macro
Argument[] - A list of arguments for the macro. They must match the arguments in the definition. See argument schema for details.
argumentValidations- (Block List, Optional) A list validations for the arguments in the macro. See argumentValidation schema for details.
- definition string
- The definition of your macro
- description string
- Description of the macro.
- enabled boolean
- Whether the macro will be enabled. Default true.
- macro
Id string - name string
- Name of the macro.
- argument_
validations Sequence[MacroArgument Validation Args] - arguments
Sequence[Macro
Argument Args] - A list of arguments for the macro. They must match the arguments in the definition. See argument schema for details.
argumentValidations- (Block List, Optional) A list validations for the arguments in the macro. See argumentValidation schema for details.
- definition str
- The definition of your macro
- description str
- Description of the macro.
- enabled bool
- Whether the macro will be enabled. Default true.
- macro_
id str - name str
- Name of the macro.
- argument
Validations List<Property Map> - arguments List<Property Map>
- A list of arguments for the macro. They must match the arguments in the definition. See argument schema for details.
argumentValidations- (Block List, Optional) A list validations for the arguments in the macro. See argumentValidation schema for details.
- definition String
- The definition of your macro
- description String
- Description of the macro.
- enabled Boolean
- Whether the macro will be enabled. Default true.
- macro
Id String - name String
- Name of the macro.
Supporting Types
MacroArgument, MacroArgumentArgs
MacroArgumentValidation, MacroArgumentValidationArgs
- Eval
Expression string - Error
Message string
- Eval
Expression string - Error
Message string
- eval
Expression String - error
Message String
- eval
Expression string - error
Message string
- eval_
expression str - error_
message str
- eval
Expression String - error
Message String
Package Details
- Repository
- Sumo Logic sumologic/terraform-provider-sumologic
- License
- Notes
- This Pulumi package is based on the
sumologicTerraform Provider.
