Documentation ¶
Index ¶
- type Resource
- func (r Resource) Link() *models.HashicorpCloudLocationLink
- func (r Resource) Location() *models.HashicorpCloudLocationLocation
- func (r *Resource) MarshalJSON() ([]byte, error)
- func (r *Resource) MarshalText() ([]byte, error)
- func (r Resource) String() string
- func (r *Resource) UnmarshalJSON(bytes []byte) error
- func (r *Resource) UnmarshalText(text []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Resource ¶
type Resource struct { // ID uniquely identifies a resource within an HCP project ID string // Type is the name of the kind of resource identified Type string // Organization is the UUID of the HCP organization the resource belongs to Organization string // Project is the UUID of the HCP project the resource belongs to Project string }
Resource is a representation of a HCP resource identifier
func FromLink ¶
func FromLink(l *models.HashicorpCloudLocationLink) (r Resource, err error)
FromLink converts a models.HashicorpCloudLocationLink to a Resource.
func FromString ¶
FromString parses the string encoding of a resource identifier.
func Must ¶
Must is a helper function that wraps a call to a function returning (Resource, error) such as FromLink or FromString and panics if the error is non-nil. It is intended for use in variable initializations such as
var packageResource = resource.Must(resource.FromString("..."))
func (Resource) Link ¶
func (r Resource) Link() *models.HashicorpCloudLocationLink
Link returns a *models.HashicorpCloudLocationLink initialized with values from the Resource
func (Resource) Location ¶
func (r Resource) Location() *models.HashicorpCloudLocationLocation
Location returns a *models.HashicorpCloudLocationLocation initialized with the Resource's organization and project IDs.
func (*Resource) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (*Resource) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface. The encoding is the same as returned by String.
func (Resource) String ¶
String encodes the resource identifier in the following canonical format:
"organization/<Organization UUID>/project/<Project UUID>/<Type>/<ID>"
Example:
"organization/ccbdd191-5dc3-4a73-9e05-6ac30ca67992/project/36019e0d-ed59-4df6-9990-05bb7fc793b6/hashicorp.consul.linked-cluster/prod-on-prem"
func (*Resource) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface
func (*Resource) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface and parses an encoded Resource.