policyassignments

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(c *golangsdk.ServiceClient, domainId, assignmentId string) error

Delete is a method to remove the specified policy assignment using its ID.

func Disable

func Disable(c *golangsdk.ServiceClient, domainId, assignmentId string) error

Disable is a method to disable the resource function of the policy assignment.

func Enable

func Enable(c *golangsdk.ServiceClient, domainId, assignmentId string) error

Enable is a method to enable the resource function of the policy assignment.

Types

type Assignment

type Assignment struct {
	// The type of the policy assignment.
	Type string `json:"policy_assignment_type"`
	// The ID of the policy assignment.
	ID string `json:"id"`
	// The name of the policy assignment.
	Name string `json:"name"`
	// The description of the policy assignment.
	Description string `json:"description"`
	// The configuration used to filter resources.
	PolicyFilter PolicyFilter `json:"policy_filter"`
	// The period of the policy rule check.
	Period string `json:"period"`
	// The status of the policy assignment.
	Status string `json:"state"`
	// The ID of the policy definition.
	PolicyDefinitionId string `json:"policy_definition_id"`
	// The configuration of the custom policy.
	CustomPolicy CustomPolicy `json:"custom_policy"`
	// The rule definition of the policy assignment.
	Parameters map[string]PolicyParameterValue `json:"parameters"`
	// The creation time of the policy assignment.
	CreatedAt string `json:"created"`
	// The latest update time of the policy assignment.
	UpdatedAt string `json:"updated"`
}

Assignment is the structure that represents the detail of the policy assignment.

func Create

func Create(c *golangsdk.ServiceClient, domainId string, opts CreateOpts) (*Assignment, error)

Create is a method to assign a policy using given parameters.

func Get

func Get(c *golangsdk.ServiceClient, domainId, assignmentId string) (*Assignment, error)

Get is a method to obtain the assignment detail by its ID.

func Update

func Update(c *golangsdk.ServiceClient, domainId, assignmentId string, opts UpdateOpts) (*Assignment, error)

Update is a method to update the assignment configuration.

type CreateOpts

type CreateOpts struct {
	// The name of the policy assignment.
	Name string `json:"name" required:"true"`
	// The description of the policy assignment.
	Description string `json:"description,omitempty"`
	// The type of the policy assignment.
	// The valid values are as follow:
	// + builtin
	// + custom
	Type string `json:"policy_assignment_type,omitempty"`
	// The period of the policy rule check.
	Period string `json:"period,omitempty"`
	// The configuration used to filter resources.
	PolicyFilter PolicyFilter `json:"policy_filter,omitempty"`
	// The ID of the policy definition.
	PolicyDefinitionId string `json:"policy_definition_id,omitempty"`
	// The configuration of the custom policy.
	CustomPolicy *CustomPolicy `json:"custom_policy,omitempty"`
	// The rule definition of the policy assignment.
	Parameters map[string]PolicyParameterValue `json:"parameters,omitempty"`
}

CreateOpts is the structure required by the 'Create' method to assign a specified policy.

type CustomPolicy

type CustomPolicy struct {
	// The function URN used to create the custom policy.
	FunctionUrn string `json:"function_urn" required:"true"`
	// The authorization type of the custom policy.
	AuthType string `json:"auth_type" required:"true"`
	// The authorization value of the custom policy.
	AuthValue map[string]interface{} `json:"auth_value,omitempty"`
}

CustomPolicy is an object specifying the configuration of the custom policy.

type DefinitionPage

type DefinitionPage struct {
	pagination.MarkerPageBase
}

DefinitionPage represents the response pages of the List method.

func (DefinitionPage) IsEmpty

func (r DefinitionPage) IsEmpty() (bool, error)

IsEmpty returns true if a query result no policy definition.

func (DefinitionPage) LastMarker

func (r DefinitionPage) LastMarker() (string, error)

LastMarker returns the last marker index in a query result.

type PolicyDefinition

type PolicyDefinition struct {
	// The ID of the policy definition.
	ID string `json:"id"`
	// The name of the policy definition.
	Name string `json:"name"`
	// The policy type of the policy definition.
	PolicyType string `json:"policy_type"`
	// The description of the policy definition.
	Description string `json:"description"`
	// The rule type of the policy definition.
	PolicyRuleType string `json:"policy_rule_type"`
	// The rule details of the policy definition.
	PolicyRule interface{} `json:"policy_rule"`
	// The trigger type of the policy definition.
	TriggerType string `json:"trigger_type"`
	// The keywords that policy definition has.
	Keywords []string `json:"keywords"`
	// The parameters of the policy definition.
	Parameters map[string]PolicyParameterDefinition `json:"parameters"`
}

PolicyDefinition is the structure that represents the details of the built-in policy definition.

func ListDefinitions

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

ListDefinitions is a method to query the list of the built-in policy definitions using given parameters.

type PolicyFilter

type PolicyFilter struct {
	// The name of the region to which the filtered resources belong.
	RegionId string `json:"region_id,omitempty"`
	// The service name to which the filtered resources belong.
	ResourceProvider string `json:"resource_provider,omitempty"`
	// The resource type of the filtered resources.
	ResourceType string `json:"resource_type,omitempty"`
	// The ID used to filter resources.
	ResourceId string `json:"resource_id,omitempty"`
	// The tag name used to filter resources.
	TagKey string `json:"tag_key,omitempty"`
	// The tag value used to filter resources.
	TagValue string `json:"tag_value,omitempty"`
}

PolicyFilter is an object specifying the filter parameters.

type PolicyParameterDefinition

type PolicyParameterDefinition struct {
	// The name of the parameter definition.
	Name string `json:"name"`
	// The description of the parameter definition.
	Description string `json:"description"`
	// The allow value list of the parameter definition.
	AllowedValues []interface{} `json:"allowed_values"`
	// The default value of the parameter definition.m
	DefaultValue string `json:"default_value"`
	// The type of the parameter definition.
	Type string `json:"type"`
}

PolicyParameterDefinition is the structure that represents the parameter configuration.

type PolicyParameterValue

type PolicyParameterValue struct {
	// The value of the rule definition.
	Value interface{} `json:"value,omitempty"`
}

PolicyParameterValue is an object specifying the definition of the policy parameter value.

type UpdateOpts

type UpdateOpts struct {
	// The name of the policy assignment.
	Name string `json:"name" required:"true"`
	// The description of the policy assignment.
	Description *string `json:"description,omitempty"`
	// The type of the policy assignment.
	// The valid values are as follow:
	// + builtin
	// + custom
	Type string `json:"policy_assignment_type,omitempty"`
	// The period of the policy rule check.
	Period string `json:"period,omitempty"`
	// The configuration used to filter resources.
	PolicyFilter PolicyFilter `json:"policy_filter,omitempty"`
	// The ID of the policy definition.
	PolicyDefinitionId string `json:"policy_definition_id,omitempty"`
	// The configuration of the custom policy.
	CustomPolicy *CustomPolicy `json:"custom_policy,omitempty"`
	// The rule definition of the policy assignment.
	Parameters map[string]PolicyParameterValue `json:"parameters,omitempty"`
}

UpdateOpts is the structure required by the Update method to update the assignment configuration.

Jump to

Keyboard shortcuts

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