Documentation ¶
Index ¶
- type GoogleProtobufAny
- type GoogleProtobufFieldMask
- type GoogleRPCStatus
- type GrpcGatewayRuntimeError
- type HashicorpCloudCommonPaginationRequest
- type HashicorpCloudCommonPaginationResponse
- type HashicorpCloudCommonSortingRequest
- type HashicorpCloudLocationLink
- type HashicorpCloudLocationLocation
- type HashicorpCloudLocationRegion
- type HashicorpCloudOperationOperation
- type HashicorpCloudOperationOperationState
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
type GoogleProtobufFieldMask ¶ added in v0.5.0
type GoogleProtobufFieldMask struct { // The set of field mask paths. Paths []string `json:"paths"` }
GoogleProtobufFieldMask `FieldMask` represents a set of symbolic field paths, for example:
paths: "f.a"
paths: "f.b.d"
Here `f` represents a field in some root message, `a` and `b` fields in the message found in `f`, and `d` a field found in the message in `f.b`.
Field masks are used to specify a subset of fields that should be returned by a get operation or modified by an update operation. Field masks also have a custom JSON encoding (see below).
Field Masks in Projections ¶
When used in the context of a projection, a response message or sub-message is filtered by the API to only contain those fields as specified in the mask. For example, if the mask in the previous example is applied to a response message as follows:
f { a : 22 b { d : 1 x : 2 } y : 13 } z: 8
The result will not contain specific values for fields x,y and z (their value will be set to the default, and omitted in proto text output):
f { a : 22 b { d : 1 } }
A repeated field is not allowed except at the last position of a paths string.
If a FieldMask object is not present in a get operation, the operation applies to all fields (as if a FieldMask of all fields had been specified).
Note that a field mask does not necessarily apply to the top-level response message. In case of a REST get operation, the field mask applies directly to the response, but in case of a REST list operation, the mask instead applies to each individual message in the returned resource list. In case of a REST custom method, other definitions may be used. Where the mask applies will be clearly documented together with its declaration in the API. In any case, the effect on the returned resource/resources is required behavior for APIs.
Field Masks in Update Operations ¶
A field mask in update operations specifies which fields of the targeted resource are going to be updated. The API is required to only change the values of the fields as specified in the mask and leave the others untouched. If a resource is passed in to describe the updated values, the API ignores the values of all fields not covered by the mask.
If a repeated field is specified for an update operation, new values will be appended to the existing repeated field in the target resource. Note that a repeated field is only allowed in the last position of a `paths` string.
If a sub-message is specified in the last position of the field mask for an update operation, then new value will be merged into the existing sub-message in the target resource.
For example, given the target message:
f { b { d: 1 x: 2 } c: [1] }
And an update message:
f { b { d: 10 } c: [2] }
then if the field mask is:
paths: ["f.b", "f.c"]
then the result will be:
f { b { d: 10 x: 2 } c: [1, 2] }
An implementation may provide options to override this default behavior for repeated and message fields.
In order to reset a field's value to the default, the field must be in the mask and set to the default value in the provided resource. Hence, in order to reset all fields of a resource, provide a default instance of the resource and set all fields in the mask, or do not provide a mask as described below.
If a field mask is not present on update, the operation applies to all fields (as if a field mask of all fields has been specified). Note that in the presence of schema evolution, this may mean that fields the client does not know and has therefore not filled into the request will be reset to their default. If this is unwanted behavior, a specific service may require a client to always specify a field mask, producing an error if not.
As with get operations, the location of the resource which describes the updated values in the request message depends on the operation kind. In any case, the effect of the field mask is required to be honored by the API.
## Considerations for HTTP REST
The HTTP kind of an update operation which uses a field mask must be set to PATCH instead of PUT in order to satisfy HTTP semantics (PUT must only be used for full updates).
JSON Encoding of Field Masks ¶
In JSON, a field mask is encoded as a single string where paths are separated by a comma. Fields name in each path are converted to/from lower-camel naming conventions.
As an example, consider the following message declarations:
message Profile { User user = 1; Photo photo = 2; } message User { string display_name = 1; string address = 2; }
In proto a field mask for `Profile` may look as such:
mask { paths: "user.display_name" paths: "photo" }
In JSON, the same mask is represented as below:
{ mask: "user.displayName,photo" }
Field Masks and Oneof Fields ¶
Field masks treat fields in oneofs just as regular fields. Consider the following message:
message SampleMessage { oneof test_oneof { string name = 4; SubMessage sub_message = 9; } }
The field mask can be:
mask { paths: "name" }
Or:
mask { paths: "sub_message" }
Note that oneof type names ("test_oneof" in this case) cannot be used in paths.
## Field Mask Verification
The implementation of any API method which has a FieldMask type field in the request should verify the included field paths, and return an `INVALID_ARGUMENT` error if any path is unmappable.
swagger:model google.protobuf.FieldMask
func (*GoogleProtobufFieldMask) MarshalBinary ¶ added in v0.5.0
func (m *GoogleProtobufFieldMask) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*GoogleProtobufFieldMask) UnmarshalBinary ¶ added in v0.5.0
func (m *GoogleProtobufFieldMask) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
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). Each `Status` message contains three pieces of data: error code, error message, and error details.
You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
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
type GrpcGatewayRuntimeError ¶ added in v0.5.0
type GrpcGatewayRuntimeError struct { // code Code int32 `json:"code,omitempty"` // details Details []*GoogleProtobufAny `json:"details"` // error Error string `json:"error,omitempty"` // message Message string `json:"message,omitempty"` }
GrpcGatewayRuntimeError grpc gateway runtime error
swagger:model grpc.gateway.runtime.Error
func (*GrpcGatewayRuntimeError) MarshalBinary ¶ added in v0.5.0
func (m *GrpcGatewayRuntimeError) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*GrpcGatewayRuntimeError) UnmarshalBinary ¶ added in v0.5.0
func (m *GrpcGatewayRuntimeError) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
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
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
type HashicorpCloudCommonSortingRequest ¶ added in v0.12.0
type HashicorpCloudCommonSortingRequest struct { // Specifies the list of per field ordering that should be used for sorting. // The order matters as rows are sorted in order by fields and when the field // matches, the next field is used to tie break the ordering. // The per field default ordering is ascending. // // The fields should be immutabile, unique, and orderable. If the field is // not unique, more than one sort fields should be passed. // // Example: oder_by=name,age desc,created_at asc // In that case, 'name' will get the default 'ascending' order. OrderBy []string `json:"order_by"` }
HashicorpCloudCommonSortingRequest SortingRequest are the parameters for a sorted list request.
swagger:model hashicorp.cloud.common.SortingRequest
func (*HashicorpCloudCommonSortingRequest) MarshalBinary ¶ added in v0.12.0
func (m *HashicorpCloudCommonSortingRequest) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*HashicorpCloudCommonSortingRequest) UnmarshalBinary ¶ added in v0.12.0
func (m *HashicorpCloudCommonSortingRequest) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type HashicorpCloudLocationLink ¶
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
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
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
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
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" )
Source Files ¶
- google_protobuf_any.go
- google_protobuf_field_mask.go
- google_rpc_status.go
- grpc_gateway_runtime_error.go
- hashicorp_cloud_common_pagination_request.go
- hashicorp_cloud_common_pagination_response.go
- hashicorp_cloud_common_sorting_request.go
- hashicorp_cloud_location_link.go
- hashicorp_cloud_location_location.go
- hashicorp_cloud_location_region.go
- hashicorp_cloud_operation_operation.go
- hashicorp_cloud_operation_operation_state.go