secrets

package
v0.5.37 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

Create accepts a CreateOpts struct and creates a new secret using the values provided.

func Delete

func Delete(c *gcorecloud.ServiceClient, securityGroupID string) (r tasks.Result)

Delete accepts a unique ID and deletes the secret associated with it.

func ExtractSecretIDFromTask

func ExtractSecretIDFromTask(task *tasks.Task) (string, error)

func ExtractSecretsInto

func ExtractSecretsInto(r pagination.Page, v interface{}) error

Types

type CreateOpts

type CreateOpts struct {
	Algorithm              *string    `json:"algorithm,omitempty"`
	BitLength              *int       `json:"bit_length,omitempty"`
	Expiration             *time.Time `json:"-"`
	Name                   string     `json:"name" required:"true"`
	Mode                   *string    `json:"mode,omitempty"`
	Type                   SecretType `json:"secret_type" required:"true" validate:"enum"`
	Payload                string     `json:"payload" required:"true"`
	PayloadContentEncoding string     `json:"payload_content_encoding" required:"true"`
	PayloadContentType     string     `json:"payload_content_type" required:"true"`
}

CreateOpts represents options used to create a secret.

func (CreateOpts) ToSecretCreateMap

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

ToSecretCreateMap builds a request body from CreateOpts.

type CreateOptsBuilder

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

CreateOptsBuilder allows extensions to add additional parameters to the request.

type GetResult

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

GetResult represents the result of a get operation. Call its Extract method to interpret it as a Secret.

func Get

func Get(c *gcorecloud.ServiceClient, id string) (r GetResult)

Get retrieves a specific secret based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*Secret, error)

Extract is a function that accepts a result and extracts a secret resource.

func (GetResult) ExtractInto

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

type Secret

type Secret struct {
	ID           string                       `json:"id"`
	Name         string                       `json:"name"`
	Status       string                       `json:"status"`
	Algorithm    string                       `json:"algorithm"`
	BitLength    int                          `json:"bit_length"`
	ContentTypes map[string]string            `json:"content_types"`
	Mode         string                       `json:"mode"`
	Type         SecretType                   `json:"secret_type"`
	CreatedAt    gcorecloud.JSONRFC3339ZColon `json:"created"`
	UpdatedAt    gcorecloud.JSONRFC3339ZColon `json:"updated"`
	Expiration   gcorecloud.JSONRFC3339ZColon `json:"expiration"`
}

Secret represents a secret.

func ExtractSecrets

func ExtractSecrets(r pagination.Page) ([]Secret, error)

ExtractSecrets accepts a Page struct, specifically a SecretPage struct, and extracts the elements into a slice of Secret structs. In other words, a generic collection is mapped into a relevant slice.

func ListAll

func ListAll(c *gcorecloud.ServiceClient) ([]Secret, error)

ListAll returns all secrets

type SecretPage

type SecretPage struct {
	pagination.LinkedPageBase
}

SecretPage is the page returned by a pager when traversing over a collection of secrets.

func (SecretPage) IsEmpty

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

IsEmpty checks whether a Secret struct is empty.

func (SecretPage) NextPageURL

func (r SecretPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of secrets has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type SecretTaskResult

type SecretTaskResult struct {
	Secrets []string `json:"secrets"`
}

type SecretType

type SecretType string
const (
	SymmetricSecretType   SecretType = "symmetric"
	PublicSecretType      SecretType = "public"
	PrivateSecretType     SecretType = "private"
	PassphraseSecretType  SecretType = "passphrase"
	CertificateSecretType SecretType = "certificate"
	OpaqueSecretType      SecretType = "opaque"
)

func (SecretType) IsValid

func (s SecretType) IsValid() error

func (SecretType) List

func (s SecretType) List() []SecretType

func (*SecretType) MarshalJSON

func (s *SecretType) MarshalJSON() ([]byte, error)

MarshalJSON - implements Marshaler interface for SecretType

func (SecretType) String

func (s SecretType) String() string

func (SecretType) StringList

func (s SecretType) StringList() []string

func (*SecretType) UnmarshalJSON

func (s *SecretType) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface for SecretType

func (SecretType) ValidOrNil

func (s SecretType) ValidOrNil() (*SecretType, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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