rotation

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: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disable

func Disable(client *golangsdk.ServiceClient, opts RotationOptsBuilder) (r golangsdk.ErrResult)

Disable will disable rotation for a CMK based on the values in RotationOpts.

func Enable

func Enable(client *golangsdk.ServiceClient, opts RotationOptsBuilder) (r golangsdk.ErrResult)

Enable will enable rotation for a CMK based on the values in RotationOpts. The default rotation interval is 365 days. CMKs created using imported key materials and Default Master Keys do not support rotation.

func Update

func Update(client *golangsdk.ServiceClient, opts UpdateOptsBuilder) (r golangsdk.ErrResult)

Update will change the rotation interval for a CMK

Types

type GetResult

type GetResult struct {
	golangsdk.Result
}

GetResult contains the response body and error from a Get request.

func Get

func Get(client *golangsdk.ServiceClient, opts RotationOptsBuilder) (r GetResult)

Get retrieves the key with the provided ID. To extract the key object from the response, call the Extract method on the GetResult.

func (GetResult) Extract

func (r GetResult) Extract() (Rotation, error)

type IntervalOpts

type IntervalOpts struct {
	// ID of a CMK
	KeyID string `json:"key_id" required:"true"`
	// Rotation interval. The value is an integer in the range 30 to 365.
	// Set the interval based on how often a CMK is used.
	// If it is frequently used, set a short interval; otherwise, set a long one.
	Interval int `json:"rotation_interval" required:"true"`
	// 36-byte sequence number of a request message
	Sequence string `json:"sequence,omitempty"`
}

func (IntervalOpts) ToKeyRotationIntervalMap

func (opts IntervalOpts) ToKeyRotationIntervalMap() (map[string]interface{}, error)

ToKeyRotationIntervalMap assembles a request body based on the contents of a IntervalOpts.

type Rotation

type Rotation struct {
	// Key rotation status. The default value is false, indicating that key rotation is disabled.
	Enabled bool `json:"key_rotation_enabled"`
	// Rotation interval. The value is an integer in the range 30 to 365.
	Interval int `json:"rotation_interval"`
	// Last key rotation time. The timestamp indicates the total microseconds past the start of the epoch date (January 1, 1970).
	LastRotationTime string `json:"last_rotation_time"`
	// Number of key rotations.
	NumberOfRotations int `json:"number_of_rotations"`
}

Rotation is the response body of Get method

type RotationOpts

type RotationOpts struct {
	// ID of a CMK
	KeyID string `json:"key_id" required:"true"`
	// 36-byte sequence number of a request message
	Sequence string `json:"sequence,omitempty"`
}

func (RotationOpts) ToKeyRotationMap

func (opts RotationOpts) ToKeyRotationMap() (map[string]interface{}, error)

ToKeyRotationMap assembles a request body based on the contents of a RotationOpts.

type RotationOptsBuilder

type RotationOptsBuilder interface {
	ToKeyRotationMap() (map[string]interface{}, error)
}

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToKeyRotationIntervalMap() (map[string]interface{}, error)
}

Jump to

Keyboard shortcuts

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