policies

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a client for this collection

func NewClient

func NewClient(c *api.Client) *Client

Creates a new client for this collection. The submitted API client is cloned; modifications to it after generating this client will not have effect. If you need to make changes to the underlying API client, use ApiClient() to access it.

func (*Client) ApiClient

func (c *Client) ApiClient() *api.Client

ApiClient returns the underlying API client

func (*Client) Create

func (c *Client) Create(ctx context.Context, resourceType string, scopeId string, opt ...Option) (*PolicyCreateResult, error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, id string, opt ...Option) (*PolicyDeleteResult, error)

func (*Client) List

func (c *Client) List(ctx context.Context, scopeId string, opt ...Option) (*PolicyListResult, error)

func (*Client) Read

func (c *Client) Read(ctx context.Context, id string, opt ...Option) (*PolicyReadResult, error)

func (*Client) Update

func (c *Client) Update(ctx context.Context, id string, version uint32, opt ...Option) (*PolicyUpdateResult, error)

type Option

type Option func(*options)

Option is a func that sets optional attributes for a call. This does not need to be used directly, but instead option arguments are built from the functions in this package. WithX options set a value to that given in the argument; DefaultX options indicate that the value should be set to its default. When an API call is made options are processed in the order they appear in the function call, so for a given argument X, a succession of WithX or DefaultX calls will result in the last call taking effect.

func DefaultAttributes

func DefaultAttributes() Option

func DefaultDescription

func DefaultDescription() Option

func DefaultName

func DefaultName() Option

func DefaultStoragePolicyDeleteAfter

func DefaultStoragePolicyDeleteAfter() Option

func DefaultStoragePolicyDeleteAfterDays added in v0.0.46

func DefaultStoragePolicyDeleteAfterDays() Option

func DefaultStoragePolicyDeleteAfterOverridable added in v0.0.46

func DefaultStoragePolicyDeleteAfterOverridable() Option

func DefaultStoragePolicyRetainFor

func DefaultStoragePolicyRetainFor() Option

func DefaultStoragePolicyRetainForDays added in v0.0.46

func DefaultStoragePolicyRetainForDays() Option

func DefaultStoragePolicyRetainForOverridable added in v0.0.46

func DefaultStoragePolicyRetainForOverridable() Option

func WithAttributes

func WithAttributes(inAttributes map[string]interface{}) Option

func WithAutomaticVersioning

func WithAutomaticVersioning(enable bool) Option

If set, and if the version is zero during an update, the API will perform a fetch to get the current version of the resource and populate it during the update call. This is convenient but opens up the possibility for subtle order-of-modification issues, so use carefully.

func WithDescription

func WithDescription(inDescription string) Option

func WithFilter

func WithFilter(filter string) Option

WithFilter tells the API to filter the items returned using the provided filter term. The filter should be in a format supported by hashicorp/go-bexpr.

func WithListToken

func WithListToken(listToken string) Option

WithListToken tells the API to use the provided list token for listing operations on this resource.

func WithName

func WithName(inName string) Option

func WithRecursive

func WithRecursive(recurse bool) Option

WithRecursive tells the API to use recursion for listing operations on this resource

func WithSkipCurlOutput

func WithSkipCurlOutput(skip bool) Option

WithSkipCurlOutput tells the API to not use the current call for cURL output. Useful for when we need to look up versions.

func WithStoragePolicyDeleteAfter

func WithStoragePolicyDeleteAfter(inDeleteAfter map[string]any) Option

func WithStoragePolicyDeleteAfterDays added in v0.0.46

func WithStoragePolicyDeleteAfterDays(inDays int32) Option

func WithStoragePolicyDeleteAfterOverridable added in v0.0.46

func WithStoragePolicyDeleteAfterOverridable(inOverridable bool) Option

func WithStoragePolicyRetainFor

func WithStoragePolicyRetainFor(inDeleteAfter map[string]any) Option

func WithStoragePolicyRetainForDays added in v0.0.46

func WithStoragePolicyRetainForDays(inDays int32) Option

func WithStoragePolicyRetainForOverridable added in v0.0.46

func WithStoragePolicyRetainForOverridable(inOverridable bool) Option

type Policy

type Policy struct {
	Id                string                 `json:"id,omitempty"`
	ScopeId           string                 `json:"scope_id,omitempty"`
	Scope             *scopes.ScopeInfo      `json:"scope,omitempty"`
	Name              string                 `json:"name,omitempty"`
	Description       string                 `json:"description,omitempty"`
	CreatedTime       time.Time              `json:"created_time,omitempty"`
	UpdatedTime       time.Time              `json:"updated_time,omitempty"`
	Type              string                 `json:"type,omitempty"`
	Version           uint32                 `json:"version,omitempty"`
	Attributes        map[string]interface{} `json:"attributes,omitempty"`
	AuthorizedActions []string               `json:"authorized_actions,omitempty"`
}

func (*Policy) GetStoragePolicyAttributes

func (pt *Policy) GetStoragePolicyAttributes() (*StoragePolicyAttributes, error)

type PolicyCreateResult

type PolicyCreateResult = PolicyReadResult

type PolicyDeleteResult

type PolicyDeleteResult struct {
	Response *api.Response
}

func (PolicyDeleteResult) GetItem

func (n PolicyDeleteResult) GetItem() interface{}

GetItem will always be nil for PolicyDeleteResult

func (PolicyDeleteResult) GetResponse

func (n PolicyDeleteResult) GetResponse() *api.Response

type PolicyListResult

type PolicyListResult struct {
	Items        []*Policy `json:"items,omitempty"`
	EstItemCount uint      `json:"est_item_count,omitempty"`
	RemovedIds   []string  `json:"removed_ids,omitempty"`
	ListToken    string    `json:"list_token,omitempty"`
	ResponseType string    `json:"response_type,omitempty"`
	Response     *api.Response
}

func (PolicyListResult) GetEstItemCount

func (n PolicyListResult) GetEstItemCount() uint

func (PolicyListResult) GetItems

func (n PolicyListResult) GetItems() []*Policy

func (PolicyListResult) GetListToken

func (n PolicyListResult) GetListToken() string

func (PolicyListResult) GetRemovedIds

func (n PolicyListResult) GetRemovedIds() []string

func (PolicyListResult) GetResponse

func (n PolicyListResult) GetResponse() *api.Response

func (PolicyListResult) GetResponseType

func (n PolicyListResult) GetResponseType() string

type PolicyReadResult

type PolicyReadResult struct {
	Item     *Policy
	Response *api.Response
}

func (PolicyReadResult) GetItem

func (n PolicyReadResult) GetItem() *Policy

func (PolicyReadResult) GetResponse

func (n PolicyReadResult) GetResponse() *api.Response

type PolicyUpdateResult

type PolicyUpdateResult = PolicyReadResult

type StoragePolicyAttributes

type StoragePolicyAttributes struct {
	RetainFor   *StoragePolicyRetainFor   `json:"retain_for,omitempty"`
	DeleteAfter *StoragePolicyDeleteAfter `json:"delete_after,omitempty"`
}

func AttributesMapToStoragePolicyAttributes

func AttributesMapToStoragePolicyAttributes(in map[string]interface{}) (*StoragePolicyAttributes, error)

type StoragePolicyDeleteAfter added in v0.0.46

type StoragePolicyDeleteAfter struct {
	Days        int32 `json:"days,omitempty"`
	Overridable bool  `json:"overridable,omitempty"`
}

type StoragePolicyRetainFor added in v0.0.46

type StoragePolicyRetainFor struct {
	Days        int32 `json:"days,omitempty"`
	Overridable bool  `json:"overridable,omitempty"`
}

Jump to

Keyboard shortcuts

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