From caac5f60f0a952c9c05aa4f95678f3552b8f93c1 Mon Sep 17 00:00:00 2001 From: Geoff Greer Date: Tue, 15 Apr 2025 16:08:50 -0700 Subject: [PATCH] Upgrade baton-sdk to v0.2.94. Adds support for Raw ID annotation. --- go.mod | 2 +- go.sum | 4 +- .../c1/connector/v2/annotation_raw_id.pb.go | 130 +++++++++++++++++ .../v2/annotation_raw_id.pb.validate.go | 136 ++++++++++++++++++ .../baton-sdk/pkg/annotations/annotations.go | 16 +++ .../conductorone/baton-sdk/pkg/sdk/version.go | 2 +- vendor/modules.txt | 2 +- 7 files changed, 287 insertions(+), 5 deletions(-) create mode 100644 vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_raw_id.pb.go create mode 100644 vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_raw_id.pb.validate.go diff --git a/go.mod b/go.mod index b568d71..4730e28 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/conductorone/baton go 1.23.6 require ( - github.com/conductorone/baton-sdk v0.2.90 + github.com/conductorone/baton-sdk v0.2.94 github.com/envoyproxy/protoc-gen-validate v1.2.1 github.com/gin-gonic/contrib v0.0.0-20250113154928-93b827325fec github.com/gin-gonic/gin v1.10.0 diff --git a/go.sum b/go.sum index 972790e..d07af53 100644 --- a/go.sum +++ b/go.sum @@ -72,8 +72,8 @@ github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCy github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/conductorone/baton-sdk v0.2.90 h1:kCpJy20+b3ar4rNPb2mvz32xYKQUA4uklUSbHenomFE= -github.com/conductorone/baton-sdk v0.2.90/go.mod h1:nUgHSAf9P0lfamti5NlOSpeh1t99UNzMjIwf0I7n4/g= +github.com/conductorone/baton-sdk v0.2.94 h1:tF8z+Dnu2Q6ro67gYS0JabIi1MIihypo0+RjlWgI5jI= +github.com/conductorone/baton-sdk v0.2.94/go.mod h1:nUgHSAf9P0lfamti5NlOSpeh1t99UNzMjIwf0I7n4/g= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro= github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_raw_id.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_raw_id.pb.go new file mode 100644 index 0000000..7206323 --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_raw_id.pb.go @@ -0,0 +1,130 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.4 +// protoc (unknown) +// source: c1/connector/v2/annotation_raw_id.proto + +package v2 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Raw ID from whatever API the resource/entitlement/grant came from. +type RawId struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RawId) Reset() { + *x = RawId{} + mi := &file_c1_connector_v2_annotation_raw_id_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RawId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RawId) ProtoMessage() {} + +func (x *RawId) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_raw_id_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RawId.ProtoReflect.Descriptor instead. +func (*RawId) Descriptor() ([]byte, []int) { + return file_c1_connector_v2_annotation_raw_id_proto_rawDescGZIP(), []int{0} +} + +func (x *RawId) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +var File_c1_connector_v2_annotation_raw_id_proto protoreflect.FileDescriptor + +var file_c1_connector_v2_annotation_raw_id_proto_rawDesc = string([]byte{ + 0x0a, 0x27, 0x63, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x76, + 0x32, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x77, + 0x5f, 0x69, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x63, 0x31, 0x2e, 0x63, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x76, 0x32, 0x22, 0x17, 0x0a, 0x05, 0x52, 0x61, + 0x77, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x64, 0x75, 0x63, 0x74, 0x6f, 0x72, 0x6f, 0x6e, 0x65, 0x2f, 0x62, + 0x61, 0x74, 0x6f, 0x6e, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x2f, 0x63, 0x31, 0x2f, 0x63, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x76, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +}) + +var ( + file_c1_connector_v2_annotation_raw_id_proto_rawDescOnce sync.Once + file_c1_connector_v2_annotation_raw_id_proto_rawDescData []byte +) + +func file_c1_connector_v2_annotation_raw_id_proto_rawDescGZIP() []byte { + file_c1_connector_v2_annotation_raw_id_proto_rawDescOnce.Do(func() { + file_c1_connector_v2_annotation_raw_id_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_c1_connector_v2_annotation_raw_id_proto_rawDesc), len(file_c1_connector_v2_annotation_raw_id_proto_rawDesc))) + }) + return file_c1_connector_v2_annotation_raw_id_proto_rawDescData +} + +var file_c1_connector_v2_annotation_raw_id_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_c1_connector_v2_annotation_raw_id_proto_goTypes = []any{ + (*RawId)(nil), // 0: c1.connector.v2.RawId +} +var file_c1_connector_v2_annotation_raw_id_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_c1_connector_v2_annotation_raw_id_proto_init() } +func file_c1_connector_v2_annotation_raw_id_proto_init() { + if File_c1_connector_v2_annotation_raw_id_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_connector_v2_annotation_raw_id_proto_rawDesc), len(file_c1_connector_v2_annotation_raw_id_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_c1_connector_v2_annotation_raw_id_proto_goTypes, + DependencyIndexes: file_c1_connector_v2_annotation_raw_id_proto_depIdxs, + MessageInfos: file_c1_connector_v2_annotation_raw_id_proto_msgTypes, + }.Build() + File_c1_connector_v2_annotation_raw_id_proto = out.File + file_c1_connector_v2_annotation_raw_id_proto_goTypes = nil + file_c1_connector_v2_annotation_raw_id_proto_depIdxs = nil +} diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_raw_id.pb.validate.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_raw_id.pb.validate.go new file mode 100644 index 0000000..f2bb568 --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_raw_id.pb.validate.go @@ -0,0 +1,136 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: c1/connector/v2/annotation_raw_id.proto + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on RawId with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *RawId) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on RawId with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in RawIdMultiError, or nil if none found. +func (m *RawId) ValidateAll() error { + return m.validate(true) +} + +func (m *RawId) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + if len(errors) > 0 { + return RawIdMultiError(errors) + } + + return nil +} + +// RawIdMultiError is an error wrapping multiple validation errors returned by +// RawId.ValidateAll() if the designated constraints aren't met. +type RawIdMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RawIdMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m RawIdMultiError) AllErrors() []error { return m } + +// RawIdValidationError is the validation error returned by RawId.Validate if +// the designated constraints aren't met. +type RawIdValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e RawIdValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e RawIdValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e RawIdValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e RawIdValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e RawIdValidationError) ErrorName() string { return "RawIdValidationError" } + +// Error satisfies the builtin error interface +func (e RawIdValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRawId.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = RawIdValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = RawIdValidationError{} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/annotations/annotations.go b/vendor/github.com/conductorone/baton-sdk/pkg/annotations/annotations.go index fe76906..0f06210 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/annotations/annotations.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/annotations/annotations.go @@ -85,6 +85,22 @@ func (a *Annotations) Contains(msg proto.Message) bool { return false } +func (a *Annotations) ContainsAny(msgs ...proto.Message) bool { + if len(msgs) == 0 { + return false + } + + for _, v := range *a { + for _, msg := range msgs { + if v.MessageIs(msg) { + return true + } + } + } + + return false +} + // Pick checks if the message is in the annotations slice. func (a *Annotations) Pick(needle proto.Message) (bool, error) { if needle == nil { diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/sdk/version.go b/vendor/github.com/conductorone/baton-sdk/pkg/sdk/version.go index c620fb6..be8a43c 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/sdk/version.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/sdk/version.go @@ -1,3 +1,3 @@ package sdk -const Version = "v0.2.89" +const Version = "v0.2.93" diff --git a/vendor/modules.txt b/vendor/modules.txt index 708a447..07266ae 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -190,7 +190,7 @@ github.com/cloudwego/base64x/internal/native github.com/cloudwego/base64x/internal/native/avx2 github.com/cloudwego/base64x/internal/native/sse github.com/cloudwego/base64x/internal/rt -# github.com/conductorone/baton-sdk v0.2.90 +# github.com/conductorone/baton-sdk v0.2.94 ## explicit; go 1.23.4 github.com/conductorone/baton-sdk/pb/c1/c1z/v1 github.com/conductorone/baton-sdk/pb/c1/config/v1