v1

package
v0.89.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: Apache-2.0 Imports: 23 Imported by: 3

Documentation

Overview

Package v1 contains the API of Metrics services.

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
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"
)
View Source
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"
)
View Source
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 = 2
	// APIPatchVersion contains patch version of this API
	APIPatchVersion = 0
)
View Source
const (
	// KindToken is a constants for the kind of metric token resources.
	KindToken = "Token"
)
View Source
const (

	// PermissionEndpointGet is needed for fetching the metrics endpoint for a deployment
	PermissionEndpointGet = "metrics.endpoint.get"
)

Variables

View Source
var File_metrics_proto protoreflect.FileDescriptor

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. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMetricsServiceHandlerFromEndpoint instead.

func RegisterMetricsServiceServer

func RegisterMetricsServiceServer(s *grpc.Server, srv MetricsServiceServer)

func TokenURL

func TokenURL(organizationID, projectID, deploymentID, tokenID string) string

TokenURL creates a resource URL for the token with given ID in given context.

func TokenURL2

func TokenURL2(deploymentURL, tokenID string) string

TokenURL2 creates a resource URL for the token with given ID in given context.

Types

type GetMetricsEndpointRequest added in v0.59.0

type GetMetricsEndpointRequest struct {

	// ID of the deployment to get the endpoint for.
	DeploymentId string `protobuf:"bytes,1,opt,name=deployment_id,json=deploymentId,proto3" json:"deployment_id,omitempty"`
	// contains filtered or unexported fields
}

Request arguments for GetMetricsEndpoint

func (*GetMetricsEndpointRequest) Descriptor deprecated added in v0.59.0

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

Deprecated: Use GetMetricsEndpointRequest.ProtoReflect.Descriptor instead.

func (*GetMetricsEndpointRequest) GetDeploymentId added in v0.59.0

func (x *GetMetricsEndpointRequest) GetDeploymentId() string

func (*GetMetricsEndpointRequest) ProtoMessage added in v0.59.0

func (*GetMetricsEndpointRequest) ProtoMessage()

func (*GetMetricsEndpointRequest) ProtoReflect added in v0.89.0

func (*GetMetricsEndpointRequest) Reset added in v0.59.0

func (x *GetMetricsEndpointRequest) Reset()

func (*GetMetricsEndpointRequest) String added in v0.59.0

func (x *GetMetricsEndpointRequest) String() string

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"`
	// If set, do not return expired tokens.
	ExcludeExpired bool `protobuf:"varint,4,opt,name=exclude_expired,json=excludeExpired,proto3" json:"exclude_expired,omitempty"`
	// If set, do not return deleted (marked for deletion) tokens.
	ExcludeDeleted bool `protobuf:"varint,5,opt,name=exclude_deleted,json=excludeDeleted,proto3" json:"exclude_deleted,omitempty"`
	// contains filtered or unexported fields
}

Request arguments for ListTokens.

func (*ListTokensRequest) Descriptor deprecated

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

Deprecated: Use ListTokensRequest.ProtoReflect.Descriptor instead.

func (*ListTokensRequest) GetDeploymentId

func (x *ListTokensRequest) GetDeploymentId() string

func (*ListTokensRequest) GetExcludeDeleted added in v0.59.0

func (x *ListTokensRequest) GetExcludeDeleted() bool

func (*ListTokensRequest) GetExcludeExpired added in v0.59.0

func (x *ListTokensRequest) GetExcludeExpired() bool

func (*ListTokensRequest) GetExcludeRevoked

func (x *ListTokensRequest) GetExcludeRevoked() bool

func (*ListTokensRequest) GetOptions

func (x *ListTokensRequest) GetOptions() *v1.ListOptions

func (*ListTokensRequest) ProtoMessage

func (*ListTokensRequest) ProtoMessage()

func (*ListTokensRequest) ProtoReflect added in v0.89.0

func (x *ListTokensRequest) ProtoReflect() protoreflect.Message

func (*ListTokensRequest) Reset

func (x *ListTokensRequest) Reset()

func (*ListTokensRequest) String

func (x *ListTokensRequest) String() string

type MetricsEndpoint added in v0.59.0

type MetricsEndpoint struct {

	// Endpoint (url) to get metrics from.
	// If no valid metrics tokens are configured this field is empty.
	Endpoint string `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	// Endpoint URL used to reach the metrics server with self signed certificate on port 18829
	// If no valid metrics tokens are configured this field is empty.
	EndpointSelfSigned string `protobuf:"bytes,2,opt,name=endpoint_self_signed,json=endpointSelfSigned,proto3" json:"endpoint_self_signed,omitempty"`
	// Endpoint URL used to reach the metrics server on default port 443
	// If no valid metrics tokens are configured this field is empty.
	// This endpoint is recommended for human-to-metrics-server connections.
	EndpointDefault string `protobuf:"bytes,3,opt,name=endpoint_default,json=endpointDefault,proto3" json:"endpoint_default,omitempty"`
	// contains filtered or unexported fields
}

Response for GetMetricsEndpoint

func (*MetricsEndpoint) Descriptor deprecated added in v0.59.0

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

Deprecated: Use MetricsEndpoint.ProtoReflect.Descriptor instead.

func (*MetricsEndpoint) GetEndpoint added in v0.59.0

func (x *MetricsEndpoint) GetEndpoint() string

func (*MetricsEndpoint) GetEndpointDefault added in v0.81.2

func (x *MetricsEndpoint) GetEndpointDefault() string

func (*MetricsEndpoint) GetEndpointSelfSigned added in v0.81.2

func (x *MetricsEndpoint) GetEndpointSelfSigned() string

func (*MetricsEndpoint) ProtoMessage added in v0.59.0

func (*MetricsEndpoint) ProtoMessage()

func (*MetricsEndpoint) ProtoReflect added in v0.89.0

func (x *MetricsEndpoint) ProtoReflect() protoreflect.Message

func (*MetricsEndpoint) Reset added in v0.59.0

func (x *MetricsEndpoint) Reset()

func (*MetricsEndpoint) String added in v0.59.0

func (x *MetricsEndpoint) String() string

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)
	// Fetch the endpoint to use for getting metrics for a deployment with given id.
	// Required permissions:
	// - metrics.endpoint.get on the deployment identified by the given ID
	GetMetricsEndpoint(ctx context.Context, in *GetMetricsEndpointRequest, opts ...grpc.CallOption) (*MetricsEndpoint, 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.

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)
	// Fetch the endpoint to use for getting metrics for a deployment with given id.
	// Required permissions:
	// - metrics.endpoint.get on the deployment identified by the given ID
	GetMetricsEndpoint(context.Context, *GetMetricsEndpointRequest) (*MetricsEndpoint, 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 *durationpb.Duration `protobuf:"bytes,6,opt,name=lifetime,proto3" json:"lifetime,omitempty"`
	// The creation timestamp of the token.
	// This is a read-only value.
	CreatedAt *timestamppb.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 *timestamppb.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 *timestamppb.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"`
	// contains filtered or unexported fields
}

A Token is represents an access token used to authenticate requests for metrics.

func (*Token) Descriptor deprecated

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

Deprecated: Use Token.ProtoReflect.Descriptor instead.

func (*Token) GetCreatedAt

func (x *Token) GetCreatedAt() *timestamppb.Timestamp

func (*Token) GetDeletedAt

func (x *Token) GetDeletedAt() *timestamppb.Timestamp

func (*Token) GetDeploymentId

func (x *Token) GetDeploymentId() string

func (*Token) GetDescription

func (x *Token) GetDescription() string

func (*Token) GetExpiresAt

func (x *Token) GetExpiresAt() *timestamppb.Timestamp

func (*Token) GetId

func (x *Token) GetId() string

func (*Token) GetIsDeleted

func (x *Token) GetIsDeleted() bool

func (*Token) GetIsExpired

func (x *Token) GetIsExpired() bool

func (*Token) GetIsRevoked

func (x *Token) GetIsRevoked() bool

func (*Token) GetLifetime

func (x *Token) GetLifetime() *durationpb.Duration

func (*Token) GetName

func (x *Token) GetName() string

func (*Token) GetToken

func (x *Token) GetToken() string

func (*Token) GetUrl

func (x *Token) GetUrl() string

func (*Token) GetWillExpireSoon

func (x *Token) GetWillExpireSoon() bool

func (*Token) ProtoMessage

func (*Token) ProtoMessage()

func (*Token) ProtoReflect added in v0.89.0

func (x *Token) ProtoReflect() protoreflect.Message

func (*Token) Reset

func (x *Token) Reset()

func (*Token) String

func (x *Token) String() string

type TokenCallback

type TokenCallback func(context.Context, *Token) error

TokenCallback is a callback for individual tokens.

type TokenList

type TokenList struct {
	Items []*Token `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	// contains filtered or unexported fields
}

List of Tokens.

func (*TokenList) Descriptor deprecated

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

Deprecated: Use TokenList.ProtoReflect.Descriptor instead.

func (*TokenList) GetItems

func (x *TokenList) GetItems() []*Token

func (*TokenList) ProtoMessage

func (*TokenList) ProtoMessage()

func (*TokenList) ProtoReflect added in v0.89.0

func (x *TokenList) ProtoReflect() protoreflect.Message

func (*TokenList) Reset

func (x *TokenList) Reset()

func (*TokenList) String

func (x *TokenList) String() string

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) GetMetricsEndpoint added in v0.59.0

func (*UnimplementedMetricsServiceServer) GetToken

func (*UnimplementedMetricsServiceServer) ListTokens

func (*UnimplementedMetricsServiceServer) RevokeToken

func (*UnimplementedMetricsServiceServer) UpdateToken

Jump to

Keyboard shortcuts

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