keys

package
v0.0.0-...-57791d6 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Overview

Package keys provides information and interaction with keys in the Key Management Service service. The customer master keys (CMKs) used to encrypt data encryption keys (DEKs)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOpts

type CreateOpts struct {
	// Alias of a CMK
	KeyAlias string `json:"key_alias" required:"true"`
	// CMK description
	KeyDescription string `json:"key_description,omitempty"`
	// Region where a CMK resides
	Realm string `json:"realm,omitempty"`
	// Purpose of a CMK (The default value is Encrypt_Decrypt)
	KeyUsage string `json:"key_usage,omitempty"`
	// Key Algorithm
	KeySpec string `json:"key_spec,omitempty"`
	// Enterprise project id
	EnterpriseProjectID string `json:"enterprise_project_id,omitempty"`
	// Key source, the value can be kms or external, the default value is kms.
	Origin string `json:"origin,omitempty"`
	// Keystore id, default value is the KMS default keystore id
	KeyStoreID string `json:"keystore_id,omitempty"`
}

func (CreateOpts) ToKeyCreateMap

func (opts CreateOpts) ToKeyCreateMap() (map[string]interface{}, error)

ToKeyCreateMap assembles a request body based on the contents of a CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToKeyCreateMap() (map[string]interface{}, error)
}

type CreateResult

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

CreateResult contains the response body and error from a Create request.

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create will create a new key based on the values in CreateOpts. To ExtractKeyInfo the key object from the response, call the ExtractKeyInfo method on the CreateResult.

func (CreateResult) Extract

func (r CreateResult) Extract() (*Key, error)

func (CreateResult) ExtractDataKey

func (r CreateResult) ExtractDataKey() (*DataKey, error)

func (CreateResult) ExtractEncryptDEK

func (r CreateResult) ExtractEncryptDEK() (*EncryptDEK, error)

func (CreateResult) ExtractKeyInfo

func (r CreateResult) ExtractKeyInfo() (*Key, error)

func (CreateResult) ExtractKeyInfoInto

func (r CreateResult) ExtractKeyInfoInto(v interface{}) error

func (CreateResult) ExtractListKey

func (r CreateResult) ExtractListKey() (*ListKey, error)

type DataEncryptOpts

type DataEncryptOpts struct {
	// ID of a CMK
	KeyID string `json:"key_id" required:"true"`
	// CMK description
	EncryptionContext string `json:"encryption_context,omitempty"`
	// 36-byte serial number of a request message
	DatakeyLength string `json:"datakey_length,omitempty"`
}

func (DataEncryptOpts) ToDataEncryptMap

func (opts DataEncryptOpts) ToDataEncryptMap() (map[string]interface{}, error)

type DataEncryptOptsBuilder

type DataEncryptOptsBuilder interface {
	ToDataEncryptMap() (map[string]interface{}, error)
}

type DataEncryptResult

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

func DataEncryptGetWithoutPlaintext

func DataEncryptGetWithoutPlaintext(client *golangsdk.ServiceClient, opts DataEncryptOptsBuilder) (r DataEncryptResult)

func (DataEncryptResult) Extract

func (r DataEncryptResult) Extract() (*Key, error)

func (DataEncryptResult) ExtractDataKey

func (r DataEncryptResult) ExtractDataKey() (*DataKey, error)

func (DataEncryptResult) ExtractEncryptDEK

func (r DataEncryptResult) ExtractEncryptDEK() (*EncryptDEK, error)

func (DataEncryptResult) ExtractKeyInfo

func (r DataEncryptResult) ExtractKeyInfo() (*Key, error)

func (DataEncryptResult) ExtractKeyInfoInto

func (r DataEncryptResult) ExtractKeyInfoInto(v interface{}) error

func (DataEncryptResult) ExtractListKey

func (r DataEncryptResult) ExtractListKey() (*ListKey, error)

type DataKey

type DataKey struct {
	// Current ID of a CMK
	KeyID      string `json:"key_id"`
	PlainText  string `json:"plain_text"`
	CipherText string `json:"cipher_text"`
}

type DeleteKeyMaterialOpts

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

func (DeleteKeyMaterialOpts) ToKeyMaterialDeleteMap

func (opts DeleteKeyMaterialOpts) ToKeyMaterialDeleteMap() (map[string]interface{}, error)

type DeleteKeyMaterialOptsBuilder

type DeleteKeyMaterialOptsBuilder interface {
	ToKeyMaterialDeleteMap() (map[string]interface{}, error)
}

type DeleteKeyMaterialResult

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

DeleteKeyMaterialResult contains the response body and error from a DeleteKeyMaterial request.

func DeleteKeyMaterial

DeleteKeyMaterial will delete the existing key material with the keyID.

func (DeleteKeyMaterialResult) Extract

func (r DeleteKeyMaterialResult) Extract() (*Key, error)

func (DeleteKeyMaterialResult) ExtractDataKey

func (r DeleteKeyMaterialResult) ExtractDataKey() (*DataKey, error)

func (DeleteKeyMaterialResult) ExtractEncryptDEK

func (r DeleteKeyMaterialResult) ExtractEncryptDEK() (*EncryptDEK, error)

func (DeleteKeyMaterialResult) ExtractKeyInfo

func (r DeleteKeyMaterialResult) ExtractKeyInfo() (*Key, error)

func (DeleteKeyMaterialResult) ExtractKeyInfoInto

func (r DeleteKeyMaterialResult) ExtractKeyInfoInto(v interface{}) error

func (DeleteKeyMaterialResult) ExtractListKey

func (r DeleteKeyMaterialResult) ExtractListKey() (*ListKey, error)

type DeleteOpts

type DeleteOpts struct {
	// ID of a CMK
	KeyID string `json:"key_id" required:"true"`
	// Number of days after which a CMK is scheduled to be deleted
	// (The value ranges from 7 to 1096.)
	PendingDays string `json:"pending_days" required:"true"`
}

func (DeleteOpts) ToKeyDeleteMap

func (opts DeleteOpts) ToKeyDeleteMap() (map[string]interface{}, error)

ToKeyDeleteMap assembles a request body based on the contents of a DeleteOpts.

type DeleteOptsBuilder

type DeleteOptsBuilder interface {
	ToKeyDeleteMap() (map[string]interface{}, error)
}

type DeleteResult

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

DeleteResult contains the response body and error from a Delete request.

func Delete

func Delete(client *golangsdk.ServiceClient, opts DeleteOptsBuilder) (r DeleteResult)

Delete will delete the existing key with the provided ID.

func (DeleteResult) Extract

func (r DeleteResult) Extract() (*Key, error)

func (DeleteResult) ExtractDataKey

func (r DeleteResult) ExtractDataKey() (*DataKey, error)

func (DeleteResult) ExtractEncryptDEK

func (r DeleteResult) ExtractEncryptDEK() (*EncryptDEK, error)

func (DeleteResult) ExtractKeyInfo

func (r DeleteResult) ExtractKeyInfo() (*Key, error)

func (DeleteResult) ExtractKeyInfoInto

func (r DeleteResult) ExtractKeyInfoInto(v interface{}) error

func (DeleteResult) ExtractListKey

func (r DeleteResult) ExtractListKey() (*ListKey, error)

type EncryptDEK

type EncryptDEK struct {
	// Current ID of a CMK
	KeyID         string `json:"key_id"`
	DataKeyLength string `json:"datakey_length"`
	CipherText    string `json:"cipher_text"`
}

type EncryptDEKOpts

type EncryptDEKOpts struct {
	// ID of a CMK
	KeyID string `json:"key_id" required:"true"`
	// CMK description
	EncryptionContext string `json:"encryption_context,omitempty"`
	// 36-byte serial number of a request message
	DataKeyPlainLength string `json:"datakey_plain_length,omitempty"`
	// Both the plaintext (64 bytes) of a DEK and the SHA-256 hash value (32 bytes)
	// of the plaintext are expressed as a hexadecimal character string.
	PlainText string `json:"plain_text" required:"true"`
}

func (EncryptDEKOpts) ToEncryptDEKMap

func (opts EncryptDEKOpts) ToEncryptDEKMap() (map[string]interface{}, error)

type EncryptDEKOptsBuilder

type EncryptDEKOptsBuilder interface {
	ToEncryptDEKMap() (map[string]interface{}, error)
}

type EncryptDEKResult

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

func EncryptDEKGet

func EncryptDEKGet(client *golangsdk.ServiceClient, opts EncryptDEKOptsBuilder) (r EncryptDEKResult)

func (EncryptDEKResult) Extract

func (r EncryptDEKResult) Extract() (*Key, error)

func (EncryptDEKResult) ExtractDataKey

func (r EncryptDEKResult) ExtractDataKey() (*DataKey, error)

func (EncryptDEKResult) ExtractEncryptDEK

func (r EncryptDEKResult) ExtractEncryptDEK() (*EncryptDEK, error)

func (EncryptDEKResult) ExtractKeyInfo

func (r EncryptDEKResult) ExtractKeyInfo() (*Key, error)

func (EncryptDEKResult) ExtractKeyInfoInto

func (r EncryptDEKResult) ExtractKeyInfoInto(v interface{}) error

func (EncryptDEKResult) ExtractListKey

func (r EncryptDEKResult) ExtractListKey() (*ListKey, error)

type ExtractUpdateKeyStateResult

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

func DisableKey

func DisableKey(client *golangsdk.ServiceClient, id string) (r ExtractUpdateKeyStateResult)

func EnableKey

func EnableKey(client *golangsdk.ServiceClient, id string) (r ExtractUpdateKeyStateResult)

func (ExtractUpdateKeyStateResult) Extract

func (r ExtractUpdateKeyStateResult) Extract() (*Key, error)

func (ExtractUpdateKeyStateResult) ExtractDataKey

func (r ExtractUpdateKeyStateResult) ExtractDataKey() (*DataKey, error)

func (ExtractUpdateKeyStateResult) ExtractEncryptDEK

func (r ExtractUpdateKeyStateResult) ExtractEncryptDEK() (*EncryptDEK, error)

func (ExtractUpdateKeyStateResult) ExtractKeyInfo

func (r ExtractUpdateKeyStateResult) ExtractKeyInfo() (*Key, error)

func (ExtractUpdateKeyStateResult) ExtractKeyInfoInto

func (r ExtractUpdateKeyStateResult) ExtractKeyInfoInto(v interface{}) error

func (ExtractUpdateKeyStateResult) ExtractListKey

func (r ExtractUpdateKeyStateResult) ExtractListKey() (*ListKey, error)

type GetResult

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

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

func Get

func Get(client *golangsdk.ServiceClient, id string) (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() (*Key, error)

func (GetResult) ExtractDataKey

func (r GetResult) ExtractDataKey() (*DataKey, error)

func (GetResult) ExtractEncryptDEK

func (r GetResult) ExtractEncryptDEK() (*EncryptDEK, error)

func (GetResult) ExtractKeyInfo

func (r GetResult) ExtractKeyInfo() (*Key, error)

func (GetResult) ExtractKeyInfoInto

func (r GetResult) ExtractKeyInfoInto(v interface{}) error

func (GetResult) ExtractListKey

func (r GetResult) ExtractListKey() (*ListKey, error)

type ImportKeyMaterialOptsBuilder

type ImportKeyMaterialOptsBuilder interface {
	ToKeyMaterialImportMap() (map[string]interface{}, error)
}

type ImportKeyMaterialResult

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

func ImportKeyMaterial

ImportKeyMaterial will import a key material for a pending import key.

func (ImportKeyMaterialResult) Extract

func (r ImportKeyMaterialResult) Extract() (*Key, error)

func (ImportKeyMaterialResult) ExtractDataKey

func (r ImportKeyMaterialResult) ExtractDataKey() (*DataKey, error)

func (ImportKeyMaterialResult) ExtractEncryptDEK

func (r ImportKeyMaterialResult) ExtractEncryptDEK() (*EncryptDEK, error)

func (ImportKeyMaterialResult) ExtractKeyInfo

func (r ImportKeyMaterialResult) ExtractKeyInfo() (*Key, error)

func (ImportKeyMaterialResult) ExtractKeyInfoInto

func (r ImportKeyMaterialResult) ExtractKeyInfoInto(v interface{}) error

func (ImportKeyMaterialResult) ExtractListKey

func (r ImportKeyMaterialResult) ExtractListKey() (*ListKey, error)

type ImportMaterialOpts

type ImportMaterialOpts struct {
	// The ID of the key.
	KeyID string `json:"key_id" required:"true"`
	// Key import token in Base64 format.
	// It matches the regular expression ^[0-9a-zA-Z+/=]{200,6144}$.
	ImportToken string `json:"import_token" required:"true"`
	// Encrypted symmetric key material in Base64 format.
	// It matches the regular expression ^[0-9a-zA-Z+/=]{344,360}$.
	// If an asymmetric key is imported, this parameter is a temporary intermediate key used to encrypt the private key.
	EncryptedKeyMaterial string `json:"encrypted_key_material" required:"true"`
	// Private key encrypted using a temporary intermediate key.
	// This parameter is required for importing an asymmetric key.
	// The value must be encoded using in Base64 and match the following regular expression: ^[0-9a-zA-Z+/=]{200,6144}$
	EncryptedPrivatekey string `json:"encrypted_privatekey,omitempty"`
	// Expiration time of the key material.
	ExpirationTime string `json:"expiration_time,omitempty"`
	// 36-byte sequence number of a request message
	Sequence string `json:"sequence,omitempty"`
}

func (ImportMaterialOpts) ToKeyMaterialImportMap

func (opts ImportMaterialOpts) ToKeyMaterialImportMap() (map[string]interface{}, error)

type Key

type Key struct {
	// Current ID of a CMK
	KeyID string `json:"key_id"`
	// ID of a user domain for the key.
	DomainID string `json:"domain_id"`
	// Alias of a CMK
	KeyAlias string `json:"key_alias"`
	// Key algorithm
	KeySpec string `json:"key_spec"`
	// Region where a CMK resides
	Realm string `json:"realm"`
	// Description of a CMK
	KeyDescription string `json:"key_description"`
	// Creation time (time stamp) of a CMK
	CreationDate string `json:"creation_date"`
	// Scheduled deletion time (time stamp) of a CMK
	ScheduledDeletionDate string `json:"scheduled_deletion_date"`
	// State of a CMK
	KeyState string `json:"key_state"`
	// Identification of a Master Key. The value 1 indicates a Default
	// Master Key, and the value 0 indicates a CMK
	DefaultKeyFlag string `json:"default_key_flag"`
	// Expiration time
	ExpirationTime string `json:"expiration_time"`
	// Origin of a CMK. The default value is kms. The following values
	// are enumerated: kms indicates that the CMK material is generated by KMS.
	Origin string `json:"origin"`
	//Enterprise peoject id
	EnterpriseProjectID string `json:"sys_enterprise_project_id"`
	// Key usage
	KeyUsage string `json:"key_usage"`
	// Keystore ID
	KeyStoreID string `json:"keystore_id"`
}

Key contains all the information associated with a CMK.

func ExtractKeys

func ExtractKeys(r pagination.Page) ([]Key, error)

type KeyPage

type KeyPage struct {
	pagination.LinkedPageBase
}

func (KeyPage) IsEmpty

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

type ListKey

type ListKey struct {
	Keys       []string `json:"keys"`
	KeyDetails []Key    `json:"key_details"`
	NextMarker string   `json:"next_marker"`
	Truncated  string   `json:"truncated"`
}

type ListOpts

type ListOpts struct {
	// State of a CMK
	KeyState            string `json:"key_state,omitempty"`
	Limit               string `json:"limit,omitempty"`
	Marker              string `json:"marker,omitempty"`
	EnterpriseProjectID string `json:"enterprise_project_id,omitempty"`
}

ListOpts holds options for listing Volumes. It is passed to the volumes.List function.

func (ListOpts) ToKeyListMap

func (opts ListOpts) ToKeyListMap() (map[string]interface{}, error)

type ListOptsBuilder

type ListOptsBuilder interface {
	ToKeyListMap() (map[string]interface{}, error)
}

type ListResult

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

func List

func List(client *golangsdk.ServiceClient, opts ListOptsBuilder) (r ListResult)

func ListAllKeys

func ListAllKeys(client *golangsdk.ServiceClient, opts ListOptsBuilder) (r ListResult)

func (ListResult) Extract

func (r ListResult) Extract() (*Key, error)

func (ListResult) ExtractDataKey

func (r ListResult) ExtractDataKey() (*DataKey, error)

func (ListResult) ExtractEncryptDEK

func (r ListResult) ExtractEncryptDEK() (*EncryptDEK, error)

func (ListResult) ExtractKeyInfo

func (r ListResult) ExtractKeyInfo() (*Key, error)

func (ListResult) ExtractKeyInfoInto

func (r ListResult) ExtractKeyInfoInto(v interface{}) error

func (ListResult) ExtractListKey

func (r ListResult) ExtractListKey() (*ListKey, error)

type UpdateAliasOpts

type UpdateAliasOpts struct {
	// ID of a CMK
	KeyID string `json:"key_id" required:"true"`
	// CMK description
	KeyAlias string `json:"key_alias" required:"true"`
}

func (UpdateAliasOpts) ToKeyUpdateAliasMap

func (opts UpdateAliasOpts) ToKeyUpdateAliasMap() (map[string]interface{}, error)

ToKeyUpdateAliasMap assembles a request body based on the contents of a UpdateAliasOpts.

type UpdateAliasOptsBuilder

type UpdateAliasOptsBuilder interface {
	ToKeyUpdateAliasMap() (map[string]interface{}, error)
}

type UpdateAliasResult

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

UpdateAliasResult contains the response body and error from a UpdateAlias request.

func (UpdateAliasResult) Extract

func (r UpdateAliasResult) Extract() (*Key, error)

func (UpdateAliasResult) ExtractDataKey

func (r UpdateAliasResult) ExtractDataKey() (*DataKey, error)

func (UpdateAliasResult) ExtractEncryptDEK

func (r UpdateAliasResult) ExtractEncryptDEK() (*EncryptDEK, error)

func (UpdateAliasResult) ExtractKeyInfo

func (r UpdateAliasResult) ExtractKeyInfo() (*Key, error)

func (UpdateAliasResult) ExtractKeyInfoInto

func (r UpdateAliasResult) ExtractKeyInfoInto(v interface{}) error

func (UpdateAliasResult) ExtractListKey

func (r UpdateAliasResult) ExtractListKey() (*ListKey, error)

type UpdateDesOpts

type UpdateDesOpts struct {
	// ID of a CMK
	KeyID string `json:"key_id" required:"true"`
	// CMK description
	KeyDescription string `json:"key_description" required:"true"`
}

func (UpdateDesOpts) ToKeyUpdateDesMap

func (opts UpdateDesOpts) ToKeyUpdateDesMap() (map[string]interface{}, error)

ToKeyUpdateDesMap assembles a request body based on the contents of a UpdateDesOpts.

type UpdateDesOptsBuilder

type UpdateDesOptsBuilder interface {
	ToKeyUpdateDesMap() (map[string]interface{}, error)
}

type UpdateDesResult

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

UpdateDesResult contains the response body and error from a UpdateDes request.

func UpdateDes

func UpdateDes(client *golangsdk.ServiceClient, opts UpdateDesOptsBuilder) (r UpdateDesResult)

func (UpdateDesResult) Extract

func (r UpdateDesResult) Extract() (*Key, error)

func (UpdateDesResult) ExtractDataKey

func (r UpdateDesResult) ExtractDataKey() (*DataKey, error)

func (UpdateDesResult) ExtractEncryptDEK

func (r UpdateDesResult) ExtractEncryptDEK() (*EncryptDEK, error)

func (UpdateDesResult) ExtractKeyInfo

func (r UpdateDesResult) ExtractKeyInfo() (*Key, error)

func (UpdateDesResult) ExtractKeyInfoInto

func (r UpdateDesResult) ExtractKeyInfoInto(v interface{}) error

func (UpdateDesResult) ExtractListKey

func (r UpdateDesResult) ExtractListKey() (*ListKey, error)

type UpdateKeyState

type UpdateKeyState struct {
	// Current ID of a CMK
	KeyID    string `json:"key_id"`
	KeyState string `json:"key_state"`
}

Jump to

Keyboard shortcuts

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