iamkey

package
v0.0.0-...-417428f Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 valid to be assigned 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 *timestamp.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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

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

func (*Key) GetCreatedAt

func (m *Key) GetCreatedAt() *timestamp.Timestamp

func (*Key) GetDescription

func (m *Key) GetDescription() string

func (*Key) GetId

func (m *Key) GetId() string

func (*Key) GetKeyAlgorithm

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

func (*Key) GetPrivateKey

func (m *Key) GetPrivateKey() string

func (*Key) GetPublicKey

func (m *Key) GetPublicKey() string

func (*Key) GetServiceAccountId

func (m *Key) GetServiceAccountId() string

func (*Key) GetSubject

func (m *Key) GetSubject() isKey_Subject

func (*Key) GetUserAccountId

func (m *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) Reset

func (m *Key) Reset()

func (*Key) String

func (m *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.

func (*Key) XXX_DiscardUnknown

func (m *Key) XXX_DiscardUnknown()

func (*Key) XXX_Marshal

func (m *Key) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Key) XXX_Merge

func (dst *Key) XXX_Merge(src proto.Message)

func (*Key) XXX_OneofFuncs

func (*Key) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

func (*Key) XXX_Size

func (m *Key) XXX_Size() int

func (*Key) XXX_Unmarshal

func (m *Key) XXX_Unmarshal(b []byte) error

type Key_ServiceAccountId

type Key_ServiceAccountId struct {
	ServiceAccountId string `protobuf:"bytes,3,opt,name=service_account_id,json=serviceAccountId,proto3,oneof"`
}

type Key_UserAccountId

type Key_UserAccountId struct {
	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