Documentation ¶
Overview ¶
Package metrics/v1 contains the API of Metrics services.
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func ForEachToken(ctx context.Context, ...) error
- func RegisterMetricsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterMetricsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MetricsServiceClient) error
- func RegisterMetricsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterMetricsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MetricsServiceServer) error
- func RegisterMetricsServiceServer(s *grpc.Server, srv MetricsServiceServer)
- func TokenURL(organizationID, projectID, deploymentID, tokenID string) string
- func TokenURL2(deploymentURL, tokenID string) string
- type ListTokensRequest
- func (*ListTokensRequest) Descriptor() ([]byte, []int)
- func (m *ListTokensRequest) GetDeploymentId() string
- func (m *ListTokensRequest) GetExcludeRevoked() bool
- func (m *ListTokensRequest) GetOptions() *v1.ListOptions
- func (m *ListTokensRequest) Marshal() (dAtA []byte, err error)
- func (m *ListTokensRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *ListTokensRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ListTokensRequest) ProtoMessage()
- func (m *ListTokensRequest) Reset()
- func (m *ListTokensRequest) Size() (n int)
- func (m *ListTokensRequest) String() string
- func (m *ListTokensRequest) Unmarshal(dAtA []byte) error
- func (m *ListTokensRequest) XXX_DiscardUnknown()
- func (m *ListTokensRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ListTokensRequest) XXX_Merge(src proto.Message)
- func (m *ListTokensRequest) XXX_Size() int
- func (m *ListTokensRequest) XXX_Unmarshal(b []byte) error
- type MetricsServiceClient
- type MetricsServiceServer
- type Token
- func (*Token) Descriptor() ([]byte, []int)
- func (m *Token) GetCreatedAt() *types.Timestamp
- func (m *Token) GetDeletedAt() *types.Timestamp
- func (m *Token) GetDeploymentId() string
- func (m *Token) GetDescription() string
- func (m *Token) GetExpiresAt() *types.Timestamp
- func (m *Token) GetId() string
- func (m *Token) GetIsDeleted() bool
- func (m *Token) GetIsExpired() bool
- func (m *Token) GetIsRevoked() bool
- func (m *Token) GetLifetime() *types.Duration
- func (m *Token) GetName() string
- func (m *Token) GetToken() string
- func (m *Token) GetUrl() string
- func (m *Token) GetWillExpireSoon() bool
- func (m *Token) Marshal() (dAtA []byte, err error)
- func (m *Token) MarshalTo(dAtA []byte) (int, error)
- func (m *Token) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Token) ProtoMessage()
- func (m *Token) Reset()
- func (m *Token) Size() (n int)
- func (m *Token) String() string
- func (m *Token) Unmarshal(dAtA []byte) error
- func (m *Token) XXX_DiscardUnknown()
- func (m *Token) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Token) XXX_Merge(src proto.Message)
- func (m *Token) XXX_Size() int
- func (m *Token) XXX_Unmarshal(b []byte) error
- type TokenCallback
- type TokenList
- func (*TokenList) Descriptor() ([]byte, []int)
- func (m *TokenList) GetItems() []*Token
- func (m *TokenList) Marshal() (dAtA []byte, err error)
- func (m *TokenList) MarshalTo(dAtA []byte) (int, error)
- func (m *TokenList) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*TokenList) ProtoMessage()
- func (m *TokenList) Reset()
- func (m *TokenList) Size() (n int)
- func (m *TokenList) String() string
- func (m *TokenList) Unmarshal(dAtA []byte) error
- func (m *TokenList) XXX_DiscardUnknown()
- func (m *TokenList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TokenList) XXX_Merge(src proto.Message)
- func (m *TokenList) XXX_Size() int
- func (m *TokenList) XXX_Unmarshal(b []byte) error
- type UnimplementedMetricsServiceServer
- func (*UnimplementedMetricsServiceServer) CreateToken(ctx context.Context, req *Token) (*Token, error)
- func (*UnimplementedMetricsServiceServer) DeleteToken(ctx context.Context, req *v1.IDOptions) (*v1.Empty, error)
- func (*UnimplementedMetricsServiceServer) GetAPIVersion(ctx context.Context, req *v1.Empty) (*v1.Version, error)
- func (*UnimplementedMetricsServiceServer) GetToken(ctx context.Context, req *v1.IDOptions) (*Token, error)
- func (*UnimplementedMetricsServiceServer) ListTokens(ctx context.Context, req *ListTokensRequest) (*TokenList, error)
- func (*UnimplementedMetricsServiceServer) RevokeToken(ctx context.Context, req *v1.IDOptions) (*v1.Empty, error)
- func (*UnimplementedMetricsServiceServer) UpdateToken(ctx context.Context, req *Token) (*Token, error)
Constants ¶
const ( // EventTypeTokenCreated is the type of event fired after a metrics token has been created // SubjectID contains the ID of the token. EventTypeTokenCreated = "metrics.token.created" // EventTypeTokenUpdated is the type of event fired after a metrics token has been updated // SubjectID contains the ID of the token. EventTypeTokenUpdated = "metrics.token.updated" // EventTypeTokenDeleted is the type of event fired after a metrics token has been (marked for) deleted // SubjectID contains the ID of the token. EventTypeTokenDeleted = "metrics.token.deleted" )
const ( // PermissionTokenList is needed for listing metrics tokens in a deployment PermissionTokenList = "metrics.token.list" // PermissionTokenGet is needed for fetching an individual metrics token in a deployment PermissionTokenGet = "metrics.token.get" // PermissionTokenCreate is needed for create a metrics token PermissionTokenCreate = "metrics.token.create" // PermissionTokenUpdate is needed for updating a metrics token PermissionTokenUpdate = "metrics.token.update" // PermissionTokenRevoke is needed for revoking a metrics token PermissionTokenRevoke = "metrics.token.revoke" // PermissionTokenDelete is needed for deleting a metrics token PermissionTokenDelete = "metrics.token.delete" )
const ( // APIID contains identifier of this API APIID = "metrics/v1" // APIMajorVersion contains major version of this API APIMajorVersion = 1 // APIMinorVersion contains minor version of this API APIMinorVersion = 0 // APIPatchVersion contains patch version of this API APIPatchVersion = 0 )
const (
// KindToken is a constants for the kind of metric token resources.
KindToken = "Token"
)
Variables ¶
var ( ErrInvalidLengthMetrics = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowMetrics = fmt.Errorf("proto: integer overflow") )
Functions ¶
func ForEachToken ¶
func ForEachToken(ctx context.Context, listFunc func(ctx context.Context, req *ListTokensRequest) (*TokenList, error), opts ListTokensRequest, cb TokenCallback) error
ForEachToken iterates over all metrics tokens in the deployment identified by the given context ID, invoking the given callback for each certificate.
func RegisterMetricsServiceHandler ¶
func RegisterMetricsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterMetricsServiceHandler registers the http handlers for service MetricsService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterMetricsServiceHandlerClient ¶
func RegisterMetricsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MetricsServiceClient) error
RegisterMetricsServiceHandlerClient registers the http handlers for service MetricsService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MetricsServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MetricsServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "MetricsServiceClient" to call the correct interceptors.
func RegisterMetricsServiceHandlerFromEndpoint ¶
func RegisterMetricsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterMetricsServiceHandlerFromEndpoint is same as RegisterMetricsServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterMetricsServiceHandlerServer ¶
func RegisterMetricsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MetricsServiceServer) error
RegisterMetricsServiceHandlerServer registers the http handlers for service MetricsService to "mux". UnaryRPC :call MetricsServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
func RegisterMetricsServiceServer ¶
func RegisterMetricsServiceServer(s *grpc.Server, srv MetricsServiceServer)
Types ¶
type ListTokensRequest ¶
type ListTokensRequest struct { // Common list options. // Context_id is ignored. Options *v1.ListOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` // Required ID of deployment to list tokens for. DeploymentId string `protobuf:"bytes,2,opt,name=deployment_id,json=deploymentId,proto3" json:"deployment_id,omitempty"` // If set, do not return revoked tokens. ExcludeRevoked bool `protobuf:"varint,3,opt,name=exclude_revoked,json=excludeRevoked,proto3" json:"exclude_revoked,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Request arguments for ListTokens.
func (*ListTokensRequest) Descriptor ¶
func (*ListTokensRequest) Descriptor() ([]byte, []int)
func (*ListTokensRequest) GetDeploymentId ¶
func (m *ListTokensRequest) GetDeploymentId() string
func (*ListTokensRequest) GetExcludeRevoked ¶
func (m *ListTokensRequest) GetExcludeRevoked() bool
func (*ListTokensRequest) GetOptions ¶
func (m *ListTokensRequest) GetOptions() *v1.ListOptions
func (*ListTokensRequest) Marshal ¶
func (m *ListTokensRequest) Marshal() (dAtA []byte, err error)
func (*ListTokensRequest) MarshalTo ¶
func (m *ListTokensRequest) MarshalTo(dAtA []byte) (int, error)
func (*ListTokensRequest) MarshalToSizedBuffer ¶
func (m *ListTokensRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ListTokensRequest) ProtoMessage ¶
func (*ListTokensRequest) ProtoMessage()
func (*ListTokensRequest) Reset ¶
func (m *ListTokensRequest) Reset()
func (*ListTokensRequest) Size ¶
func (m *ListTokensRequest) Size() (n int)
func (*ListTokensRequest) String ¶
func (m *ListTokensRequest) String() string
func (*ListTokensRequest) Unmarshal ¶
func (m *ListTokensRequest) Unmarshal(dAtA []byte) error
func (*ListTokensRequest) XXX_DiscardUnknown ¶
func (m *ListTokensRequest) XXX_DiscardUnknown()
func (*ListTokensRequest) XXX_Marshal ¶
func (m *ListTokensRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ListTokensRequest) XXX_Merge ¶
func (m *ListTokensRequest) XXX_Merge(src proto.Message)
func (*ListTokensRequest) XXX_Size ¶
func (m *ListTokensRequest) XXX_Size() int
func (*ListTokensRequest) XXX_Unmarshal ¶
func (m *ListTokensRequest) XXX_Unmarshal(b []byte) error
type MetricsServiceClient ¶
type MetricsServiceClient interface { // Get the current API version of this service. // Required permissions: // - None GetAPIVersion(ctx context.Context, in *v1.Empty, opts ...grpc.CallOption) (*v1.Version, error) // Fetch all metrics token in the deployment identified by the given deployment ID. // Required permissions: // - metrics.token.list on the deployment identified by the given deployment ID ListTokens(ctx context.Context, in *ListTokensRequest, opts ...grpc.CallOption) (*TokenList, error) // Fetch a metrics token by its id. // Required permissions: // - metrics.token.get on the token identified by the given ID GetToken(ctx context.Context, in *v1.IDOptions, opts ...grpc.CallOption) (*Token, error) // Create a new metrics token. // Required permissions: // - metrics.token.create on the deployment that owns the token CreateToken(ctx context.Context, in *Token, opts ...grpc.CallOption) (*Token, error) // Update a metrics token. // Note that you can only change the metadata (name & description) of the // token. // Required permissions: // - metrics.token.update on the token UpdateToken(ctx context.Context, in *Token, opts ...grpc.CallOption) (*Token, error) // Revoke a metrics token. // Once a token is revoked, it can no longer be used for authentication. // Required permissions: // - metrics.token.revoke on the token RevokeToken(ctx context.Context, in *v1.IDOptions, opts ...grpc.CallOption) (*v1.Empty, error) // Delete a metrics token. // Note that token are initially only marked for deleted. // Once all the resources that depend on it are removed the token itself is deleted // and cannot be restored. // Required permissions: // - metrics.token.delete on the token DeleteToken(ctx context.Context, in *v1.IDOptions, opts ...grpc.CallOption) (*v1.Empty, error) }
MetricsServiceClient is the client API for MetricsService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewMetricsServiceClient ¶
func NewMetricsServiceClient(cc *grpc.ClientConn) MetricsServiceClient
type MetricsServiceServer ¶
type MetricsServiceServer interface { // Get the current API version of this service. // Required permissions: // - None GetAPIVersion(context.Context, *v1.Empty) (*v1.Version, error) // Fetch all metrics token in the deployment identified by the given deployment ID. // Required permissions: // - metrics.token.list on the deployment identified by the given deployment ID ListTokens(context.Context, *ListTokensRequest) (*TokenList, error) // Fetch a metrics token by its id. // Required permissions: // - metrics.token.get on the token identified by the given ID GetToken(context.Context, *v1.IDOptions) (*Token, error) // Create a new metrics token. // Required permissions: // - metrics.token.create on the deployment that owns the token CreateToken(context.Context, *Token) (*Token, error) // Update a metrics token. // Note that you can only change the metadata (name & description) of the // token. // Required permissions: // - metrics.token.update on the token UpdateToken(context.Context, *Token) (*Token, error) // Revoke a metrics token. // Once a token is revoked, it can no longer be used for authentication. // Required permissions: // - metrics.token.revoke on the token RevokeToken(context.Context, *v1.IDOptions) (*v1.Empty, error) // Delete a metrics token. // Note that token are initially only marked for deleted. // Once all the resources that depend on it are removed the token itself is deleted // and cannot be restored. // Required permissions: // - metrics.token.delete on the token DeleteToken(context.Context, *v1.IDOptions) (*v1.Empty, error) }
MetricsServiceServer is the server API for MetricsService service.
type Token ¶
type Token struct { // System identifier of the token. // This is a read-only value. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // URL of this resource // This is a read-only value. Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` // Name of the token Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // Description of the token Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` // Identifier of the deployment that owns this token. // This value cannot be changed after creation. DeploymentId string `protobuf:"bytes,5,opt,name=deployment_id,json=deploymentId,proto3" json:"deployment_id,omitempty"` // Time from creation of the token to expiration. // This value cannot be changed after creation. // If no value is set, a default value of 90 days is used. Lifetime *types.Duration `protobuf:"bytes,6,opt,name=lifetime,proto3" json:"lifetime,omitempty"` // The creation timestamp of the token. // This is a read-only value. CreatedAt *types.Timestamp `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // The deletion timestamp of the token. // This is a read-only value. DeletedAt *types.Timestamp `protobuf:"bytes,8,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"` // The expiration timestamp of the token. // This is a read-only value. ExpiresAt *types.Timestamp `protobuf:"bytes,9,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` // The bearer token used for authentication. // This is a read-only value that is only given directly after // creation of the token. In all other calls, this field // will be empty. Token string `protobuf:"bytes,10,opt,name=token,proto3" json:"token,omitempty"` // Set when this token is deleted. // This is a read-only value. IsDeleted bool `protobuf:"varint,11,opt,name=is_deleted,json=isDeleted,proto3" json:"is_deleted,omitempty"` // Set when this token has expired. // This is a read-only value. IsExpired bool `protobuf:"varint,12,opt,name=is_expired,json=isExpired,proto3" json:"is_expired,omitempty"` // Set when this token will expire in the next month. // This is a read-only value. WillExpireSoon bool `protobuf:"varint,13,opt,name=will_expire_soon,json=willExpireSoon,proto3" json:"will_expire_soon,omitempty"` // Set when this token is revoked. // This is a read-only value. IsRevoked bool `protobuf:"varint,14,opt,name=is_revoked,json=isRevoked,proto3" json:"is_revoked,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A Token is represents an access token used to authenticate requests for metrics.
func (*Token) Descriptor ¶
func (*Token) GetCreatedAt ¶
func (*Token) GetDeletedAt ¶
func (*Token) GetDeploymentId ¶
func (*Token) GetDescription ¶
func (*Token) GetExpiresAt ¶
func (*Token) GetIsDeleted ¶
func (*Token) GetIsExpired ¶
func (*Token) GetIsRevoked ¶
func (*Token) GetLifetime ¶
func (*Token) GetWillExpireSoon ¶
func (*Token) ProtoMessage ¶
func (*Token) ProtoMessage()
func (*Token) XXX_DiscardUnknown ¶
func (m *Token) XXX_DiscardUnknown()
func (*Token) XXX_Marshal ¶
func (*Token) XXX_Unmarshal ¶
type TokenCallback ¶
TokenCallback is a callback for individual tokens.
type TokenList ¶
type TokenList struct { Items []*Token `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
List of Tokens.
func (*TokenList) Descriptor ¶
func (*TokenList) MarshalToSizedBuffer ¶
func (*TokenList) ProtoMessage ¶
func (*TokenList) ProtoMessage()
func (*TokenList) XXX_DiscardUnknown ¶
func (m *TokenList) XXX_DiscardUnknown()
func (*TokenList) XXX_Marshal ¶
func (*TokenList) XXX_Unmarshal ¶
type UnimplementedMetricsServiceServer ¶
type UnimplementedMetricsServiceServer struct { }
UnimplementedMetricsServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedMetricsServiceServer) CreateToken ¶
func (*UnimplementedMetricsServiceServer) DeleteToken ¶
func (*UnimplementedMetricsServiceServer) GetAPIVersion ¶
func (*UnimplementedMetricsServiceServer) ListTokens ¶
func (*UnimplementedMetricsServiceServer) ListTokens(ctx context.Context, req *ListTokensRequest) (*TokenList, error)