iamkey

package
v0.0.0-...-8b0dc5b Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 13 Imported by: 42

Documentation

Index

Constants

This section is empty.

Variables

Functions

func WriteToJSONFile

func WriteToJSONFile(path string, key *Key) error

WriteToJSONFile writes key to file in JSON format. File permissions will be 0600, because private key part is sensitive data.

Types

type Key

type Key struct {

	// ID of the Key resource.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Types that are assignable to Subject:
	//	*Key_UserAccountId
	//	*Key_ServiceAccountId
	Subject isKey_Subject `protobuf_oneof:"subject"`
	// Creation timestamp in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	// Description of the Key resource. 0-256 characters long.
	Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
	// An algorithm used to generate a key pair of the Key resource.
	KeyAlgorithm v1.Key_Algorithm `` /* 137-byte string literal not displayed */
	// A public key of the Key resource.
	PublicKey string `protobuf:"bytes,7,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	// A public key of the Key resource.
	PrivateKey string `protobuf:"bytes,8,opt,name=private_key,json=privateKey,proto3" json:"private_key,omitempty"`
	// contains filtered or unexported fields
}

Key is resource managed by IAM Key Service. Can be issued for User or Service Account, but key authorization is supported only for Service Accounts. Issued key contains private part that is not saved on server side, and should be saved by client.

func New

func New(created *iam.CreateKeyResponse) *Key

New creates new Key from IAM Key Service Create response.

func ReadFromJSONBytes

func ReadFromJSONBytes(keyBytes []byte) (*Key, error)

ReadFromJSONFile reads IAM Key from JSON bytes.

func ReadFromJSONFile

func ReadFromJSONFile(path string) (*Key, error)

ReadFromJSONFile reads IAM Key from JSON file.

func (*Key) Descriptor deprecated

func (*Key) Descriptor() ([]byte, []int)

Deprecated: Use Key.ProtoReflect.Descriptor instead.

func (*Key) GetCreatedAt

func (x *Key) GetCreatedAt() *timestamppb.Timestamp

func (*Key) GetDescription

func (x *Key) GetDescription() string

func (*Key) GetId

func (x *Key) GetId() string

func (*Key) GetKeyAlgorithm

func (x *Key) GetKeyAlgorithm() v1.Key_Algorithm

func (*Key) GetPrivateKey

func (x *Key) GetPrivateKey() string

func (*Key) GetPublicKey

func (x *Key) GetPublicKey() string

func (*Key) GetServiceAccountId

func (x *Key) GetServiceAccountId() string

func (*Key) GetSubject

func (m *Key) GetSubject() isKey_Subject

func (*Key) GetUserAccountId

func (x *Key) GetUserAccountId() string

func (*Key) MarshalJSON

func (m *Key) MarshalJSON() ([]byte, error)

func (*Key) MarshalYAML

func (m *Key) MarshalYAML() (interface{}, error)

func (*Key) ProtoMessage

func (*Key) ProtoMessage()

func (*Key) ProtoReflect

func (x *Key) ProtoReflect() protoreflect.Message

func (*Key) Reset

func (x *Key) Reset()

func (*Key) String

func (x *Key) String() string

func (*Key) UnmarshalJSON

func (m *Key) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals IAM Key JSON data. Both snake_case (gRPC API) and camelCase (REST API) fields are accepted.

func (*Key) UnmarshalYAML

func (m *Key) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals IAM Key YAML data. Both snake_case (gRPC API) and camelCase (REST API) fields are accepted.

type Key_ServiceAccountId

type Key_ServiceAccountId struct {
	// ID of the service account that the Key resource belongs to.
	ServiceAccountId string `protobuf:"bytes,3,opt,name=service_account_id,json=serviceAccountId,proto3,oneof"`
}

type Key_UserAccountId

type Key_UserAccountId struct {
	// ID of the user account that the Key resource belongs to.
	UserAccountId string `protobuf:"bytes,2,opt,name=user_account_id,json=userAccountId,proto3,oneof"`
}

Jump to

Keyboard shortcuts

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