Help us shape the future of Go! Take the 2026 Go Developer Survey

annotations

package
v0.1.331 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package annotations contains the GRPC client and server definitions for implementing Auth interactions for the Console.

Example (EventAttributesCustomer)

Example demonstrates creating EventAttributes for customer-facing events.

package main

import (
	"fmt"

	"chainguard.dev/sdk/proto/annotations"
)

func main() {
	attrs := &annotations.EventAttributes{
		Type:       "dev.chainguard.api.iam.group.created.v1",
		Extensions: []string{"actor", "group"},
		Audience:   annotations.EventAttributes_CUSTOMER,
	}
	fmt.Printf("Event type: %s, Audience: %s, Extensions: %d\n",
		attrs.GetType(), attrs.GetAudience(), len(attrs.GetExtensions()))
}
Output:
Event type: dev.chainguard.api.iam.group.created.v1, Audience: CUSTOMER, Extensions: 2
Example (EventAttributesInternal)

Example demonstrates creating EventAttributes for internal events.

package main

import (
	"fmt"

	"chainguard.dev/sdk/proto/annotations"
)

func main() {
	attrs := &annotations.EventAttributes{
		Type:       "dev.chainguard.api.platform.created.v1",
		Extensions: []string{"subject", "source"},
		Audience:   annotations.EventAttributes_INTERNAL,
	}
	fmt.Printf("Event type: %s, Audience: %s\n", attrs.GetType(), attrs.GetAudience())
}
Output:
Event type: dev.chainguard.api.platform.created.v1, Audience: INTERNAL
Example (IamDisabled)

Example demonstrates creating an IAM annotation with disabled mode.

package main

import (
	"fmt"

	"chainguard.dev/sdk/proto/annotations"
	"google.golang.org/protobuf/types/known/emptypb"
)

func main() {
	iam := &annotations.IAM{
		Mode: &annotations.IAM_Disabled{
			Disabled: &emptypb.Empty{},
		},
	}
	fmt.Printf("IAM disabled: %v\n", iam.GetDisabled() != nil)
}
Output:
IAM disabled: true
Example (IamEnabled)

Example demonstrates creating an IAM annotation with enabled mode and rules.

package main

import (
	"fmt"

	"chainguard.dev/sdk/proto/annotations"
	"chainguard.dev/sdk/proto/capabilities"
)

func main() {
	iam := &annotations.IAM{
		Mode: &annotations.IAM_Enabled{
			Enabled: &annotations.IAM_Rules{
				Capabilities: []capabilities.Capability{
					capabilities.Capability_CAP_IAM_GROUPS_LIST,
				},
				Unscoped: false,
			},
		},
	}
	rules := iam.GetEnabled()
	fmt.Printf("IAM enabled with %d capabilities\n", len(rules.GetCapabilities()))
}
Output:
IAM enabled with 1 capabilities
Example (IamRulesUnscoped)

Example demonstrates creating an IAM Rules annotation with unscoped access.

package main

import (
	"fmt"

	"chainguard.dev/sdk/proto/annotations"
	"chainguard.dev/sdk/proto/capabilities"
)

func main() {
	rules := &annotations.IAM_Rules{
		Capabilities: []capabilities.Capability{
			capabilities.Capability_CAP_IAM_GROUPS_LIST,
			capabilities.Capability_CAP_IAM_GROUPS_CREATE,
		},
		Unscoped: true,
	}
	fmt.Printf("Unscoped: %v, Capabilities: %d\n", rules.GetUnscoped(), len(rules.GetCapabilities()))
}
Output:
Unscoped: true, Capabilities: 2

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	EventAttributes_Audience_name = map[int32]string{
		0: "INTERNAL",
		1: "CUSTOMER",
	}
	EventAttributes_Audience_value = map[string]int32{
		"INTERNAL": 0,
		"CUSTOMER": 1,
	}
)

Enum value maps for EventAttributes_Audience.

View Source
var (
	// optional chainguard.annotations.EventAttributes events = 401635080;
	E_Events = &file_events_proto_extTypes[0] // randomly chosen
)

Extension fields to descriptorpb.MethodOptions.

View Source
var (
	// optional chainguard.annotations.IAM iam = 189350641;
	E_Iam = &file_auth_proto_extTypes[0] // randomly chosen
)

Extension fields to descriptorpb.MethodOptions.

View Source
var (
	// optional bool iam_scope = 189350642;
	E_IamScope = &file_auth_proto_extTypes[1] // one more than above
)

Extension fields to descriptorpb.FieldOptions.

View Source
var (
	// optional chainguard.annotations.MCP mcp = 189350643;
	E_Mcp = &file_mcp_proto_extTypes[0]
)

Extension fields to descriptorpb.MethodOptions.

View Source
var File_events_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type EventAttributes

type EventAttributes struct {

	// type is the cloudevent type to use for the outbound event.
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// extensions lists which extensions
	Extensions []string `protobuf:"bytes,2,rep,name=extensions,proto3" json:"extensions,omitempty"`
	// audience is the intended audience for the event.
	Audience EventAttributes_Audience `protobuf:"varint,3,opt,name=audience,proto3,enum=chainguard.annotations.EventAttributes_Audience" json:"audience,omitempty"`
	// contains filtered or unexported fields
}

func (*EventAttributes) Descriptor deprecated

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

Deprecated: Use EventAttributes.ProtoReflect.Descriptor instead.

func (*EventAttributes) GetAudience

func (x *EventAttributes) GetAudience() EventAttributes_Audience

func (*EventAttributes) GetExtensions

func (x *EventAttributes) GetExtensions() []string

func (*EventAttributes) GetType

func (x *EventAttributes) GetType() string

func (*EventAttributes) ProtoMessage

func (*EventAttributes) ProtoMessage()

func (*EventAttributes) ProtoReflect

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

func (*EventAttributes) Reset

func (x *EventAttributes) Reset()

func (*EventAttributes) String

func (x *EventAttributes) String() string

type EventAttributes_Audience

type EventAttributes_Audience int32
const (
	// intended for inside the bounds of the platform.
	EventAttributes_INTERNAL EventAttributes_Audience = 0
	// allowed to be sent outside the platform.
	EventAttributes_CUSTOMER EventAttributes_Audience = 1
)

func (EventAttributes_Audience) Descriptor

func (EventAttributes_Audience) Enum

func (EventAttributes_Audience) EnumDescriptor deprecated

func (EventAttributes_Audience) EnumDescriptor() ([]byte, []int)

Deprecated: Use EventAttributes_Audience.Descriptor instead.

func (EventAttributes_Audience) Number

func (EventAttributes_Audience) String

func (x EventAttributes_Audience) String() string

func (EventAttributes_Audience) Type

type IAM

type IAM struct {

	// Types that are valid to be assigned to Mode:
	//
	//	*IAM_Disabled
	//	*IAM_Enabled
	Mode isIAM_Mode `protobuf_oneof:"mode"`
	// contains filtered or unexported fields
}

func (*IAM) Descriptor deprecated

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

Deprecated: Use IAM.ProtoReflect.Descriptor instead.

func (*IAM) GetDisabled

func (x *IAM) GetDisabled() *emptypb.Empty

func (*IAM) GetEnabled

func (x *IAM) GetEnabled() *IAM_Rules

func (*IAM) GetMode

func (x *IAM) GetMode() isIAM_Mode

func (*IAM) ProtoMessage

func (*IAM) ProtoMessage()

func (*IAM) ProtoReflect

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

func (*IAM) Reset

func (x *IAM) Reset()

func (*IAM) String

func (x *IAM) String() string

type IAM_Disabled

type IAM_Disabled struct {
	Disabled *emptypb.Empty `protobuf:"bytes,1,opt,name=disabled,proto3,oneof"`
}

type IAM_Enabled

type IAM_Enabled struct {
	Enabled *IAM_Rules `protobuf:"bytes,2,opt,name=enabled,proto3,oneof"`
}

type IAM_Rules

type IAM_Rules struct {

	// A list of capabilities required by a particular API.
	// This field is either scoped or unscoped, as determined
	// by the field below.
	//  * When it is "scoped", this field is combined with the
	//    field designated by "(iam_scope) = true" (see below)
	//    on the request message to indicate what capabilities
	//    the caller needs at what scope in order to authorize
	//    the action they are performing.
	//  * When is it "unscoped", this field is used to determine
	//    the set of scopes the caller has the appropriate access
	//    to so that the RPC itself can scope down the results
	//    it returns.
	Capabilities []capabilities.Capability `protobuf:"varint,1,rep,packed,name=capabilities,proto3,enum=chainguard.capabilities.Capability" json:"capabilities,omitempty"`
	// Unscoped is set on APIs where the request itself doesn't
	// carry a field with "iam_scope", and instead scopes itself
	// to the set of groups to which the caller has access
	// according to their OIDC token.
	Unscoped bool `protobuf:"varint,2,opt,name=unscoped,proto3" json:"unscoped,omitempty"`
	// contains filtered or unexported fields
}

func (*IAM_Rules) Descriptor deprecated

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

Deprecated: Use IAM_Rules.ProtoReflect.Descriptor instead.

func (*IAM_Rules) GetCapabilities

func (x *IAM_Rules) GetCapabilities() []capabilities.Capability

func (*IAM_Rules) GetUnscoped

func (x *IAM_Rules) GetUnscoped() bool

func (*IAM_Rules) ProtoMessage

func (*IAM_Rules) ProtoMessage()

func (*IAM_Rules) ProtoReflect

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

func (*IAM_Rules) Reset

func (x *IAM_Rules) Reset()

func (*IAM_Rules) String

func (x *IAM_Rules) String() string

type MCP added in v0.1.54

type MCP struct {

	// Human-readable description surfaced as the MCP tool description.
	Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"`
	// When true, the method is excluded from the MCP tool surface.
	Hidden bool `protobuf:"varint,2,opt,name=hidden,proto3" json:"hidden,omitempty"`
	// Tool does not modify any state (e.g. Get, List).
	ReadOnly bool `protobuf:"varint,3,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"`
	// Tool may cause irreversible changes (e.g. Delete).
	// Optional: unset means "assume destructive" per MCP spec.
	Destructive *bool `protobuf:"varint,4,opt,name=destructive,proto3,oneof" json:"destructive,omitempty"`
	// Repeated calls with the same arguments have the same effect as one call.
	Idempotent bool `protobuf:"varint,5,opt,name=idempotent,proto3" json:"idempotent,omitempty"`
	// Tool interacts with external systems beyond the immediate context.
	// Optional: unset means "assume open-world" per MCP spec.
	OpenWorld *bool `protobuf:"varint,6,opt,name=open_world,json=openWorld,proto3,oneof" json:"open_world,omitempty"`
	// contains filtered or unexported fields
}

func (*MCP) Descriptor deprecated added in v0.1.54

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

Deprecated: Use MCP.ProtoReflect.Descriptor instead.

func (*MCP) GetDescription added in v0.1.54

func (x *MCP) GetDescription() string

func (*MCP) GetDestructive added in v0.1.54

func (x *MCP) GetDestructive() bool

func (*MCP) GetHidden added in v0.1.54

func (x *MCP) GetHidden() bool

func (*MCP) GetIdempotent added in v0.1.54

func (x *MCP) GetIdempotent() bool

func (*MCP) GetOpenWorld added in v0.1.54

func (x *MCP) GetOpenWorld() bool

func (*MCP) GetReadOnly added in v0.1.54

func (x *MCP) GetReadOnly() bool

func (*MCP) ProtoMessage added in v0.1.54

func (*MCP) ProtoMessage()

func (*MCP) ProtoReflect added in v0.1.54

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

func (*MCP) Reset added in v0.1.54

func (x *MCP) Reset()

func (*MCP) String added in v0.1.54

func (x *MCP) String() string

Jump to

Keyboard shortcuts

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