Documentation
¶
Overview ¶
Package common contains Chainguard shared types exposed to the console.
Index ¶
- Variables
- type UIDPFilter
- func (*UIDPFilter) Descriptor() ([]byte, []int)deprecated
- func (x *UIDPFilter) GetAncestorsOf() string
- func (x *UIDPFilter) GetChildrenOf() string
- func (x *UIDPFilter) GetDescendantsOf() string
- func (x *UIDPFilter) GetIds() []string
- func (x *UIDPFilter) GetInRoot() bool
- func (*UIDPFilter) ProtoMessage()
- func (x *UIDPFilter) ProtoReflect() protoreflect.Message
- func (x *UIDPFilter) Reset()
- func (x *UIDPFilter) String() string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var File_uidp_platform_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type UIDPFilter ¶
type UIDPFilter struct {
// ancestors_of are groups reachable by repeated proceeding from child to parent.
AncestorsOf string `protobuf:"bytes,1,opt,name=ancestors_of,json=ancestorsOf,proto3" json:"ancestors_of,omitempty"`
// descendants_of are groups reachable by repeated proceeding from parent to child.
DescendantsOf string `protobuf:"bytes,2,opt,name=descendants_of,json=descendantsOf,proto3" json:"descendants_of,omitempty"`
// children_of are groups reachable by directly proceeding from parent to children.
ChildrenOf string `protobuf:"bytes,3,opt,name=children_of,json=childrenOf,proto3" json:"children_of,omitempty"`
// in_root restricts responses to root level resources.
InRoot bool `protobuf:"varint,4,opt,name=in_root,json=inRoot,proto3" json:"in_root,omitempty"`
// ids are a list of exact UIDPs of records.
Ids []string `protobuf:"bytes,5,rep,name=ids,proto3" json:"ids,omitempty"`
// contains filtered or unexported fields
}
Example ¶
ExampleUIDPFilter demonstrates creating a UIDPFilter for filtering by ancestors.
package main
import (
"fmt"
v1 "chainguard.dev/sdk/proto/platform/common/v1"
)
func main() {
filter := &v1.UIDPFilter{
AncestorsOf: "uidp/group/abc123",
}
fmt.Printf("Ancestors of: %s\n", filter.GetAncestorsOf())
}
Output: Ancestors of: uidp/group/abc123
Example (ChildrenOf) ¶
ExampleUIDPFilter_childrenOf demonstrates filtering by direct children.
package main
import (
"fmt"
v1 "chainguard.dev/sdk/proto/platform/common/v1"
)
func main() {
filter := &v1.UIDPFilter{
ChildrenOf: "uidp/group/parent123",
}
fmt.Printf("Children of: %s\n", filter.GetChildrenOf())
}
Output: Children of: uidp/group/parent123
Example (Combined) ¶
ExampleUIDPFilter_combined demonstrates a filter with multiple criteria.
package main
import (
"fmt"
v1 "chainguard.dev/sdk/proto/platform/common/v1"
)
func main() {
filter := &v1.UIDPFilter{
DescendantsOf: "uidp/group/root",
Ids: []string{"uidp/group/specific1", "uidp/group/specific2"},
}
fmt.Printf("Descendants of: %s\n", filter.GetDescendantsOf())
fmt.Printf("Specific IDs: %v\n", filter.GetIds())
}
Output: Descendants of: uidp/group/root Specific IDs: [uidp/group/specific1 uidp/group/specific2]
Example (DescendantsOf) ¶
ExampleUIDPFilter_descendantsOf demonstrates filtering by descendants.
package main
import (
"fmt"
v1 "chainguard.dev/sdk/proto/platform/common/v1"
)
func main() {
filter := &v1.UIDPFilter{
DescendantsOf: "uidp/group/xyz789",
}
fmt.Printf("Descendants of: %s\n", filter.GetDescendantsOf())
}
Output: Descendants of: uidp/group/xyz789
Example (Getters) ¶
ExampleUIDPFilter_getters demonstrates all getter methods on an empty filter.
package main
import (
"fmt"
v1 "chainguard.dev/sdk/proto/platform/common/v1"
)
func main() {
filter := &v1.UIDPFilter{}
fmt.Printf("AncestorsOf: %q\n", filter.GetAncestorsOf())
fmt.Printf("DescendantsOf: %q\n", filter.GetDescendantsOf())
fmt.Printf("ChildrenOf: %q\n", filter.GetChildrenOf())
fmt.Printf("InRoot: %v\n", filter.GetInRoot())
fmt.Printf("Ids: %v\n", filter.GetIds())
}
Output: AncestorsOf: "" DescendantsOf: "" ChildrenOf: "" InRoot: false Ids: []
Example (Ids) ¶
ExampleUIDPFilter_ids demonstrates filtering by specific IDs.
package main
import (
"fmt"
v1 "chainguard.dev/sdk/proto/platform/common/v1"
)
func main() {
filter := &v1.UIDPFilter{
Ids: []string{"uidp/group/id1", "uidp/group/id2", "uidp/group/id3"},
}
fmt.Printf("Number of IDs: %d\n", len(filter.GetIds()))
fmt.Printf("First ID: %s\n", filter.GetIds()[0])
}
Output: Number of IDs: 3 First ID: uidp/group/id1
Example (InRoot) ¶
ExampleUIDPFilter_inRoot demonstrates filtering for root-level resources.
package main
import (
"fmt"
v1 "chainguard.dev/sdk/proto/platform/common/v1"
)
func main() {
filter := &v1.UIDPFilter{
InRoot: true,
}
fmt.Printf("In root: %v\n", filter.GetInRoot())
}
Output: In root: true
func (*UIDPFilter) Descriptor
deprecated
func (*UIDPFilter) Descriptor() ([]byte, []int)
Deprecated: Use UIDPFilter.ProtoReflect.Descriptor instead.
func (*UIDPFilter) GetAncestorsOf ¶
func (x *UIDPFilter) GetAncestorsOf() string
func (*UIDPFilter) GetChildrenOf ¶
func (x *UIDPFilter) GetChildrenOf() string
func (*UIDPFilter) GetDescendantsOf ¶
func (x *UIDPFilter) GetDescendantsOf() string
func (*UIDPFilter) GetIds ¶ added in v0.1.41
func (x *UIDPFilter) GetIds() []string
func (*UIDPFilter) GetInRoot ¶ added in v0.1.18
func (x *UIDPFilter) GetInRoot() bool
func (*UIDPFilter) ProtoMessage ¶
func (*UIDPFilter) ProtoMessage()
func (*UIDPFilter) ProtoReflect ¶
func (x *UIDPFilter) ProtoReflect() protoreflect.Message
func (*UIDPFilter) Reset ¶
func (x *UIDPFilter) Reset()
func (*UIDPFilter) String ¶
func (x *UIDPFilter) String() string
Click to show internal directories.
Click to hide internal directories.