jupiterone

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_RULE_NAME_LENGTH = 255
View Source
const MIN_JSON_LENGTH = 2
View Source
const MIN_RULE_NAME_LENGTH = 1

Variables

Functions

func New added in v1.0.0

func New(version string) func() provider.Provider

func NewFrameworkItemResource added in v1.0.0

func NewFrameworkItemResource() resource.Resource

func NewFrameworkResource added in v1.0.0

func NewFrameworkResource() resource.Resource

func NewGroupResource added in v1.0.0

func NewGroupResource() resource.Resource

func NewLibraryItemResource added in v1.0.0

func NewLibraryItemResource() resource.Resource

func NewQuestionResource added in v1.0.0

func NewQuestionResource() resource.Resource

func NewQuestionRuleResource added in v1.0.0

func NewQuestionRuleResource() resource.Resource

Types

type ComplianceFrameworkItemModel added in v1.0.0

type ComplianceFrameworkItemModel struct {
	Id              types.String `tfsdk:"id"`
	FrameworkId     types.String `tfsdk:"framework_id"`
	GroupId         types.String `tfsdk:"group_id"`
	Name            types.String `tfsdk:"name"`
	Description     types.String `tfsdk:"description"`
	DisplayCategory types.String `tfsdk:"display_category"`
	WebLink         types.String `tfsdk:"web_link"`
	Ref             types.String `tfsdk:"ref"`
}

type ComplianceFrameworkItemResource added in v1.0.0

type ComplianceFrameworkItemResource struct {
	// contains filtered or unexported fields
}

func (*ComplianceFrameworkItemResource) Configure added in v1.0.0

Configure implements resource.ResourceWithConfigure

func (*ComplianceFrameworkItemResource) Create added in v1.0.0

Create implements resource.Resource

func (*ComplianceFrameworkItemResource) Delete added in v1.0.0

Delete implements resource.Resource

func (*ComplianceFrameworkItemResource) ImportState added in v1.0.0

ImportState implements resource.ResourceWithImportState

func (*ComplianceFrameworkItemResource) Metadata added in v1.0.0

Metadata implements resource.Resource

func (*ComplianceFrameworkItemResource) Read added in v1.0.0

Read implements resource.Resource

func (*ComplianceFrameworkItemResource) Schema added in v1.0.0

Schema implements resource.Resource

func (*ComplianceFrameworkItemResource) Update added in v1.0.0

Update implements resource.Resource

type ComplianceFrameworkModel added in v1.0.0

type ComplianceFrameworkModel struct {
	Id            types.String `tfsdk:"id"`
	Name          types.String `tfsdk:"name"`
	Version       types.String `tfsdk:"version"`
	FrameworkType types.String `tfsdk:"framework_type"`
	WebLink       types.String `tfsdk:"web_link"`
	ScopeFilters  []string     `tfsdk:"scope_filters"`
}

func (*ComplianceFrameworkModel) BuildScopeFilters added in v1.0.0

func (c *ComplianceFrameworkModel) BuildScopeFilters() ([]map[string]interface{}, diag.Diagnostics)

BuildScopeFilters builds the data model that is accepted by the J1 API for its `JSON` types

type ComplianceFrameworkResource added in v1.0.0

type ComplianceFrameworkResource struct {
	// contains filtered or unexported fields
}

func (*ComplianceFrameworkResource) Configure added in v1.0.0

Configure implements resource.ResourceWithConfigure

func (*ComplianceFrameworkResource) Create added in v1.0.0

Create implements resource.Resource

func (*ComplianceFrameworkResource) Delete added in v1.0.0

Delete implements resource.Resource

func (*ComplianceFrameworkResource) ImportState added in v1.0.0

ImportState implements resource.ResourceWithImportState

func (*ComplianceFrameworkResource) Metadata added in v1.0.0

Metadata implements resource.Resource

func (*ComplianceFrameworkResource) Read added in v1.0.0

Read implements resource.Resource

func (*ComplianceFrameworkResource) Schema added in v1.0.0

Schema implements resource.Resource

func (*ComplianceFrameworkResource) Update added in v1.0.0

Update implements resource.Resource

type ComplianceGroupModel added in v1.0.0

type ComplianceGroupModel struct {
	Id              types.String `tfsdk:"id"`
	FrameworkId     types.String `tfsdk:"framework_id"`
	Name            types.String `tfsdk:"name"`
	Description     types.String `tfsdk:"description"`
	DisplayCategory types.String `tfsdk:"display_category"`
	WebLink         types.String `tfsdk:"web_link"`
}

type ComplianceGroupResource added in v1.0.0

type ComplianceGroupResource struct {
	// contains filtered or unexported fields
}

func (*ComplianceGroupResource) Configure added in v1.0.0

Configure implements resource.ResourceWithConfigure

func (*ComplianceGroupResource) Create added in v1.0.0

Create implements resource.Resource

func (*ComplianceGroupResource) Delete added in v1.0.0

Delete implements resource.Resource

func (*ComplianceGroupResource) ImportState added in v1.0.0

ImportState implements resource.ResourceWithImportState

func (*ComplianceGroupResource) Metadata added in v1.0.0

Metadata implements resource.Resource

func (*ComplianceGroupResource) Read added in v1.0.0

Read implements resource.Resource

func (*ComplianceGroupResource) Schema added in v1.0.0

Schema implements resource.Resource

func (*ComplianceGroupResource) Update added in v1.0.0

Update implements resource.Resource

type ComplianceLibraryItemModel added in v1.0.0

type ComplianceLibraryItemModel struct {
	Id              types.String `tfsdk:"id"`
	PolicyItemId    types.String `tfsdk:"policy_item_id"`
	Name            types.String `tfsdk:"name"`
	Description     types.String `tfsdk:"description"`
	DisplayCategory types.String `tfsdk:"display_category"`
	WebLink         types.String `tfsdk:"web_link"`
	Ref             types.String `tfsdk:"ref"`
}

type ComplianceLibraryItemResource added in v1.0.0

type ComplianceLibraryItemResource struct {
	// contains filtered or unexported fields
}

func (*ComplianceLibraryItemResource) Configure added in v1.0.0

Configure implements resource.ResourceWithConfigure

func (*ComplianceLibraryItemResource) Create added in v1.0.0

Create implements resource.Resource

func (*ComplianceLibraryItemResource) Delete added in v1.0.0

Delete implements resource.Resource

func (*ComplianceLibraryItemResource) ImportState added in v1.0.0

ImportState implements resource.ResourceWithImportState

func (*ComplianceLibraryItemResource) Metadata added in v1.0.0

Metadata implements resource.Resource

func (*ComplianceLibraryItemResource) Read added in v1.0.0

Read implements resource.Resource

func (*ComplianceLibraryItemResource) Schema added in v1.0.0

Schema implements resource.Resource

func (*ComplianceLibraryItemResource) Update added in v1.0.0

Update implements resource.Resource

type IdVersioner added in v1.0.0

type IdVersioner interface {
	Versioner
	GetId() string
}

type J1QueryInputModel added in v1.0.0

type J1QueryInputModel struct {
	// Query tests must be cleaned of carriage returns before being sent to
	// the server.
	Query           string `json:"query" tfsdk:"query"`
	Version         string `json:"version" tfsdk:"version"`
	Name            string `json:"name" tfsdk:"name"`
	IncludedDeleted bool   `json:"include_deleted" tfsdk:"include_deleted"`
}

type JupiterOneProvider added in v1.0.0

type JupiterOneProvider struct {
	Qlient graphql.Client
	// contains filtered or unexported fields
}

JupiterOneProvider contains the initialized API client to communicate with the JupiterOne API

func (*JupiterOneProvider) Configure added in v1.0.0

Configure implements provider.Provider

func (*JupiterOneProvider) DataSources added in v1.0.0

func (*JupiterOneProvider) DataSources(context.Context) []func() datasource.DataSource

DataSources implements provider.Provider

func (*JupiterOneProvider) Metadata added in v1.0.0

Metadata implements provider.Provider

func (*JupiterOneProvider) Resources added in v1.0.0

func (*JupiterOneProvider) Resources(context.Context) []func() resource.Resource

Resources implements provider.Provider

func (*JupiterOneProvider) Schema added in v1.0.0

Schema implements provider.Provider

type JupiterOneProviderModel added in v1.0.0

type JupiterOneProviderModel struct {
	APIKey    basetypes.StringValue `tfsdk:"api_key"`
	AccountID basetypes.StringValue `tfsdk:"account_id"`
	Region    basetypes.StringValue `tfsdk:"region"`
}

type QuestionComplianceModel added in v1.0.0

type QuestionComplianceModel struct {
	Standard     string   `json:"standard" tfsdk:"standard"`
	Requirements []string `json:"requirements,omitempty" tfsdk:"requirements"`
	Controls     []string `json:"controls,omitempty" tfsdk:"controls"`
}

type QuestionModel added in v1.0.0

type QuestionModel struct {
	Id              types.String               `json:"id,omitempty" tfsdk:"id"`
	Title           types.String               `json:"title,omitempty" tfsdk:"title"`
	Description     types.String               `json:"description,omitempty" tfsdk:"description"`
	ShowTrend       types.Bool                 `json:"show_trend,omitempty" tfsdk:"show_trend"`
	PollingInterval types.String               `json:"polling_interval,omitempty" tfsdk:"polling_interval"`
	Tags            []string                   `json:"tags,omitempty" tfsdk:"tags"`
	Query           []*QuestionQueryModel      `json:"query,omitempty" tfsdk:"query"`
	Compliance      []*QuestionComplianceModel `json:"compliance,omitempty" tfsdk:"compliance"`
}

QuestionModel is the terraform HCL representation of a question. This currently has to be different from the `client.Question`:

  1. allow the use of the `types.String` for ID being computed and the optional values
  2. make it clearer where the line breaks are being stripped from the input and state

TODO: Unify the client types and the state model if possible

func (*QuestionModel) BuildCreateQuestionInput added in v1.0.0

func (qm *QuestionModel) BuildCreateQuestionInput() client.CreateQuestionInput

func (*QuestionModel) BuildQuestion added in v1.0.0

func (qm *QuestionModel) BuildQuestion() client.QuestionUpdate

type QuestionQueryModel added in v1.0.0

type QuestionQueryModel struct {
	// Query tests must be cleaned of carriage returns before being sent to
	// the server.
	Query           string `json:"query" tfsdk:"query"`
	Version         string `json:"version" tfsdk:"version"`
	Name            string `json:"name" tfsdk:"name"`
	IncludedDeleted bool   `json:"include_deleted" tfsdk:"include_deleted"`
	ResultsAre      string `json:"results_are" tfsdk:"results_are"`
}

QuestionQueryModel represents the terraform HCL `query` elements.

type QuestionResource added in v1.0.0

type QuestionResource struct {
	// contains filtered or unexported fields
}

func (*QuestionResource) Configure added in v1.0.0

Configure implements resource.ResourceWithConfigure

func (*QuestionResource) Create added in v1.0.0

Create implements resource.Resource

func (*QuestionResource) Delete added in v1.0.0

Delete implements resource.Resource

func (*QuestionResource) ImportState added in v1.0.0

ImportState implements resource.ResourceWithImportState

func (*QuestionResource) Metadata added in v1.0.0

Metadata implements resource.Resource

func (*QuestionResource) Read added in v1.0.0

Read implements resource.Resource

func (*QuestionResource) Schema added in v1.0.0

Schema implements resource.Resource

func (*QuestionResource) Update added in v1.0.0

Update implements resource.Resource

type QuestionRuleResource added in v1.0.0

type QuestionRuleResource struct {
	// contains filtered or unexported fields
}

func (*QuestionRuleResource) ConfigValidators added in v1.0.0

ConfigValidators implements resource.ResourceWithConfigValidators

func (*QuestionRuleResource) Configure added in v1.0.0

Configure implements resource.ResourceWithConfigure

func (*QuestionRuleResource) Create added in v1.0.0

Create implements resource.ResourceWithConfigure

func (*QuestionRuleResource) Delete added in v1.0.0

Delete implements resource.ResourceWithConfigure

func (*QuestionRuleResource) ImportState added in v1.0.0

ImportState implements resource.ResourceWithImportState

func (*QuestionRuleResource) Metadata added in v1.0.0

Metadata implements resource.Resource

func (*QuestionRuleResource) ModifyPlan added in v1.0.0

ModifyPlan is a workaround for unexpected behavior in the framework around the `computed: true` `version` field to make sure that it is only part of the plan if there is some other change in the resource.

Based on the implementation of the Time resource: https://github.com/hashicorp/terraform-provider-time/blob/main/internal/provider/resource_time_rotating.go#L189-L234

This may be a bug in the framework, if so, this can be removed when fixed: https://github.com/hashicorp/terraform-plugin-framework/issues/628

func (*QuestionRuleResource) Read added in v1.0.0

Read implements resource.ResourceWithConfigure

func (*QuestionRuleResource) Schema added in v1.0.0

Schema implements resource.ResourceWithConfigure

func (*QuestionRuleResource) Update added in v1.0.0

Update implements resource.ResourceWithConfigure

type RuleModel added in v1.0.0

type RuleModel struct {
	Id              types.String      `json:"id,omitempty" tfsdk:"id"`
	Name            types.String      `json:"name" tfsdk:"name"`
	Description     types.String      `json:"description" tfsdk:"description"`
	Version         types.Int64       `json:"version,omitempty" tfsdk:"version"`
	SpecVersion     types.Int64       `json:"specVersion,omitempty" tfsdk:"spec_version"`
	PollingInterval types.String      `json:"polling_interval,omitempty" tfsdk:"polling_interval"`
	Templates       map[string]string `json:"templates" tfsdk:"templates"`
	Question        []*RuleQuestion   `json:"question,omitempty" tfsdk:"question"`
	QuestionId      types.String      `json:"questionId,omitempty" tfsdk:"question_id"`
	// Operations TODO: breaking change for new version to do more in the
	// HCL and/or make better use of things like jsonencode
	Operations       []RuleOperation `json:"operations" tfsdk:"operations"`
	Outputs          []string        `json:"outputs" tfsdk:"outputs"`
	Tags             []string        `json:"tags" tfsdk:"tags"`
	NotifyOnFailure  types.Bool      `json:"notify_on_failure" tfsdk:"notify_on_failure"`
	TriggerOnNewOnly types.Bool      `json:"trigger_on_new_only" tfsdk:"trigger_on_new_only"`
}

RuleModel represents the terraform representation of the rule

func (*RuleModel) BuildCreateInlineQuestionRuleInstanceInput added in v1.0.0

func (r *RuleModel) BuildCreateInlineQuestionRuleInstanceInput() (client.CreateInlineQuestionRuleInstanceInput, error)

func (*RuleModel) BuildCreateReferencedQuestionRuleInstanceInput added in v1.0.0

func (r *RuleModel) BuildCreateReferencedQuestionRuleInstanceInput() (client.CreateReferencedQuestionRuleInstanceInput, error)

func (*RuleModel) BuildUpdateInlineQuestionRuleInstanceInput added in v1.0.0

func (r *RuleModel) BuildUpdateInlineQuestionRuleInstanceInput() (client.UpdateInlineQuestionRuleInstanceInput, error)

func (*RuleModel) BuildUpdateReferencedQuestionRuleInstanceInput added in v1.0.0

func (r *RuleModel) BuildUpdateReferencedQuestionRuleInstanceInput() (client.UpdateReferencedQuestionRuleInstanceInput, error)

type RuleOperation added in v1.0.0

type RuleOperation struct {
	When    types.String `json:"when" tfsdk:"when"`
	Actions []string     `json:"actions" tfsdk:"actions"`
}

type RuleQuestion added in v1.0.0

type RuleQuestion struct {
	Queries []*J1QueryInputModel `json:"queries" tfsdk:"queries"`
}

type Versioner added in v1.0.0

type Versioner interface {
	GetVersion() int
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL