compliance

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(client *golangsdk.ServiceClient, domainId, id string) (err error)

func DisableRule

func DisableRule(client *golangsdk.ServiceClient, domainId, id string) (err error)

func EnableRule

func EnableRule(client *golangsdk.ServiceClient, domainId, id string) (err error)

func RunEval

func RunEval(client *golangsdk.ServiceClient, domainId, id string) (err error)

Types

type AddRuleOpts

type AddRuleOpts struct {
	DomainId             string                     `json:"-"`
	PolicyAssignmentType string                     `json:"policy_assignment_type,omitempty"`
	Name                 string                     `json:"name" required:"true"`
	Description          string                     `json:"description,omitempty"`
	Period               string                     `json:"period,omitempty"`
	PolicyFilter         PolicyFilterDefinition     `json:"policy_filter,omitempty"`
	PolicyDefinitionID   string                     `json:"policy_definition_id,omitempty"`
	CustomPolicy         *CustomPolicy              `json:"custom_policy,omitempty"`
	Parameters           map[string]PolicyParameter `json:"parameters,omitempty"`
	Tags                 []tags.ResourceTag         `json:"tags,omitempty"`
}

type CustomPolicy

type CustomPolicy struct {
	FunctionUrn string                 `json:"function_urn" required:"true"`
	AuthType    string                 `json:"auth_type" required:"true"`
	AuthValue   map[string]interface{} `json:"auth_value,omitempty"`
}

type DefaultResourceType

type DefaultResourceType struct {
	Provider string `json:"provider"`
	Type     string `json:"type"`
}

type ListAllComplianceOpts

type ListAllComplianceOpts struct {
	DomainId string `json:"-"`
	PolicyId string `json:"-"`
	// compliance_state
	ComplianceState string `q:"compliance_state"`
	ResourceId      string `q:"resource_id"`
	ResourceName    string `q:"resource_name"`
	// Specifies the maximum number of resources to return.
	Limit *int `q:"limit"`
	// Specifies the pagination parameter.
	Marker string `q:"marker"`
}

type ListAllUserComplianceOpts

type ListAllUserComplianceOpts struct {
	DomainId string `json:"-"`
	// compliance_state
	ComplianceState string `q:"compliance_state"`
	ResourceId      string `q:"resource_id"`
	ResourceName    string `q:"resource_name"`
	// Specifies the maximum number of resources to return.
	Limit *int `q:"limit"`
	// Specifies the pagination parameter.
	Marker string `q:"marker"`
}

type ListResComplianceOpts

type ListResComplianceOpts struct {
	DomainId   string `json:"-"`
	ResourceId string `json:"-"`
	// compliance_state
	ComplianceState string `q:"compliance_state"`
	// Specifies the maximum number of resources to return.
	Limit *int `q:"limit"`
	// Specifies the pagination parameter.
	Marker string `q:"marker"`
}

type ListRulesOpts

type ListRulesOpts struct {
	DomainId string `json:"-"`
	// Specifies whether resources are collected by default. tracked indicates that resources are collected by default,
	// and untracked indicates that resources are not collected by default.
	Track string `q:"policy_assignment_name"`
	// Specifies the number of records returned on each page during pagination query.
	Limit *int `q:"limit"`
	// Specifies the pagination parameter.
	Marker string `q:"string"`
}

type PolicyDefinition

type PolicyDefinition struct {
	ID                   string                               `json:"id"`
	Name                 string                               `json:"name"`
	DisplayName          string                               `json:"display_name"`
	PolicyType           string                               `json:"policy_type"`
	Description          string                               `json:"description"`
	PolicyRuleType       string                               `json:"policy_rule_type"`
	PolicyRule           interface{}                          `json:"policy_rule"`
	TriggerType          string                               `json:"trigger_type"`
	Keywords             []string                             `json:"keywords"`
	DefaultResourceTypes []DefaultResourceType                `json:"default_resource_types"`
	Parameters           map[string]PolicyParameterDefinition `json:"parameters"`
}

func ExtractResources

func ExtractResources(r pagination.NewPage) ([]PolicyDefinition, error)

func GetPolicy

func GetPolicy(client *golangsdk.ServiceClient, id string) (*PolicyDefinition, error)

func ListAllPolicies

func ListAllPolicies(client *golangsdk.ServiceClient) ([]PolicyDefinition, error)

type PolicyFilterDefinition

type PolicyFilterDefinition struct {
	RegionID         string `json:"region_id,omitempty"`
	ResourceProvider string `json:"resource_provider,omitempty"`
	ResourceType     string `json:"resource_type,omitempty"`
	ResourceID       string `json:"resource_id,omitempty"`
	TagKey           string `json:"tag_key,omitempty"`
	TagValue         string `json:"tag_value,omitempty"`
}

type PolicyParameter

type PolicyParameter struct {
	Value interface{} `json:"value,omitempty"`
}

type PolicyParameterDefinition

type PolicyParameterDefinition struct {
	Name          string        `json:"name"`
	Description   string        `json:"description"`
	AllowedValues []interface{} `json:"allowed_values"`
	DefaultValue  string        `json:"default_value"`
	Minimum       float64       `json:"minimum"`
	Maximum       float64       `json:"maximum"`
	MinItems      int           `json:"min_items"`
	MaxItems      int           `json:"max_items"`
	MinLength     int           `json:"min_length"`
	MaxLength     int           `json:"max_length"`
	Pattern       string        `json:"pattern"`
	Type          string        `json:"type"`
}

type PolicyResource

type PolicyResource struct {
	ResourceID       string `json:"resource_id,omitempty"`
	ResourceName     string `json:"resource_name,omitempty"`
	ResourceProvider string `json:"resource_provider,omitempty"`
	ResourceType     string `json:"resource_type,omitempty"`
	RegionID         string `json:"region_id,omitempty"`
	DomainID         string `json:"domain_id,omitempty"`
}

type PolicyRule

type PolicyRule struct {
	PolicyAssignmentType string                     `json:"policy_assignment_type"`
	ID                   string                     `json:"id"`
	Name                 string                     `json:"name"`
	Description          string                     `json:"description"`
	PolicyFilter         *PolicyFilterDefinition    `json:"policy_filter,omitempty"`
	Period               string                     `json:"period"`
	State                string                     `json:"state"`
	Created              string                     `json:"created"`
	Updated              string                     `json:"updated"`
	PolicyDefinitionID   string                     `json:"policy_definition_id"`
	CustomPolicy         *CustomPolicy              `json:"custom_policy,omitempty"`
	Parameters           map[string]PolicyParameter `json:"parameters"`
	Tags                 []ResourceTag              `json:"tags"`
	CreatedBy            string                     `json:"created_by"`
	TargetType           string                     `json:"target_type"`
	TargetID             string                     `json:"target_id"`
}

func AddRule

func AddRule(client *golangsdk.ServiceClient, opts AddRuleOpts) (*PolicyRule, error)

func ExtractRules

func ExtractRules(r pagination.NewPage) ([]PolicyRule, error)

func GetRule

func GetRule(client *golangsdk.ServiceClient, domainId, id string) (*PolicyRule, error)

func ListRules

func ListRules(client *golangsdk.ServiceClient, opts ListRulesOpts) ([]PolicyRule, error)

func UpdateRule

func UpdateRule(client *golangsdk.ServiceClient, opts UpdateRuleOpts) (*PolicyRule, error)

type PolicyState

type PolicyState struct {
	DomainID             string `json:"domain_id"`
	RegionID             string `json:"region_id"`
	ResourceID           string `json:"resource_id"`
	ResourceName         string `json:"resource_name"`
	ResourceProvider     string `json:"resource_provider"`
	ResourceType         string `json:"resource_type"`
	TriggerType          string `json:"trigger_type"`
	ComplianceState      string `json:"compliance_state"`
	PolicyAssignmentID   string `json:"policy_assignment_id"`
	PolicyAssignmentName string `json:"policy_assignment_name"`
	PolicyDefinitionID   string `json:"policy_definition_id"`
	EvaluationTime       string `json:"evaluation_time"`
}

func ExtractComplianceState

func ExtractComplianceState(r pagination.NewPage) ([]PolicyState, error)

func ListAllRuleCompliance

func ListAllRuleCompliance(client *golangsdk.ServiceClient, opts ListAllComplianceOpts) ([]PolicyState, error)

func ListAllUserCompliance

func ListAllUserCompliance(client *golangsdk.ServiceClient, opts ListAllUserComplianceOpts) ([]PolicyState, error)

func ListResCompliance

func ListResCompliance(client *golangsdk.ServiceClient, opts ListResComplianceOpts) ([]PolicyState, error)

func UpdateCompliance

func UpdateCompliance(client *golangsdk.ServiceClient, opts UpdateComplianceOpts) (*PolicyState, error)

type PolicyStatus

type PolicyStatus struct {
	PolicyAssignmentId string `json:"policy_assignment_id"`
	State              string `json:"state"`
	StartTime          string `json:"start_time"`
	EnTime             string `json:"end_time"`
	ErrorMessage       string `json:"error_message"`
}

func GetRuleStatus

func GetRuleStatus(client *golangsdk.ServiceClient, domainId, id string) (*PolicyStatus, error)

type ResPage

type ResPage struct {
	pagination.NewSinglePageBase
}

type ResourceTag

type ResourceTag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type UpdateComplianceOpts

type UpdateComplianceOpts struct {
	DomainId             string         `json:"-"`
	PolicyResource       PolicyResource `json:"policy_resource" required:"true"`
	TriggerType          string         `json:"trigger_type" required:"true"`
	ComplianceState      string         `json:"compliance_state" required:"true"`
	PolicyAssignmentID   string         `json:"policy_assignment_id" required:"true"`
	PolicyAssignmentName string         `json:"policy_assignment_name,omitempty"`
	EvaluationTime       int64          `json:"evaluation_time"`
	EvaluationHash       string         `json:"evaluation_hash"`
}

type UpdateRuleOpts

type UpdateRuleOpts struct {
	DomainId             string                     `json:"-"`
	PolicyAssignmentId   string                     `json:"-"`
	PolicyAssignmentType string                     `json:"policy_assignment_type" required:"true"`
	Name                 string                     `json:"name" required:"true"`
	Description          string                     `json:"description,omitempty"`
	Period               string                     `json:"period,omitempty"`
	PolicyFilter         PolicyFilterDefinition     `json:"policy_filter,omitempty"`
	PolicyDefinitionID   string                     `json:"policy_definition_id,omitempty"`
	CustomPolicy         *CustomPolicy              `json:"custom_policy,omitempty"`
	Parameters           map[string]PolicyParameter `json:"parameters,omitempty"`
	Tags                 []tags.ResourceTag         `json:"tags,omitempty"`
}

Jump to

Keyboard shortcuts

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