diff --git a/controllers/jetstream/consumer.go b/controllers/jetstream/consumer.go index 252db2fd..dfab1902 100644 --- a/controllers/jetstream/consumer.go +++ b/controllers/jetstream/consumer.go @@ -308,7 +308,6 @@ func consumerSpecToOpts(spec apis.ConsumerSpec) ([]jsm.ConsumerOption, error) { opts := []jsm.ConsumerOption{ jsm.DurableName(spec.DurableName), jsm.DeliverySubject(spec.DeliverSubject), - jsm.FilterStreamBySubject(spec.FilterSubject), jsm.RateLimitBitsPerSecond(uint64(spec.RateLimitBps)), jsm.MaxAckPending(uint(spec.MaxAckPending)), jsm.ConsumerDescription(spec.Description), @@ -319,6 +318,16 @@ func consumerSpecToOpts(spec apis.ConsumerSpec) ([]jsm.ConsumerOption, error) { jsm.ConsumerOverrideReplicas(spec.Replicas), } + if spec.FilterSubject != "" && len(spec.FilterSubjects) > 0 { + return nil, fmt.Errorf("cannot specify both FilterSubject and FilterSubjects") + } + + if spec.FilterSubject != "" { + opts = append(opts, jsm.FilterStreamBySubject(spec.FilterSubject)) + } else if len(spec.FilterSubjects) > 0 { + opts = append(opts, jsm.FilterStreamBySubject(spec.FilterSubjects...)) + } + switch spec.DeliverPolicy { case "all": opts = append(opts, jsm.DeliverAllAvailable()) diff --git a/controllers/jetstream/stream.go b/controllers/jetstream/stream.go index 32797c13..9103ba3a 100644 --- a/controllers/jetstream/stream.go +++ b/controllers/jetstream/stream.go @@ -23,6 +23,7 @@ import ( "time" jsm "github.com/nats-io/jsm.go" + "github.com/nats-io/jsm.go/api" jsmapi "github.com/nats-io/jsm.go/api" apis "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" typed "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2" @@ -337,6 +338,13 @@ func createStream(ctx context.Context, c jsmClient, spec apis.StreamSpec) (err e opts = append(opts, jsm.DiscardNew()) } + switch spec.Compression { + case "s2": + opts = append(opts, jsm.Compression(api.S2Compression)) + case "none": + opts = append(opts, jsm.Compression(api.NoCompression)) + } + if spec.NoAck { opts = append(opts, jsm.NoAck()) } @@ -397,6 +405,16 @@ func createStream(ctx context.Context, c jsmClient, spec apis.StreamSpec) (err e })) } + if spec.SubjectTransform != nil { + opts = append(opts, func(o *api.StreamConfig) error { + o.SubjectTransform = &jsmapi.SubjectTransformConfig{ + Source: spec.SubjectTransform.Source, + Destination: spec.SubjectTransform.Dest, + } + return nil + }) + } + if spec.AllowDirect { opts = append(opts, jsm.AllowDirect()) } @@ -446,27 +464,36 @@ func updateStream(ctx context.Context, c jsmClient, spec apis.StreamSpec) (err e return err } + var subjectTransform *jsmapi.SubjectTransformConfig + if spec.SubjectTransform != nil { + subjectTransform = &jsmapi.SubjectTransformConfig{ + Source: spec.SubjectTransform.Source, + Destination: spec.SubjectTransform.Dest, + } + } + config := jsmapi.StreamConfig{ - Name: spec.Name, - Description: spec.Description, - Retention: retention, - Subjects: spec.Subjects, - MaxConsumers: spec.MaxConsumers, - MaxMsgs: int64(spec.MaxMsgs), - MaxBytes: int64(spec.MaxBytes), - MaxMsgsPer: int64(spec.MaxMsgsPerSubject), - MaxAge: maxAge, - MaxMsgSize: int32(spec.MaxMsgSize), - Storage: storage, - Discard: discard, - DiscardNewPer: spec.DiscardPerSubject, - Replicas: spec.Replicas, - NoAck: spec.NoAck, - Duplicates: duplicates, - AllowDirect: spec.AllowDirect, - DenyDelete: spec.DenyDelete, - RollupAllowed: spec.AllowRollup, - FirstSeq: spec.FirstSequence, + Name: spec.Name, + Description: spec.Description, + Retention: retention, + Subjects: spec.Subjects, + MaxConsumers: spec.MaxConsumers, + MaxMsgs: int64(spec.MaxMsgs), + MaxBytes: int64(spec.MaxBytes), + MaxMsgsPer: int64(spec.MaxMsgsPerSubject), + MaxAge: maxAge, + MaxMsgSize: int32(spec.MaxMsgSize), + Storage: storage, + Discard: discard, + DiscardNewPer: spec.DiscardPerSubject, + Replicas: spec.Replicas, + NoAck: spec.NoAck, + Duplicates: duplicates, + AllowDirect: spec.AllowDirect, + DenyDelete: spec.DenyDelete, + RollupAllowed: spec.AllowRollup, + FirstSeq: spec.FirstSequence, + SubjectTransform: subjectTransform, } if spec.Republish != nil { config.RePublish = &jsmapi.RePublish{ @@ -492,6 +519,13 @@ func updateStream(ctx context.Context, c jsmClient, spec apis.StreamSpec) (err e config.Sources[i] = jss } + switch spec.Compression { + case "s2": + config.Compression = api.S2Compression + case "none": + config.Compression = api.NoCompression + } + return js.UpdateConfiguration(config) } @@ -647,5 +681,12 @@ func getStreamSource(ss *apis.StreamSource) (*jsmapi.StreamSource, error) { } } + for _, transform := range ss.SubjectTransforms { + jss.SubjectTransforms = append(jss.SubjectTransforms, jsmapi.SubjectTransformConfig{ + Source: transform.Source, + Destination: transform.Dest, + }) + } + return jss, nil } diff --git a/deploy/crds.yml b/deploy/crds.yml index 385f881b..ef457e31 100644 --- a/deploy/crds.yml +++ b/deploy/crds.yml @@ -117,6 +117,19 @@ spec: type: string externalDeliverPrefix: type: string + subjectTransforms: + description: List of subject transforms for this mirror. + type: array + items: + description: A subject transform pair. + type: object + properties: + source: + description: Source subject. + type: string + dest: + description: Destination subject. + type: string placement: description: A stream's placement. type: object @@ -146,6 +159,19 @@ spec: type: string externalDeliverPrefix: type: string + subjectTransforms: + description: List of subject transforms for this mirror. + type: array + items: + description: A subject transform pair. + type: object + properties: + source: + description: Source subject. + type: string + dest: + description: Destination subject. + type: string servers: description: A list of servers for creating stream type: array @@ -193,6 +219,24 @@ spec: description: Sequence number from which the Stream will start. type: number default: 0 + compression: + description: Stream specific compression. + type: string + enum: + - s2 + - none + - '' + default: '' + subjectTransform: + description: SubjectTransform is for applying a subject transform (to matching messages) when a new message is received + type: object + properties: + source: + type: string + description: Source subject + dest: + type: string + description: Destination subject to transform into preventDelete: description: When true, the managed Stream will not be deleted when the resource is deleted type: boolean @@ -494,6 +538,11 @@ spec: filterSubject: description: Select only a specific incoming subjects, supports wildcards. type: string + filterSubjects: + description: List of incoming subjects, supports wildcards. Available since 2.10. + type: array + items: + type: string replayPolicy: description: How messages are sent. type: string diff --git a/pkg/jetstream/apis/jetstream/v1beta2/consumertypes.go b/pkg/jetstream/apis/jetstream/v1beta2/consumertypes.go index a91cc645..9575f697 100644 --- a/pkg/jetstream/apis/jetstream/v1beta2/consumertypes.go +++ b/pkg/jetstream/apis/jetstream/v1beta2/consumertypes.go @@ -34,6 +34,7 @@ type ConsumerSpec struct { PreventUpdate bool `json:"preventUpdate"` DurableName string `json:"durableName"` FilterSubject string `json:"filterSubject"` + FilterSubjects []string `json:"filterSubjects"` FlowControl bool `json:"flowControl"` HeadersOnly bool `json:"headersOnly"` HeartbeatInterval string `json:"heartbeatInterval"` diff --git a/pkg/jetstream/apis/jetstream/v1beta2/streamtypes.go b/pkg/jetstream/apis/jetstream/v1beta2/streamtypes.go index e6ba682f..1020b853 100644 --- a/pkg/jetstream/apis/jetstream/v1beta2/streamtypes.go +++ b/pkg/jetstream/apis/jetstream/v1beta2/streamtypes.go @@ -22,37 +22,44 @@ func (s *Stream) GetSpec() interface{} { // StreamSpec is the spec for a Stream resource type StreamSpec struct { - Account string `json:"account"` - AllowDirect bool `json:"allowDirect"` - AllowRollup bool `json:"allowRollup"` - Creds string `json:"creds"` - DenyDelete bool `json:"denyDelete"` - Description string `json:"description"` - DiscardPerSubject bool `json:"discardPerSubject"` - PreventDelete bool `json:"preventDelete"` - PreventUpdate bool `json:"preventUpdate"` - Discard string `json:"discard"` - DuplicateWindow string `json:"duplicateWindow"` - MaxAge string `json:"maxAge"` - MaxBytes int `json:"maxBytes"` - MaxConsumers int `json:"maxConsumers"` - MaxMsgs int `json:"maxMsgs"` - MaxMsgSize int `json:"maxMsgSize"` - MaxMsgsPerSubject int `json:"maxMsgsPerSubject"` - Mirror *StreamSource `json:"mirror"` - Name string `json:"name"` - Nkey string `json:"nkey"` - NoAck bool `json:"noAck"` - Placement *StreamPlacement `json:"placement"` - Replicas int `json:"replicas"` - Republish *RePublish `json:"republish"` - FirstSequence uint64 `json:"firstSequence"` - Retention string `json:"retention"` - Servers []string `json:"servers"` - Sources []*StreamSource `json:"sources"` - Storage string `json:"storage"` - Subjects []string `json:"subjects"` - TLS TLS `json:"tls"` + Account string `json:"account"` + AllowDirect bool `json:"allowDirect"` + AllowRollup bool `json:"allowRollup"` + Creds string `json:"creds"` + DenyDelete bool `json:"denyDelete"` + Description string `json:"description"` + DiscardPerSubject bool `json:"discardPerSubject"` + PreventDelete bool `json:"preventDelete"` + PreventUpdate bool `json:"preventUpdate"` + Discard string `json:"discard"` + DuplicateWindow string `json:"duplicateWindow"` + MaxAge string `json:"maxAge"` + MaxBytes int `json:"maxBytes"` + MaxConsumers int `json:"maxConsumers"` + MaxMsgs int `json:"maxMsgs"` + MaxMsgSize int `json:"maxMsgSize"` + MaxMsgsPerSubject int `json:"maxMsgsPerSubject"` + Mirror *StreamSource `json:"mirror"` + Name string `json:"name"` + Nkey string `json:"nkey"` + NoAck bool `json:"noAck"` + Placement *StreamPlacement `json:"placement"` + Replicas int `json:"replicas"` + Republish *RePublish `json:"republish"` + SubjectTransform *SubjectTransform `json:"subjectTransform"` + FirstSequence uint64 `json:"firstSequence"` + Compression string `json:"compression"` + Retention string `json:"retention"` + Servers []string `json:"servers"` + Sources []*StreamSource `json:"sources"` + Storage string `json:"storage"` + Subjects []string `json:"subjects"` + TLS TLS `json:"tls"` +} + +type SubjectTransform struct { + Source string `json:"source"` + Dest string `json:"dest"` } type StreamPlacement struct { @@ -68,6 +75,8 @@ type StreamSource struct { ExternalAPIPrefix string `json:"externalApiPrefix"` ExternalDeliverPrefix string `json:"externalDeliverPrefix"` + + SubjectTransforms []*SubjectTransform `json:"subjectTransforms"` } type RePublish struct { diff --git a/pkg/jetstream/apis/jetstream/v1beta2/zz_generated.deepcopy.go b/pkg/jetstream/apis/jetstream/v1beta2/zz_generated.deepcopy.go index 3881025b..ebb3aebe 100644 --- a/pkg/jetstream/apis/jetstream/v1beta2/zz_generated.deepcopy.go +++ b/pkg/jetstream/apis/jetstream/v1beta2/zz_generated.deepcopy.go @@ -199,6 +199,11 @@ func (in *ConsumerSpec) DeepCopyInto(out *ConsumerSpec) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.FilterSubjects != nil { + in, out := &in.FilterSubjects, &out.FilterSubjects + *out = make([]string, len(*in)) + copy(*out, *in) + } if in.Servers != nil { in, out := &in.Servers, &out.Servers *out = make([]string, len(*in)) @@ -389,6 +394,17 @@ func (in *StreamPlacement) DeepCopy() *StreamPlacement { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *StreamSource) DeepCopyInto(out *StreamSource) { *out = *in + if in.SubjectTransforms != nil { + in, out := &in.SubjectTransforms, &out.SubjectTransforms + *out = make([]*SubjectTransform, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(SubjectTransform) + **out = **in + } + } + } return } @@ -408,7 +424,7 @@ func (in *StreamSpec) DeepCopyInto(out *StreamSpec) { if in.Mirror != nil { in, out := &in.Mirror, &out.Mirror *out = new(StreamSource) - **out = **in + (*in).DeepCopyInto(*out) } if in.Placement != nil { in, out := &in.Placement, &out.Placement @@ -420,6 +436,11 @@ func (in *StreamSpec) DeepCopyInto(out *StreamSpec) { *out = new(RePublish) **out = **in } + if in.SubjectTransform != nil { + in, out := &in.SubjectTransform, &out.SubjectTransform + *out = new(SubjectTransform) + **out = **in + } if in.Servers != nil { in, out := &in.Servers, &out.Servers *out = make([]string, len(*in)) @@ -432,7 +453,7 @@ func (in *StreamSpec) DeepCopyInto(out *StreamSpec) { if (*in)[i] != nil { in, out := &(*in)[i], &(*out)[i] *out = new(StreamSource) - **out = **in + (*in).DeepCopyInto(*out) } } } @@ -455,6 +476,22 @@ func (in *StreamSpec) DeepCopy() *StreamSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubjectTransform) DeepCopyInto(out *SubjectTransform) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubjectTransform. +func (in *SubjectTransform) DeepCopy() *SubjectTransform { + if in == nil { + return nil + } + out := new(SubjectTransform) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TLS) DeepCopyInto(out *TLS) { *out = *in diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/consumerspec.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/consumerspec.go index 6aee6503..313a7b4f 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/consumerspec.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/consumerspec.go @@ -30,6 +30,7 @@ type ConsumerSpecApplyConfiguration struct { PreventUpdate *bool `json:"preventUpdate,omitempty"` DurableName *string `json:"durableName,omitempty"` FilterSubject *string `json:"filterSubject,omitempty"` + FilterSubjects []string `json:"filterSubjects,omitempty"` FlowControl *bool `json:"flowControl,omitempty"` HeadersOnly *bool `json:"headersOnly,omitempty"` HeartbeatInterval *string `json:"heartbeatInterval,omitempty"` @@ -157,6 +158,16 @@ func (b *ConsumerSpecApplyConfiguration) WithFilterSubject(value string) *Consum return b } +// WithFilterSubjects adds the given value to the FilterSubjects field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the FilterSubjects field. +func (b *ConsumerSpecApplyConfiguration) WithFilterSubjects(values ...string) *ConsumerSpecApplyConfiguration { + for i := range values { + b.FilterSubjects = append(b.FilterSubjects, values[i]) + } + return b +} + // WithFlowControl sets the FlowControl field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the FlowControl field is set to the value of the last call. diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamsource.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamsource.go index 63ac0164..e0c3e1a2 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamsource.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamsource.go @@ -15,15 +15,20 @@ package v1beta2 +import ( + v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" +) + // StreamSourceApplyConfiguration represents an declarative configuration of the StreamSource type for use // with apply. type StreamSourceApplyConfiguration struct { - Name *string `json:"name,omitempty"` - OptStartSeq *int `json:"optStartSeq,omitempty"` - OptStartTime *string `json:"optStartTime,omitempty"` - FilterSubject *string `json:"filterSubject,omitempty"` - ExternalAPIPrefix *string `json:"externalApiPrefix,omitempty"` - ExternalDeliverPrefix *string `json:"externalDeliverPrefix,omitempty"` + Name *string `json:"name,omitempty"` + OptStartSeq *int `json:"optStartSeq,omitempty"` + OptStartTime *string `json:"optStartTime,omitempty"` + FilterSubject *string `json:"filterSubject,omitempty"` + ExternalAPIPrefix *string `json:"externalApiPrefix,omitempty"` + ExternalDeliverPrefix *string `json:"externalDeliverPrefix,omitempty"` + SubjectTransforms []*v1beta2.SubjectTransform `json:"subjectTransforms,omitempty"` } // StreamSourceApplyConfiguration constructs an declarative configuration of the StreamSource type for use with @@ -79,3 +84,16 @@ func (b *StreamSourceApplyConfiguration) WithExternalDeliverPrefix(value string) b.ExternalDeliverPrefix = &value return b } + +// WithSubjectTransforms adds the given value to the SubjectTransforms field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the SubjectTransforms field. +func (b *StreamSourceApplyConfiguration) WithSubjectTransforms(values ...**v1beta2.SubjectTransform) *StreamSourceApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSubjectTransforms") + } + b.SubjectTransforms = append(b.SubjectTransforms, *values[i]) + } + return b +} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamspec.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamspec.go index 9d5a69f2..779e9371 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamspec.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamspec.go @@ -22,37 +22,39 @@ import ( // StreamSpecApplyConfiguration represents an declarative configuration of the StreamSpec type for use // with apply. type StreamSpecApplyConfiguration struct { - Account *string `json:"account,omitempty"` - AllowDirect *bool `json:"allowDirect,omitempty"` - AllowRollup *bool `json:"allowRollup,omitempty"` - Creds *string `json:"creds,omitempty"` - DenyDelete *bool `json:"denyDelete,omitempty"` - Description *string `json:"description,omitempty"` - DiscardPerSubject *bool `json:"discardPerSubject,omitempty"` - PreventDelete *bool `json:"preventDelete,omitempty"` - PreventUpdate *bool `json:"preventUpdate,omitempty"` - Discard *string `json:"discard,omitempty"` - DuplicateWindow *string `json:"duplicateWindow,omitempty"` - MaxAge *string `json:"maxAge,omitempty"` - MaxBytes *int `json:"maxBytes,omitempty"` - MaxConsumers *int `json:"maxConsumers,omitempty"` - MaxMsgs *int `json:"maxMsgs,omitempty"` - MaxMsgSize *int `json:"maxMsgSize,omitempty"` - MaxMsgsPerSubject *int `json:"maxMsgsPerSubject,omitempty"` - Mirror *StreamSourceApplyConfiguration `json:"mirror,omitempty"` - Name *string `json:"name,omitempty"` - Nkey *string `json:"nkey,omitempty"` - NoAck *bool `json:"noAck,omitempty"` - Placement *StreamPlacementApplyConfiguration `json:"placement,omitempty"` - Replicas *int `json:"replicas,omitempty"` - Republish *RePublishApplyConfiguration `json:"republish,omitempty"` - FirstSequence *int `json:"firstSequence,omitempty"` - Retention *string `json:"retention,omitempty"` - Servers []string `json:"servers,omitempty"` - Sources []*jetstreamv1beta2.StreamSource `json:"sources,omitempty"` - Storage *string `json:"storage,omitempty"` - Subjects []string `json:"subjects,omitempty"` - TLS *TLSApplyConfiguration `json:"tls,omitempty"` + Account *string `json:"account,omitempty"` + AllowDirect *bool `json:"allowDirect,omitempty"` + AllowRollup *bool `json:"allowRollup,omitempty"` + Creds *string `json:"creds,omitempty"` + DenyDelete *bool `json:"denyDelete,omitempty"` + Description *string `json:"description,omitempty"` + DiscardPerSubject *bool `json:"discardPerSubject,omitempty"` + PreventDelete *bool `json:"preventDelete,omitempty"` + PreventUpdate *bool `json:"preventUpdate,omitempty"` + Discard *string `json:"discard,omitempty"` + DuplicateWindow *string `json:"duplicateWindow,omitempty"` + MaxAge *string `json:"maxAge,omitempty"` + MaxBytes *int `json:"maxBytes,omitempty"` + MaxConsumers *int `json:"maxConsumers,omitempty"` + MaxMsgs *int `json:"maxMsgs,omitempty"` + MaxMsgSize *int `json:"maxMsgSize,omitempty"` + MaxMsgsPerSubject *int `json:"maxMsgsPerSubject,omitempty"` + Mirror *StreamSourceApplyConfiguration `json:"mirror,omitempty"` + Name *string `json:"name,omitempty"` + Nkey *string `json:"nkey,omitempty"` + NoAck *bool `json:"noAck,omitempty"` + Placement *StreamPlacementApplyConfiguration `json:"placement,omitempty"` + Replicas *int `json:"replicas,omitempty"` + Republish *RePublishApplyConfiguration `json:"republish,omitempty"` + SubjectTransform *SubjectTransformApplyConfiguration `json:"subjectTransform,omitempty"` + FirstSequence *uint64 `json:"firstSequence,omitempty"` + Compression *string `json:"compression,omitempty"` + Retention *string `json:"retention,omitempty"` + Servers []string `json:"servers,omitempty"` + Sources []*jetstreamv1beta2.StreamSource `json:"sources,omitempty"` + Storage *string `json:"storage,omitempty"` + Subjects []string `json:"subjects,omitempty"` + TLS *TLSApplyConfiguration `json:"tls,omitempty"` } // StreamSpecApplyConfiguration constructs an declarative configuration of the StreamSpec type for use with @@ -253,14 +255,30 @@ func (b *StreamSpecApplyConfiguration) WithRepublish(value *RePublishApplyConfig return b } +// WithSubjectTransform sets the SubjectTransform field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SubjectTransform field is set to the value of the last call. +func (b *StreamSpecApplyConfiguration) WithSubjectTransform(value *SubjectTransformApplyConfiguration) *StreamSpecApplyConfiguration { + b.SubjectTransform = value + return b +} + // WithFirstSequence sets the FirstSequence field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the FirstSequence field is set to the value of the last call. -func (b *StreamSpecApplyConfiguration) WithFirstSequence(value int) *StreamSpecApplyConfiguration { +func (b *StreamSpecApplyConfiguration) WithFirstSequence(value uint64) *StreamSpecApplyConfiguration { b.FirstSequence = &value return b } +// WithCompression sets the Compression field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Compression field is set to the value of the last call. +func (b *StreamSpecApplyConfiguration) WithCompression(value string) *StreamSpecApplyConfiguration { + b.Compression = &value + return b +} + // WithRetention sets the Retention field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Retention field is set to the value of the last call. diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/subjecttransform.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/subjecttransform.go new file mode 100644 index 00000000..2d4b9455 --- /dev/null +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/subjecttransform.go @@ -0,0 +1,45 @@ +// Copyright 2020 The NATS Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta2 + +// SubjectTransformApplyConfiguration represents an declarative configuration of the SubjectTransform type for use +// with apply. +type SubjectTransformApplyConfiguration struct { + Source *string `json:"source,omitempty"` + Dest *string `json:"dest,omitempty"` +} + +// SubjectTransformApplyConfiguration constructs an declarative configuration of the SubjectTransform type for use with +// apply. +func SubjectTransform() *SubjectTransformApplyConfiguration { + return &SubjectTransformApplyConfiguration{} +} + +// WithSource sets the Source field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Source field is set to the value of the last call. +func (b *SubjectTransformApplyConfiguration) WithSource(value string) *SubjectTransformApplyConfiguration { + b.Source = &value + return b +} + +// WithDest sets the Dest field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Dest field is set to the value of the last call. +func (b *SubjectTransformApplyConfiguration) WithDest(value string) *SubjectTransformApplyConfiguration { + b.Dest = &value + return b +} diff --git a/pkg/jetstream/generated/applyconfiguration/utils.go b/pkg/jetstream/generated/applyconfiguration/utils.go index 18c5056d..4e1751e0 100644 --- a/pkg/jetstream/generated/applyconfiguration/utils.go +++ b/pkg/jetstream/generated/applyconfiguration/utils.go @@ -52,6 +52,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &jetstreamv1beta2.StreamSourceApplyConfiguration{} case v1beta2.SchemeGroupVersion.WithKind("StreamSpec"): return &jetstreamv1beta2.StreamSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("SubjectTransform"): + return &jetstreamv1beta2.SubjectTransformApplyConfiguration{} case v1beta2.SchemeGroupVersion.WithKind("TLS"): return &jetstreamv1beta2.TLSApplyConfiguration{} case v1beta2.SchemeGroupVersion.WithKind("TLSSecret"):