models

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: MPL-2.0 Imports: 6 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoogleProtobufAny

type GoogleProtobufAny struct {

	// A URL/resource name that uniquely identifies the type of the serialized
	// protocol buffer message. This string must contain at least
	// one "/" character. The last segment of the URL's path must represent
	// the fully qualified name of the type (as in
	// `path/google.protobuf.Duration`). The name should be in a canonical form
	// (e.g., leading "." is not accepted).
	//
	// In practice, teams usually precompile into the binary all types that they
	// expect it to use in the context of Any. However, for URLs which use the
	// scheme `http`, `https`, or no scheme, one can optionally set up a type
	// server that maps type URLs to message definitions as follows:
	//
	// * If no scheme is provided, `https` is assumed.
	// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
	//   value in binary format, or produce an error.
	// * Applications are allowed to cache lookup results based on the
	//   URL, or have them precompiled into a binary to avoid any
	//   lookup. Therefore, binary compatibility needs to be preserved
	//   on changes to types. (Use versioned type names to manage
	//   breaking changes.)
	//
	// Note: this functionality is not currently available in the official
	// protobuf release, and it is not used for type URLs beginning with
	// type.googleapis.com.
	//
	// Schemes other than `http`, `https` (or the empty scheme) might be
	// used with implementation specific semantics.
	TypeURL string `json:"type_url,omitempty"`

	// Must be a valid serialized protocol buffer of the above specified type.
	// Format: byte
	Value strfmt.Base64 `json:"value,omitempty"`
}

GoogleProtobufAny `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message.

Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type.

Example 1: Pack and unpack a message in C++.

Foo foo = ...;
Any any;
any.PackFrom(foo);
...
if (any.UnpackTo(&foo)) {
  ...
}

Example 2: Pack and unpack a message in Java.

   Foo foo = ...;
   Any any = Any.pack(foo);
   ...
   if (any.is(Foo.class)) {
     foo = any.unpack(Foo.class);
   }

Example 3: Pack and unpack a message in Python.

   foo = Foo(...)
   any = Any()
   any.Pack(foo)
   ...
   if any.Is(Foo.DESCRIPTOR):
     any.Unpack(foo)
     ...

Example 4: Pack and unpack a message in Go

    foo := &pb.Foo{...}
    any, err := anypb.New(foo)
    if err != nil {
      ...
    }
    ...
    foo := &pb.Foo{}
    if err := any.UnmarshalTo(foo); err != nil {
      ...
    }

The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example "foo.bar.com/x/y.z" will yield type name "y.z".

JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example:

package google.profile;
message Person {
  string first_name = 1;
  string last_name = 2;
}

{
  "@type": "type.googleapis.com/google.profile.Person",
  "firstName": <string>,
  "lastName": <string>
}

If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]):

{
  "@type": "type.googleapis.com/google.protobuf.Duration",
  "value": "1.212s"
}

swagger:model google.protobuf.Any

func (*GoogleProtobufAny) MarshalBinary

func (m *GoogleProtobufAny) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*GoogleProtobufAny) UnmarshalBinary

func (m *GoogleProtobufAny) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*GoogleProtobufAny) Validate

func (m *GoogleProtobufAny) Validate(formats strfmt.Registry) error

Validate validates this google protobuf any

type GoogleRPCStatus

type GoogleRPCStatus struct {

	// The status code, which should be an enum value of
	// [google.rpc.Code][google.rpc.Code].
	Code int32 `json:"code,omitempty"`

	// A list of messages that carry the error details.  There is a common set of
	// message types for APIs to use.
	Details []*GoogleProtobufAny `json:"details"`

	// A developer-facing error message, which should be in English. Any
	// user-facing error message should be localized and sent in the
	// [google.rpc.Status.details][google.rpc.Status.details] field, or localized
	// by the client.
	Message string `json:"message,omitempty"`
}

GoogleRPCStatus The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). The error model is designed to be:

- Simple to use and understand for most users - Flexible enough to meet unexpected needs

Overview

The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` that can be used for common error conditions.

Language mapping

The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C.

Other uses

The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments.

Example uses of this error model include:

  • Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors.
  • Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting.
  • Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response.
  • Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message.
  • Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons.

swagger:model google.rpc.Status

func (*GoogleRPCStatus) MarshalBinary

func (m *GoogleRPCStatus) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*GoogleRPCStatus) UnmarshalBinary

func (m *GoogleRPCStatus) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*GoogleRPCStatus) Validate

func (m *GoogleRPCStatus) Validate(formats strfmt.Registry) error

Validate validates this google rpc status

type HashicorpCloudCommonPaginationRequest

type HashicorpCloudCommonPaginationRequest struct {

	// Specifies a page token to use to retrieve the next page. Set this to the
	// `next_page_token` returned by previous list requests to get the next page of
	// results. If set, `previous_page_token` must not be set.
	NextPageToken string `json:"next_page_token,omitempty"`

	// The max number of results per page that should be returned. If the number
	// of available results is larger than `page_size`, a `next_page_token` is
	// returned which can be used to get the next page of results in subsequent
	// requests. A value of zero will cause `page_size` to be defaulted.
	PageSize int64 `json:"page_size,omitempty"`

	// Specifies a page token to use to retrieve the previous page. Set this to
	// the `previous_page_token` returned by previous list requests to get the
	// previous page of results. If set, `next_page_token` must not be set.
	PreviousPageToken string `json:"previous_page_token,omitempty"`
}

HashicorpCloudCommonPaginationRequest PaginationRequest are the parameters for a paginated list request.

swagger:model hashicorp.cloud.common.PaginationRequest

func (*HashicorpCloudCommonPaginationRequest) MarshalBinary

func (m *HashicorpCloudCommonPaginationRequest) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*HashicorpCloudCommonPaginationRequest) UnmarshalBinary

func (m *HashicorpCloudCommonPaginationRequest) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*HashicorpCloudCommonPaginationRequest) Validate

Validate validates this hashicorp cloud common pagination request

type HashicorpCloudCommonPaginationResponse

type HashicorpCloudCommonPaginationResponse struct {

	// This token allows you to get the next page of results for list requests.
	// If the number of results is larger than `page_size`, use the
	// `next_page_token` as a value for the query parameter `next_page_token` in
	// the next request. The value will become empty when there are no more pages.
	NextPageToken string `json:"next_page_token,omitempty"`

	// This token allows you to get the previous page of results for list
	// requests. If the number of results is larger than `page_size`, use the
	// `previous_page_token` as a value for the query parameter
	// `previous_page_token` in the next request. The value will become empty when
	// there are no more pages.
	PreviousPageToken string `json:"previous_page_token,omitempty"`
}

HashicorpCloudCommonPaginationResponse PaginationResponse is the response holding the page tokens for a paginated list response.

swagger:model hashicorp.cloud.common.PaginationResponse

func (*HashicorpCloudCommonPaginationResponse) MarshalBinary

func (m *HashicorpCloudCommonPaginationResponse) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*HashicorpCloudCommonPaginationResponse) UnmarshalBinary

func (m *HashicorpCloudCommonPaginationResponse) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*HashicorpCloudCommonPaginationResponse) Validate

Validate validates this hashicorp cloud common pagination response

type HashicorpCloudLocationLink struct {

	// description is a human-friendly description for this link. This is
	// used primarily for informational purposes such as error messages.
	Description string `json:"description,omitempty"`

	// id is the identifier for this resource.
	ID string `json:"id,omitempty"`

	// location is the location where this resource is.
	Location *HashicorpCloudLocationLocation `json:"location,omitempty"`

	// type is the unique type of the resource. Each service publishes a
	// unique set of types. The type value is recommended to be formatted
	// in "<org>.<type>" such as "hashicorp.hvn". This is to prevent conflicts
	// in the future, but any string value will work.
	Type string `json:"type,omitempty"`

	// uuid is the unique UUID for this resource.
	UUID string `json:"uuid,omitempty"`
}

HashicorpCloudLocationLink Link is used to uniquely reference any resource within HashiCorp Cloud. This can be conceptually considered a "foreign key".

swagger:model hashicorp.cloud.location.Link

func (*HashicorpCloudLocationLink) MarshalBinary

func (m *HashicorpCloudLocationLink) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*HashicorpCloudLocationLink) UnmarshalBinary

func (m *HashicorpCloudLocationLink) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*HashicorpCloudLocationLink) Validate

func (m *HashicorpCloudLocationLink) Validate(formats strfmt.Registry) error

Validate validates this hashicorp cloud location link

type HashicorpCloudLocationLocation

type HashicorpCloudLocationLocation struct {

	// organization_id is the id of the organization.
	OrganizationID string `json:"organization_id,omitempty"`

	// project_id is the projects id.
	ProjectID string `json:"project_id,omitempty"`

	// region is the region that the resource is located in. It is
	// optional if the object being referenced is a global object.
	Region *HashicorpCloudLocationRegion `json:"region,omitempty"`
}

HashicorpCloudLocationLocation Location represents a target for an operation in HCP.

swagger:model hashicorp.cloud.location.Location

func (*HashicorpCloudLocationLocation) MarshalBinary

func (m *HashicorpCloudLocationLocation) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*HashicorpCloudLocationLocation) UnmarshalBinary

func (m *HashicorpCloudLocationLocation) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*HashicorpCloudLocationLocation) Validate

func (m *HashicorpCloudLocationLocation) Validate(formats strfmt.Registry) error

Validate validates this hashicorp cloud location location

type HashicorpCloudLocationRegion

type HashicorpCloudLocationRegion struct {

	// provider is the named cloud provider ("aws", "gcp", "azure")
	Provider string `json:"provider,omitempty"`

	// region is the cloud region ("us-west1", "us-east1")
	Region string `json:"region,omitempty"`
}

HashicorpCloudLocationRegion Region identifies a Cloud data-plane region.

swagger:model hashicorp.cloud.location.Region

func (*HashicorpCloudLocationRegion) MarshalBinary

func (m *HashicorpCloudLocationRegion) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*HashicorpCloudLocationRegion) UnmarshalBinary

func (m *HashicorpCloudLocationRegion) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*HashicorpCloudLocationRegion) Validate

func (m *HashicorpCloudLocationRegion) Validate(formats strfmt.Registry) error

Validate validates this hashicorp cloud location region

type HashicorpCloudOperationOperation

type HashicorpCloudOperationOperation struct {

	// CreatedAt is the timestamp of when the operation was first created.
	// Format: date-time
	CreatedAt strfmt.DateTime `json:"created_at,omitempty"`

	// error is the error that occurred in the operation.
	Error *GoogleRPCStatus `json:"error,omitempty"`

	// id is the unique ID for this operation used in other RPC calls.
	// This ID is only guaranteed to be unique within the region that
	// the operation is running in.
	ID string `json:"id,omitempty"`

	// Link is the resource link the operation is associated with.
	Link *HashicorpCloudLocationLink `json:"link,omitempty"`

	// Location is location of the resource that this operation belongs to.
	Location *HashicorpCloudLocationLocation `json:"location,omitempty"`

	// response is the result of the operation. See the documentation for the API
	// call creating the operation to understand what the value of this is.
	Response *GoogleProtobufAny `json:"response,omitempty"`

	// state is the current state of the operation. This is a simple tri-state:
	// PENDING means the operation is created but not yet started, RUNNING means
	// the operation is currently running (though it may be very long-running),
	// and DONE means the operation is complete whether successfully or not.
	State HashicorpCloudOperationOperationState `json:"state,omitempty"`

	// UpdatedAt is the timestamp of when the operation was last updated.
	// Format: date-time
	UpdatedAt strfmt.DateTime `json:"updated_at,omitempty"`
}

HashicorpCloudOperationOperation Operation represents a single operation.

swagger:model hashicorp.cloud.operation.Operation

func (*HashicorpCloudOperationOperation) MarshalBinary

func (m *HashicorpCloudOperationOperation) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*HashicorpCloudOperationOperation) UnmarshalBinary

func (m *HashicorpCloudOperationOperation) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*HashicorpCloudOperationOperation) Validate

Validate validates this hashicorp cloud operation operation

type HashicorpCloudOperationOperationState

type HashicorpCloudOperationOperationState string

HashicorpCloudOperationOperationState State is one of the states that an Operation can be in.

The states are purposely coarse grained to make it easy to understand the operation state machine: pending => running => done. Or pending => queued => running => done. No other state transitions are possible. Success/failure can be determined based on the result oneof.

swagger:model hashicorp.cloud.operation.Operation.State

const (

	// HashicorpCloudOperationOperationStatePENDING captures enum value "PENDING"
	HashicorpCloudOperationOperationStatePENDING HashicorpCloudOperationOperationState = "PENDING"

	// HashicorpCloudOperationOperationStateRUNNING captures enum value "RUNNING"
	HashicorpCloudOperationOperationStateRUNNING HashicorpCloudOperationOperationState = "RUNNING"

	// HashicorpCloudOperationOperationStateDONE captures enum value "DONE"
	HashicorpCloudOperationOperationStateDONE HashicorpCloudOperationOperationState = "DONE"

	// HashicorpCloudOperationOperationStateQUEUED captures enum value "QUEUED"
	HashicorpCloudOperationOperationStateQUEUED HashicorpCloudOperationOperationState = "QUEUED"
)

func (HashicorpCloudOperationOperationState) Validate

Validate validates this hashicorp cloud operation operation state

Jump to

Keyboard shortcuts

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