views

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: MIT Imports: 1 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PolicyTemplateMap is a map of attribute names in result type PolicyTemplate
	// indexed by view name.
	PolicyTemplateMap = map[string][]string{
		"default": []string{
			"id",
			"name",
			"project_id",
			"rs_pt_ver",
			"short_description",
			"doc_link",
			"info",
			"default_frequency",
			"href",
			"fingerprint",
			"category",
			"created_by",
			"created_at",
			"updated_by",
			"updated_at",
			"required_roles",
			"severity",
			"tenancy",
			"kind",
		},
		"extended": []string{
			"id",
			"name",
			"project_id",
			"rs_pt_ver",
			"short_description",
			"long_description",
			"doc_link",
			"info",
			"default_frequency",
			"href",
			"fingerprint",
			"category",
			"created_by",
			"created_at",
			"updated_by",
			"updated_at",
			"permissions",
			"required_roles",
			"parameters",
			"severity",
			"tenancy",
			"credentials",
			"kind",
		},
		"source": []string{
			"id",
			"name",
			"href",
			"filename",
			"source",
			"fingerprint",
			"kind",
		},
		"link": []string{
			"id",
			"name",
			"href",
			"fingerprint",
			"updated_at",
			"updated_by",
			"kind",
		},
	}
	// PolicyTemplateListMap is a map of attribute names in result type
	// PolicyTemplateList indexed by view name.
	PolicyTemplateListMap = map[string][]string{
		"default": []string{
			"count",
			"items",
			"etag",
			"not_modified",
			"kind",
		},
		"extended": []string{
			"count",
			"items",
			"etag",
			"not_modified",
			"kind",
		},
	}
	// PolicyTemplateCollectionMap is a map of attribute names in result type
	// PolicyTemplateCollection indexed by view name.
	PolicyTemplateCollectionMap = map[string][]string{
		"default": []string{
			"id",
			"name",
			"project_id",
			"rs_pt_ver",
			"short_description",
			"doc_link",
			"info",
			"default_frequency",
			"href",
			"fingerprint",
			"category",
			"created_by",
			"created_at",
			"updated_by",
			"updated_at",
			"required_roles",
			"severity",
			"tenancy",
			"kind",
		},
		"extended": []string{
			"id",
			"name",
			"project_id",
			"rs_pt_ver",
			"short_description",
			"long_description",
			"doc_link",
			"info",
			"default_frequency",
			"href",
			"fingerprint",
			"category",
			"created_by",
			"created_at",
			"updated_by",
			"updated_at",
			"permissions",
			"required_roles",
			"parameters",
			"severity",
			"tenancy",
			"credentials",
			"kind",
		},
		"source": []string{
			"id",
			"name",
			"href",
			"filename",
			"source",
			"fingerprint",
			"kind",
		},
		"link": []string{
			"id",
			"name",
			"href",
			"fingerprint",
			"updated_at",
			"updated_by",
			"kind",
		},
	}
)

Functions

func ValidateCredentialsTagView added in v1.0.6

func ValidateCredentialsTagView(result *CredentialsTagView) (err error)

ValidateCredentialsTagView runs the validations defined on CredentialsTagView.

func ValidateCredentialsView added in v1.0.6

func ValidateCredentialsView(result *CredentialsView) (err error)

ValidateCredentialsView runs the validations defined on CredentialsView.

func ValidateParameterView added in v1.0.6

func ValidateParameterView(result *ParameterView) (err error)

ValidateParameterView runs the validations defined on ParameterView.

func ValidatePermissionView added in v1.0.6

func ValidatePermissionView(result *PermissionView) (err error)

ValidatePermissionView runs the validations defined on PermissionView.

func ValidatePolicyTemplate added in v1.0.6

func ValidatePolicyTemplate(result *PolicyTemplate) (err error)

ValidatePolicyTemplate runs the validations defined on the viewed result type PolicyTemplate.

func ValidatePolicyTemplateCollectionView added in v1.0.6

func ValidatePolicyTemplateCollectionView(result PolicyTemplateCollectionView) (err error)

ValidatePolicyTemplateCollectionView runs the validations defined on PolicyTemplateCollectionView using the "default" view.

func ValidatePolicyTemplateCollectionViewExtended added in v1.0.6

func ValidatePolicyTemplateCollectionViewExtended(result PolicyTemplateCollectionView) (err error)

ValidatePolicyTemplateCollectionViewExtended runs the validations defined on PolicyTemplateCollectionView using the "extended" view.

func ValidatePolicyTemplateCollectionViewLink(result PolicyTemplateCollectionView) (err error)

ValidatePolicyTemplateCollectionViewLink runs the validations defined on PolicyTemplateCollectionView using the "link" view.

func ValidatePolicyTemplateCollectionViewSource added in v1.0.6

func ValidatePolicyTemplateCollectionViewSource(result PolicyTemplateCollectionView) (err error)

ValidatePolicyTemplateCollectionViewSource runs the validations defined on PolicyTemplateCollectionView using the "source" view.

func ValidatePolicyTemplateList added in v1.0.6

func ValidatePolicyTemplateList(result *PolicyTemplateList) (err error)

ValidatePolicyTemplateList runs the validations defined on the viewed result type PolicyTemplateList.

func ValidatePolicyTemplateListView added in v1.0.6

func ValidatePolicyTemplateListView(result *PolicyTemplateListView) (err error)

ValidatePolicyTemplateListView runs the validations defined on PolicyTemplateListView using the "default" view.

func ValidatePolicyTemplateListViewExtended added in v1.0.6

func ValidatePolicyTemplateListViewExtended(result *PolicyTemplateListView) (err error)

ValidatePolicyTemplateListViewExtended runs the validations defined on PolicyTemplateListView using the "extended" view.

func ValidatePolicyTemplateView added in v1.0.6

func ValidatePolicyTemplateView(result *PolicyTemplateView) (err error)

ValidatePolicyTemplateView runs the validations defined on PolicyTemplateView using the "default" view.

func ValidatePolicyTemplateViewExtended added in v1.0.6

func ValidatePolicyTemplateViewExtended(result *PolicyTemplateView) (err error)

ValidatePolicyTemplateViewExtended runs the validations defined on PolicyTemplateView using the "extended" view.

func ValidatePolicyTemplateViewLink(result *PolicyTemplateView) (err error)

ValidatePolicyTemplateViewLink runs the validations defined on PolicyTemplateView using the "link" view.

func ValidatePolicyTemplateViewSource added in v1.0.6

func ValidatePolicyTemplateViewSource(result *PolicyTemplateView) (err error)

ValidatePolicyTemplateViewSource runs the validations defined on PolicyTemplateView using the "source" view.

func ValidateRegexpView added in v1.0.6

func ValidateRegexpView(result *RegexpView) (err error)

ValidateRegexpView runs the validations defined on RegexpView.

func ValidateUserView added in v1.0.6

func ValidateUserView(result *UserView) (err error)

ValidateUserView runs the validations defined on UserView.

Types

type CredentialsTagView added in v1.0.6

type CredentialsTagView struct {
	// Key is the tag key.
	Key *string `json:"key"`
	// Value is the tag value.
	Value *string `json:"value"`
}

CredentialsTagView is a type that runs validations on a projected type.

type CredentialsView added in v1.0.6

type CredentialsView struct {
	// Name in policy template source code
	Name *string `json:"name"`
	// Schemes of credentials service resource supported.
	Schemes []string `json:"schemes"`
	// Label for the auth reference
	Label *string `json:"label"`
	// Description of what types of permissions need to be provided by auth.
	Description *string `json:"description"`
	// Tags is an optional filter to only show credentials matching a certain tag.
	Tags []*CredentialsTagView `json:"tags"`
}

CredentialsView is a type that runs validations on a projected type.

type ParameterView

type ParameterView struct {
	// Name of the parameter
	Name *string `json:"name"`
	// Type of the parameter
	Type *string `json:"type"`
	// Label to show in the UI
	Label *string `json:"label"`
	// The index of this parameter in the list
	Index *uint `json:"index"`
	// The category used to group parameters
	Category *string `json:"category"`
	// Description of the parameter
	Description *string `json:"description"`
	// The default value for the parameter
	Default interface{} `json:"default"`
	// no_echo determines whether the value of the parameter should be hidden in
	// UIs and API responses.
	NoEcho *bool `json:"no_echo"`
	// List of values allowed for this parameter
	AllowedValues []interface{} `json:"allowed_values"`
	// The minimum length of a string parameter
	MinLength *uint `json:"min_length"`
	// The maximum length of a string parameter
	MaxLength *uint `json:"max_length"`
	// The minimum value of a number parmameter
	MinValue *float64 `json:"min_value"`
	// The maximum value of a number parameter
	MaxValue *float64 `json:"max_value"`
	// The regular expression pattern used to validate a string parameter
	AllowedPattern *RegexpView `json:"allowed_pattern"`
	// The description used for constraints
	ConstraintDescription *string `json:"constraint_description"`
}

ParameterView is a type that runs validations on a projected type.

type PermissionView

type PermissionView struct {
	// Name of a permission
	Name *string `json:"name"`
	// Label is used in the UI
	Label *string `json:"label"`
	// List of resource names the permission is applied to
	Resources []string `json:"resources"`
	// List of action names the permission is applied to
	Actions []string `json:"actions"`
}

PermissionView is a type that runs validations on a projected type.

type PolicyTemplate

type PolicyTemplate struct {
	// Type to project
	Projected *PolicyTemplateView
	// View to render
	View string
}

PolicyTemplate is the viewed result type that is projected based on a view.

type PolicyTemplateCollectionView

type PolicyTemplateCollectionView []*PolicyTemplateView

PolicyTemplateCollectionView is a type that runs validations on a projected type.

type PolicyTemplateList

type PolicyTemplateList struct {
	// Type to project
	Projected *PolicyTemplateListView
	// View to render
	View string
}

PolicyTemplateList is the viewed result type that is projected based on a view.

type PolicyTemplateListView

type PolicyTemplateListView struct {
	// count is the number of policy templates in the list.
	Count *uint
	// etag is an HTTP ETag for the policy template list.
	Etag *string
	// items is the array of policy templates.
	Items PolicyTemplateCollectionView
	// not_modified is a flag used internally that indicates how to encode the HTTP
	// response (i.e. 200 or 304).
	NotModified *string
	// kind is "gov#policy_template_list".
	Kind *string
}

PolicyTemplateListView is a type that runs validations on a projected type.

type PolicyTemplateView

type PolicyTemplateView struct {
	// id identifies a policy template by ID.
	ID *string
	// name is the unique name of the policy template in the project.
	Name *string
	// project_id is the ID of the project that the policy template applies to.
	ProjectID *uint
	// rs_pt_ver is the policy engine version.
	RsPtVer *uint
	// short_description is the short description of the policy template.
	ShortDescription *string
	// long_description is the long description of the policy template. The content
	// can be markdown.
	LongDescription *string
	// doc_link is an HTTP URI to a page containing detailed documentation for the
	// policy.
	DocLink *string
	// info is an arbitrary set of key/value pairs that provide additional
	// information such as the policy author, support contact information, etc.
	Info map[string]string
	// default_frequency defines the interval the template will be run unless set
	// differently during application.
	DefaultFrequency *string
	// href is the href of the policy template.
	Href *string
	// filename is the name of the file that was uploaded to create the policy
	// template.
	Filename *string
	// source is the policy template source code.
	Source *string
	// fingerprint is a SHA created during compilation. It is used to determine if
	// the template is outdated.
	Fingerprint *string
	// category is the type categorization of the policy template.
	Category *string
	// created_by is the RightScale user that created the policy template.
	CreatedBy *UserView
	// created_at is the policy template creation timestamp in RFC3339 format.
	CreatedAt *string
	// updated_by is the RightScale user that updated the policy template.
	UpdatedBy *UserView
	// updated_at is the last update timestamp in RFC3339 format.
	UpdatedAt *string
	// permissions is a list of permissions required to run the policy.
	Permissions map[string]*PermissionView
	// required_roles is a list of governance roles, derived from permissions,
	// required to run the policy.
	RequiredRoles []string
	// parameters is a list of parameters required to apply the policy.
	Parameters map[string]*ParameterView
	// severity defines the severity level of incidents raised from this policy
	// template.
	Severity *string
	// tenancy indicates whether this template can be run across multiple projects
	// or is restricted to a single project.
	Tenancy *string
	// credentials is a list of authorization for external APIs needed to run the
	// policy.
	Credentials map[string]*CredentialsView
	// kind is "gov#policy_template".
	Kind *string
}

PolicyTemplateView is a type that runs validations on a projected type.

type RegexpView

type RegexpView struct {
	// Pattern is the regular expression pattern.
	Pattern *string `json:"pattern"`
	// Options are the regular expression options. Options i (case insensitve) and
	// m (match over newlines) supported.
	Options *string `json:"options"`
}

RegexpView is a type that runs validations on a projected type.

type UserView

type UserView struct {
	// ID of user
	ID *uint
	// email of user
	Email *string
	// name of user, usually of the form 'First Last'
	Name *string
}

UserView is a type that runs validations on a projected type.

Jump to

Keyboard shortcuts

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