diff --git a/go.mod b/go.mod index b3882c3..2fac367 100644 --- a/go.mod +++ b/go.mod @@ -16,11 +16,11 @@ require ( github.com/stretchr/testify v1.11.1 github.com/temporalio/cli/cliext v0.0.0-20260602200703-8bb57b77ad55 go.temporal.io/api v1.63.6-0.20260811224032-89570b10e9e2 - go.temporal.io/cloud-sdk v0.21.0 + go.temporal.io/cloud-sdk v0.23.0 go.temporal.io/sdk v1.44.1 go.temporal.io/sdk/contrib/envconfig v1.0.0 golang.org/x/oauth2 v0.36.0 - golang.org/x/term v0.43.0 + golang.org/x/term v0.46.0 google.golang.org/grpc v1.82.1 google.golang.org/protobuf v1.36.11 ) @@ -65,19 +65,19 @@ require ( github.com/robfig/cron v1.2.0 // indirect github.com/rs/zerolog v1.34.0 // indirect github.com/stretchr/objx v0.5.3 // indirect - github.com/vektra/mockery/v3 v3.6.4 // indirect + github.com/vektra/mockery/v3 v3.9.0 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a // indirect - golang.org/x/mod v0.35.0 // indirect - golang.org/x/net v0.55.0 // indirect - golang.org/x/sync v0.20.0 // indirect - golang.org/x/sys v0.45.0 // indirect - golang.org/x/text v0.37.0 // indirect + golang.org/x/mod v0.41.0 // indirect + golang.org/x/net v0.59.0 // indirect + golang.org/x/sync v0.23.0 // indirect + golang.org/x/sys v0.48.0 // indirect + golang.org/x/text v0.42.0 // indirect golang.org/x/time v0.15.0 // indirect - golang.org/x/tools v0.44.0 // indirect + golang.org/x/tools v0.51.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 4914aa4..ec83f5e 100644 --- a/go.sum +++ b/go.sum @@ -128,8 +128,8 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/temporalio/cli/cliext v0.0.0-20260602200703-8bb57b77ad55 h1:s/rQ1jv0+9+9mAAraKASLTVrTZ/kuUXdmM6o8b+1HQ8= github.com/temporalio/cli/cliext v0.0.0-20260602200703-8bb57b77ad55/go.mod h1:4skecdpkMsFBgrefCFMX69gkULY5gI2nIOW1LNf0Bps= -github.com/vektra/mockery/v3 v3.6.4 h1:EWkuwRnCewRwzQfMQx0btrMPGWSlq2ekaEOeXR2L8U4= -github.com/vektra/mockery/v3 v3.6.4/go.mod h1:z9Wr23Ha8etImqQwS3boTNR9WkjX6tIklW5c88DRkSw= +github.com/vektra/mockery/v3 v3.9.0 h1:BeuKC+6aQBP4cgqIxBsJxUs5F0iThO7+blEWbE5lkKs= +github.com/vektra/mockery/v3 v3.9.0/go.mod h1:1+hDVtNiQfxGv9YhpYmQ1q1Drf7z4w1rUvsAvwe2aIY= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= @@ -154,8 +154,8 @@ go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09 go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= go.temporal.io/api v1.63.6-0.20260811224032-89570b10e9e2 h1:VeNTxlOHETym01zX6kSXHIVw4nc2RrX/KVgepQ/dr/8= go.temporal.io/api v1.63.6-0.20260811224032-89570b10e9e2/go.mod h1:SrlW2JMwVlDP4nRWSNznUFqnSHd+YeMDS1BkYo63HCQ= -go.temporal.io/cloud-sdk v0.21.0 h1:netTthDj6WbnTIM0l0OJw3IIQCkBVuxAgOAdwUX8ntM= -go.temporal.io/cloud-sdk v0.21.0/go.mod h1:W2O9t9tvo3Q/LhGgYdj8JijWbN5C84os+cz/BadIHYI= +go.temporal.io/cloud-sdk v0.23.0 h1:15uh8IEi+L8YrGux93usWqwJ/vv1N4QsuS71drikqwc= +go.temporal.io/cloud-sdk v0.23.0/go.mod h1:W2O9t9tvo3Q/LhGgYdj8JijWbN5C84os+cz/BadIHYI= go.temporal.io/sdk v1.44.1 h1:Mt2OZLZpqkzDIdg9YyQzO0Rb/HqCDnnqHlIAGAJ5gqM= go.temporal.io/sdk v1.44.1/go.mod h1:vkApR12F9/Y8OR+hkxe7WyXQFuCX6clhzqnAk6rzDAM= go.temporal.io/sdk/contrib/envconfig v1.0.0 h1:1Q/swVgB4EW/p3k7rI9/4hpU4/DC57FSRbU90+UisXw= @@ -170,23 +170,23 @@ golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a/go.mod h1:K79w1Vqn7PoiZn+TkN golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM= -golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU= +golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= +golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8= -golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww= +golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= +golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= +golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -197,17 +197,17 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY= -golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= +golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.43.0 h1:S4RLU2sB31O/NCl+zFN9Aru9A/Cq2aqKpTZJ6B+DwT4= -golang.org/x/term v0.43.0/go.mod h1:lrhlHNdQJHO+1qVYiHfFKVuVioJIheAc3fBSMFYEIsk= +golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE= +golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= -golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -215,8 +215,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= -golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c= -golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI= +golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI= +golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/cloudservice/mock/mock.go b/internal/cloudservice/mock/mock.go index c3c6189..2e961ff 100644 --- a/internal/cloudservice/mock/mock.go +++ b/internal/cloudservice/mock/mock.go @@ -18,10 +18,19 @@ func NewMockCloudServiceClient(t interface { mock.TestingT Cleanup(func()) }) *MockCloudServiceClient { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock := &MockCloudServiceClient{} mock.Mock.Test(t) - t.Cleanup(func() { mock.AssertExpectations(t) }) + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) return mock } @@ -82,9 +91,9 @@ type MockCloudServiceClient_AddNamespaceRegion_Call struct { // - ctx context.Context // - in *cloudservice.AddNamespaceRegionRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) AddNamespaceRegion(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_AddNamespaceRegion_Call { +func (_e *MockCloudServiceClient_Expecter) AddNamespaceRegion(ctx any, in any, opts ...any) *MockCloudServiceClient_AddNamespaceRegion_Call { return &MockCloudServiceClient_AddNamespaceRegion_Call{Call: _e.mock.On("AddNamespaceRegion", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_AddNamespaceRegion_Call) Run(run func(ctx context.Context, in *cloudservice.AddNamespaceRegionRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_AddNamespaceRegion_Call { @@ -165,9 +174,9 @@ type MockCloudServiceClient_AddUserGroupMember_Call struct { // - ctx context.Context // - in *cloudservice.AddUserGroupMemberRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) AddUserGroupMember(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_AddUserGroupMember_Call { +func (_e *MockCloudServiceClient_Expecter) AddUserGroupMember(ctx any, in any, opts ...any) *MockCloudServiceClient_AddUserGroupMember_Call { return &MockCloudServiceClient_AddUserGroupMember_Call{Call: _e.mock.On("AddUserGroupMember", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_AddUserGroupMember_Call) Run(run func(ctx context.Context, in *cloudservice.AddUserGroupMemberRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_AddUserGroupMember_Call { @@ -248,9 +257,9 @@ type MockCloudServiceClient_CreateAccountAuditLogSink_Call struct { // - ctx context.Context // - in *cloudservice.CreateAccountAuditLogSinkRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) CreateAccountAuditLogSink(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_CreateAccountAuditLogSink_Call { +func (_e *MockCloudServiceClient_Expecter) CreateAccountAuditLogSink(ctx any, in any, opts ...any) *MockCloudServiceClient_CreateAccountAuditLogSink_Call { return &MockCloudServiceClient_CreateAccountAuditLogSink_Call{Call: _e.mock.On("CreateAccountAuditLogSink", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_CreateAccountAuditLogSink_Call) Run(run func(ctx context.Context, in *cloudservice.CreateAccountAuditLogSinkRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_CreateAccountAuditLogSink_Call { @@ -331,9 +340,9 @@ type MockCloudServiceClient_CreateApiKey_Call struct { // - ctx context.Context // - in *cloudservice.CreateApiKeyRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) CreateApiKey(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_CreateApiKey_Call { +func (_e *MockCloudServiceClient_Expecter) CreateApiKey(ctx any, in any, opts ...any) *MockCloudServiceClient_CreateApiKey_Call { return &MockCloudServiceClient_CreateApiKey_Call{Call: _e.mock.On("CreateApiKey", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_CreateApiKey_Call) Run(run func(ctx context.Context, in *cloudservice.CreateApiKeyRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_CreateApiKey_Call { @@ -414,9 +423,9 @@ type MockCloudServiceClient_CreateBillingReport_Call struct { // - ctx context.Context // - in *cloudservice.CreateBillingReportRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) CreateBillingReport(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_CreateBillingReport_Call { +func (_e *MockCloudServiceClient_Expecter) CreateBillingReport(ctx any, in any, opts ...any) *MockCloudServiceClient_CreateBillingReport_Call { return &MockCloudServiceClient_CreateBillingReport_Call{Call: _e.mock.On("CreateBillingReport", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_CreateBillingReport_Call) Run(run func(ctx context.Context, in *cloudservice.CreateBillingReportRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_CreateBillingReport_Call { @@ -454,6 +463,89 @@ func (_c *MockCloudServiceClient_CreateBillingReport_Call) RunAndReturn(run func return _c } +// CreateCallerRateLimit provides a mock function for the type MockCloudServiceClient +func (_mock *MockCloudServiceClient) CreateCallerRateLimit(ctx context.Context, in *cloudservice.CreateCallerRateLimitRequest, opts ...grpc.CallOption) (*cloudservice.CreateCallerRateLimitResponse, error) { + var tmpRet mock.Arguments + if len(opts) > 0 { + tmpRet = _mock.Called(ctx, in, opts) + } else { + tmpRet = _mock.Called(ctx, in) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for CreateCallerRateLimit") + } + + var r0 *cloudservice.CreateCallerRateLimitResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *cloudservice.CreateCallerRateLimitRequest, ...grpc.CallOption) (*cloudservice.CreateCallerRateLimitResponse, error)); ok { + return returnFunc(ctx, in, opts...) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *cloudservice.CreateCallerRateLimitRequest, ...grpc.CallOption) *cloudservice.CreateCallerRateLimitResponse); ok { + r0 = returnFunc(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*cloudservice.CreateCallerRateLimitResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *cloudservice.CreateCallerRateLimitRequest, ...grpc.CallOption) error); ok { + r1 = returnFunc(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockCloudServiceClient_CreateCallerRateLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateCallerRateLimit' +type MockCloudServiceClient_CreateCallerRateLimit_Call struct { + *mock.Call +} + +// CreateCallerRateLimit is a helper method to define mock.On call +// - ctx context.Context +// - in *cloudservice.CreateCallerRateLimitRequest +// - opts ...grpc.CallOption +func (_e *MockCloudServiceClient_Expecter) CreateCallerRateLimit(ctx any, in any, opts ...any) *MockCloudServiceClient_CreateCallerRateLimit_Call { + return &MockCloudServiceClient_CreateCallerRateLimit_Call{Call: _e.mock.On("CreateCallerRateLimit", + append([]any{ctx, in}, opts...)...)} +} + +func (_c *MockCloudServiceClient_CreateCallerRateLimit_Call) Run(run func(ctx context.Context, in *cloudservice.CreateCallerRateLimitRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_CreateCallerRateLimit_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *cloudservice.CreateCallerRateLimitRequest + if args[1] != nil { + arg1 = args[1].(*cloudservice.CreateCallerRateLimitRequest) + } + var arg2 []grpc.CallOption + var variadicArgs []grpc.CallOption + if len(args) > 2 { + variadicArgs = args[2].([]grpc.CallOption) + } + arg2 = variadicArgs + run( + arg0, + arg1, + arg2..., + ) + }) + return _c +} + +func (_c *MockCloudServiceClient_CreateCallerRateLimit_Call) Return(createCallerRateLimitResponse *cloudservice.CreateCallerRateLimitResponse, err error) *MockCloudServiceClient_CreateCallerRateLimit_Call { + _c.Call.Return(createCallerRateLimitResponse, err) + return _c +} + +func (_c *MockCloudServiceClient_CreateCallerRateLimit_Call) RunAndReturn(run func(ctx context.Context, in *cloudservice.CreateCallerRateLimitRequest, opts ...grpc.CallOption) (*cloudservice.CreateCallerRateLimitResponse, error)) *MockCloudServiceClient_CreateCallerRateLimit_Call { + _c.Call.Return(run) + return _c +} + // CreateConnectivityRule provides a mock function for the type MockCloudServiceClient func (_mock *MockCloudServiceClient) CreateConnectivityRule(ctx context.Context, in *cloudservice.CreateConnectivityRuleRequest, opts ...grpc.CallOption) (*cloudservice.CreateConnectivityRuleResponse, error) { var tmpRet mock.Arguments @@ -497,9 +589,9 @@ type MockCloudServiceClient_CreateConnectivityRule_Call struct { // - ctx context.Context // - in *cloudservice.CreateConnectivityRuleRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) CreateConnectivityRule(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_CreateConnectivityRule_Call { +func (_e *MockCloudServiceClient_Expecter) CreateConnectivityRule(ctx any, in any, opts ...any) *MockCloudServiceClient_CreateConnectivityRule_Call { return &MockCloudServiceClient_CreateConnectivityRule_Call{Call: _e.mock.On("CreateConnectivityRule", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_CreateConnectivityRule_Call) Run(run func(ctx context.Context, in *cloudservice.CreateConnectivityRuleRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_CreateConnectivityRule_Call { @@ -580,9 +672,9 @@ type MockCloudServiceClient_CreateCustomRole_Call struct { // - ctx context.Context // - in *cloudservice.CreateCustomRoleRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) CreateCustomRole(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_CreateCustomRole_Call { +func (_e *MockCloudServiceClient_Expecter) CreateCustomRole(ctx any, in any, opts ...any) *MockCloudServiceClient_CreateCustomRole_Call { return &MockCloudServiceClient_CreateCustomRole_Call{Call: _e.mock.On("CreateCustomRole", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_CreateCustomRole_Call) Run(run func(ctx context.Context, in *cloudservice.CreateCustomRoleRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_CreateCustomRole_Call { @@ -663,9 +755,9 @@ type MockCloudServiceClient_CreateNamespace_Call struct { // - ctx context.Context // - in *cloudservice.CreateNamespaceRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) CreateNamespace(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_CreateNamespace_Call { +func (_e *MockCloudServiceClient_Expecter) CreateNamespace(ctx any, in any, opts ...any) *MockCloudServiceClient_CreateNamespace_Call { return &MockCloudServiceClient_CreateNamespace_Call{Call: _e.mock.On("CreateNamespace", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_CreateNamespace_Call) Run(run func(ctx context.Context, in *cloudservice.CreateNamespaceRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_CreateNamespace_Call { @@ -746,9 +838,9 @@ type MockCloudServiceClient_CreateNamespaceExportSink_Call struct { // - ctx context.Context // - in *cloudservice.CreateNamespaceExportSinkRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) CreateNamespaceExportSink(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_CreateNamespaceExportSink_Call { +func (_e *MockCloudServiceClient_Expecter) CreateNamespaceExportSink(ctx any, in any, opts ...any) *MockCloudServiceClient_CreateNamespaceExportSink_Call { return &MockCloudServiceClient_CreateNamespaceExportSink_Call{Call: _e.mock.On("CreateNamespaceExportSink", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_CreateNamespaceExportSink_Call) Run(run func(ctx context.Context, in *cloudservice.CreateNamespaceExportSinkRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_CreateNamespaceExportSink_Call { @@ -829,9 +921,9 @@ type MockCloudServiceClient_CreateNexusEndpoint_Call struct { // - ctx context.Context // - in *cloudservice.CreateNexusEndpointRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) CreateNexusEndpoint(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_CreateNexusEndpoint_Call { +func (_e *MockCloudServiceClient_Expecter) CreateNexusEndpoint(ctx any, in any, opts ...any) *MockCloudServiceClient_CreateNexusEndpoint_Call { return &MockCloudServiceClient_CreateNexusEndpoint_Call{Call: _e.mock.On("CreateNexusEndpoint", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_CreateNexusEndpoint_Call) Run(run func(ctx context.Context, in *cloudservice.CreateNexusEndpointRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_CreateNexusEndpoint_Call { @@ -912,9 +1004,9 @@ type MockCloudServiceClient_CreateProject_Call struct { // - ctx context.Context // - in *cloudservice.CreateProjectRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) CreateProject(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_CreateProject_Call { +func (_e *MockCloudServiceClient_Expecter) CreateProject(ctx any, in any, opts ...any) *MockCloudServiceClient_CreateProject_Call { return &MockCloudServiceClient_CreateProject_Call{Call: _e.mock.On("CreateProject", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_CreateProject_Call) Run(run func(ctx context.Context, in *cloudservice.CreateProjectRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_CreateProject_Call { @@ -995,9 +1087,9 @@ type MockCloudServiceClient_CreateServiceAccount_Call struct { // - ctx context.Context // - in *cloudservice.CreateServiceAccountRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) CreateServiceAccount(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_CreateServiceAccount_Call { +func (_e *MockCloudServiceClient_Expecter) CreateServiceAccount(ctx any, in any, opts ...any) *MockCloudServiceClient_CreateServiceAccount_Call { return &MockCloudServiceClient_CreateServiceAccount_Call{Call: _e.mock.On("CreateServiceAccount", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_CreateServiceAccount_Call) Run(run func(ctx context.Context, in *cloudservice.CreateServiceAccountRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_CreateServiceAccount_Call { @@ -1078,9 +1170,9 @@ type MockCloudServiceClient_CreateUser_Call struct { // - ctx context.Context // - in *cloudservice.CreateUserRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) CreateUser(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_CreateUser_Call { +func (_e *MockCloudServiceClient_Expecter) CreateUser(ctx any, in any, opts ...any) *MockCloudServiceClient_CreateUser_Call { return &MockCloudServiceClient_CreateUser_Call{Call: _e.mock.On("CreateUser", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_CreateUser_Call) Run(run func(ctx context.Context, in *cloudservice.CreateUserRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_CreateUser_Call { @@ -1161,9 +1253,9 @@ type MockCloudServiceClient_CreateUserGroup_Call struct { // - ctx context.Context // - in *cloudservice.CreateUserGroupRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) CreateUserGroup(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_CreateUserGroup_Call { +func (_e *MockCloudServiceClient_Expecter) CreateUserGroup(ctx any, in any, opts ...any) *MockCloudServiceClient_CreateUserGroup_Call { return &MockCloudServiceClient_CreateUserGroup_Call{Call: _e.mock.On("CreateUserGroup", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_CreateUserGroup_Call) Run(run func(ctx context.Context, in *cloudservice.CreateUserGroupRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_CreateUserGroup_Call { @@ -1244,9 +1336,9 @@ type MockCloudServiceClient_DeleteAccountAuditLogSink_Call struct { // - ctx context.Context // - in *cloudservice.DeleteAccountAuditLogSinkRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) DeleteAccountAuditLogSink(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_DeleteAccountAuditLogSink_Call { +func (_e *MockCloudServiceClient_Expecter) DeleteAccountAuditLogSink(ctx any, in any, opts ...any) *MockCloudServiceClient_DeleteAccountAuditLogSink_Call { return &MockCloudServiceClient_DeleteAccountAuditLogSink_Call{Call: _e.mock.On("DeleteAccountAuditLogSink", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_DeleteAccountAuditLogSink_Call) Run(run func(ctx context.Context, in *cloudservice.DeleteAccountAuditLogSinkRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_DeleteAccountAuditLogSink_Call { @@ -1327,9 +1419,9 @@ type MockCloudServiceClient_DeleteApiKey_Call struct { // - ctx context.Context // - in *cloudservice.DeleteApiKeyRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) DeleteApiKey(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_DeleteApiKey_Call { +func (_e *MockCloudServiceClient_Expecter) DeleteApiKey(ctx any, in any, opts ...any) *MockCloudServiceClient_DeleteApiKey_Call { return &MockCloudServiceClient_DeleteApiKey_Call{Call: _e.mock.On("DeleteApiKey", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_DeleteApiKey_Call) Run(run func(ctx context.Context, in *cloudservice.DeleteApiKeyRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_DeleteApiKey_Call { @@ -1367,6 +1459,89 @@ func (_c *MockCloudServiceClient_DeleteApiKey_Call) RunAndReturn(run func(ctx co return _c } +// DeleteCallerRateLimit provides a mock function for the type MockCloudServiceClient +func (_mock *MockCloudServiceClient) DeleteCallerRateLimit(ctx context.Context, in *cloudservice.DeleteCallerRateLimitRequest, opts ...grpc.CallOption) (*cloudservice.DeleteCallerRateLimitResponse, error) { + var tmpRet mock.Arguments + if len(opts) > 0 { + tmpRet = _mock.Called(ctx, in, opts) + } else { + tmpRet = _mock.Called(ctx, in) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for DeleteCallerRateLimit") + } + + var r0 *cloudservice.DeleteCallerRateLimitResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *cloudservice.DeleteCallerRateLimitRequest, ...grpc.CallOption) (*cloudservice.DeleteCallerRateLimitResponse, error)); ok { + return returnFunc(ctx, in, opts...) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *cloudservice.DeleteCallerRateLimitRequest, ...grpc.CallOption) *cloudservice.DeleteCallerRateLimitResponse); ok { + r0 = returnFunc(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*cloudservice.DeleteCallerRateLimitResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *cloudservice.DeleteCallerRateLimitRequest, ...grpc.CallOption) error); ok { + r1 = returnFunc(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockCloudServiceClient_DeleteCallerRateLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteCallerRateLimit' +type MockCloudServiceClient_DeleteCallerRateLimit_Call struct { + *mock.Call +} + +// DeleteCallerRateLimit is a helper method to define mock.On call +// - ctx context.Context +// - in *cloudservice.DeleteCallerRateLimitRequest +// - opts ...grpc.CallOption +func (_e *MockCloudServiceClient_Expecter) DeleteCallerRateLimit(ctx any, in any, opts ...any) *MockCloudServiceClient_DeleteCallerRateLimit_Call { + return &MockCloudServiceClient_DeleteCallerRateLimit_Call{Call: _e.mock.On("DeleteCallerRateLimit", + append([]any{ctx, in}, opts...)...)} +} + +func (_c *MockCloudServiceClient_DeleteCallerRateLimit_Call) Run(run func(ctx context.Context, in *cloudservice.DeleteCallerRateLimitRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_DeleteCallerRateLimit_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *cloudservice.DeleteCallerRateLimitRequest + if args[1] != nil { + arg1 = args[1].(*cloudservice.DeleteCallerRateLimitRequest) + } + var arg2 []grpc.CallOption + var variadicArgs []grpc.CallOption + if len(args) > 2 { + variadicArgs = args[2].([]grpc.CallOption) + } + arg2 = variadicArgs + run( + arg0, + arg1, + arg2..., + ) + }) + return _c +} + +func (_c *MockCloudServiceClient_DeleteCallerRateLimit_Call) Return(deleteCallerRateLimitResponse *cloudservice.DeleteCallerRateLimitResponse, err error) *MockCloudServiceClient_DeleteCallerRateLimit_Call { + _c.Call.Return(deleteCallerRateLimitResponse, err) + return _c +} + +func (_c *MockCloudServiceClient_DeleteCallerRateLimit_Call) RunAndReturn(run func(ctx context.Context, in *cloudservice.DeleteCallerRateLimitRequest, opts ...grpc.CallOption) (*cloudservice.DeleteCallerRateLimitResponse, error)) *MockCloudServiceClient_DeleteCallerRateLimit_Call { + _c.Call.Return(run) + return _c +} + // DeleteConnectivityRule provides a mock function for the type MockCloudServiceClient func (_mock *MockCloudServiceClient) DeleteConnectivityRule(ctx context.Context, in *cloudservice.DeleteConnectivityRuleRequest, opts ...grpc.CallOption) (*cloudservice.DeleteConnectivityRuleResponse, error) { var tmpRet mock.Arguments @@ -1410,9 +1585,9 @@ type MockCloudServiceClient_DeleteConnectivityRule_Call struct { // - ctx context.Context // - in *cloudservice.DeleteConnectivityRuleRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) DeleteConnectivityRule(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_DeleteConnectivityRule_Call { +func (_e *MockCloudServiceClient_Expecter) DeleteConnectivityRule(ctx any, in any, opts ...any) *MockCloudServiceClient_DeleteConnectivityRule_Call { return &MockCloudServiceClient_DeleteConnectivityRule_Call{Call: _e.mock.On("DeleteConnectivityRule", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_DeleteConnectivityRule_Call) Run(run func(ctx context.Context, in *cloudservice.DeleteConnectivityRuleRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_DeleteConnectivityRule_Call { @@ -1493,9 +1668,9 @@ type MockCloudServiceClient_DeleteCustomRole_Call struct { // - ctx context.Context // - in *cloudservice.DeleteCustomRoleRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) DeleteCustomRole(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_DeleteCustomRole_Call { +func (_e *MockCloudServiceClient_Expecter) DeleteCustomRole(ctx any, in any, opts ...any) *MockCloudServiceClient_DeleteCustomRole_Call { return &MockCloudServiceClient_DeleteCustomRole_Call{Call: _e.mock.On("DeleteCustomRole", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_DeleteCustomRole_Call) Run(run func(ctx context.Context, in *cloudservice.DeleteCustomRoleRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_DeleteCustomRole_Call { @@ -1576,9 +1751,9 @@ type MockCloudServiceClient_DeleteNamespace_Call struct { // - ctx context.Context // - in *cloudservice.DeleteNamespaceRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) DeleteNamespace(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_DeleteNamespace_Call { +func (_e *MockCloudServiceClient_Expecter) DeleteNamespace(ctx any, in any, opts ...any) *MockCloudServiceClient_DeleteNamespace_Call { return &MockCloudServiceClient_DeleteNamespace_Call{Call: _e.mock.On("DeleteNamespace", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_DeleteNamespace_Call) Run(run func(ctx context.Context, in *cloudservice.DeleteNamespaceRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_DeleteNamespace_Call { @@ -1659,9 +1834,9 @@ type MockCloudServiceClient_DeleteNamespaceExportSink_Call struct { // - ctx context.Context // - in *cloudservice.DeleteNamespaceExportSinkRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) DeleteNamespaceExportSink(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_DeleteNamespaceExportSink_Call { +func (_e *MockCloudServiceClient_Expecter) DeleteNamespaceExportSink(ctx any, in any, opts ...any) *MockCloudServiceClient_DeleteNamespaceExportSink_Call { return &MockCloudServiceClient_DeleteNamespaceExportSink_Call{Call: _e.mock.On("DeleteNamespaceExportSink", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_DeleteNamespaceExportSink_Call) Run(run func(ctx context.Context, in *cloudservice.DeleteNamespaceExportSinkRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_DeleteNamespaceExportSink_Call { @@ -1742,9 +1917,9 @@ type MockCloudServiceClient_DeleteNamespaceRegion_Call struct { // - ctx context.Context // - in *cloudservice.DeleteNamespaceRegionRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) DeleteNamespaceRegion(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_DeleteNamespaceRegion_Call { +func (_e *MockCloudServiceClient_Expecter) DeleteNamespaceRegion(ctx any, in any, opts ...any) *MockCloudServiceClient_DeleteNamespaceRegion_Call { return &MockCloudServiceClient_DeleteNamespaceRegion_Call{Call: _e.mock.On("DeleteNamespaceRegion", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_DeleteNamespaceRegion_Call) Run(run func(ctx context.Context, in *cloudservice.DeleteNamespaceRegionRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_DeleteNamespaceRegion_Call { @@ -1825,9 +2000,9 @@ type MockCloudServiceClient_DeleteNexusEndpoint_Call struct { // - ctx context.Context // - in *cloudservice.DeleteNexusEndpointRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) DeleteNexusEndpoint(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_DeleteNexusEndpoint_Call { +func (_e *MockCloudServiceClient_Expecter) DeleteNexusEndpoint(ctx any, in any, opts ...any) *MockCloudServiceClient_DeleteNexusEndpoint_Call { return &MockCloudServiceClient_DeleteNexusEndpoint_Call{Call: _e.mock.On("DeleteNexusEndpoint", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_DeleteNexusEndpoint_Call) Run(run func(ctx context.Context, in *cloudservice.DeleteNexusEndpointRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_DeleteNexusEndpoint_Call { @@ -1908,9 +2083,9 @@ type MockCloudServiceClient_DeleteProject_Call struct { // - ctx context.Context // - in *cloudservice.DeleteProjectRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) DeleteProject(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_DeleteProject_Call { +func (_e *MockCloudServiceClient_Expecter) DeleteProject(ctx any, in any, opts ...any) *MockCloudServiceClient_DeleteProject_Call { return &MockCloudServiceClient_DeleteProject_Call{Call: _e.mock.On("DeleteProject", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_DeleteProject_Call) Run(run func(ctx context.Context, in *cloudservice.DeleteProjectRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_DeleteProject_Call { @@ -1991,9 +2166,9 @@ type MockCloudServiceClient_DeleteServiceAccount_Call struct { // - ctx context.Context // - in *cloudservice.DeleteServiceAccountRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) DeleteServiceAccount(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_DeleteServiceAccount_Call { +func (_e *MockCloudServiceClient_Expecter) DeleteServiceAccount(ctx any, in any, opts ...any) *MockCloudServiceClient_DeleteServiceAccount_Call { return &MockCloudServiceClient_DeleteServiceAccount_Call{Call: _e.mock.On("DeleteServiceAccount", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_DeleteServiceAccount_Call) Run(run func(ctx context.Context, in *cloudservice.DeleteServiceAccountRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_DeleteServiceAccount_Call { @@ -2074,9 +2249,9 @@ type MockCloudServiceClient_DeleteUser_Call struct { // - ctx context.Context // - in *cloudservice.DeleteUserRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) DeleteUser(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_DeleteUser_Call { +func (_e *MockCloudServiceClient_Expecter) DeleteUser(ctx any, in any, opts ...any) *MockCloudServiceClient_DeleteUser_Call { return &MockCloudServiceClient_DeleteUser_Call{Call: _e.mock.On("DeleteUser", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_DeleteUser_Call) Run(run func(ctx context.Context, in *cloudservice.DeleteUserRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_DeleteUser_Call { @@ -2157,9 +2332,9 @@ type MockCloudServiceClient_DeleteUserGroup_Call struct { // - ctx context.Context // - in *cloudservice.DeleteUserGroupRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) DeleteUserGroup(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_DeleteUserGroup_Call { +func (_e *MockCloudServiceClient_Expecter) DeleteUserGroup(ctx any, in any, opts ...any) *MockCloudServiceClient_DeleteUserGroup_Call { return &MockCloudServiceClient_DeleteUserGroup_Call{Call: _e.mock.On("DeleteUserGroup", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_DeleteUserGroup_Call) Run(run func(ctx context.Context, in *cloudservice.DeleteUserGroupRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_DeleteUserGroup_Call { @@ -2240,9 +2415,9 @@ type MockCloudServiceClient_FailoverNamespaceRegion_Call struct { // - ctx context.Context // - in *cloudservice.FailoverNamespaceRegionRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) FailoverNamespaceRegion(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_FailoverNamespaceRegion_Call { +func (_e *MockCloudServiceClient_Expecter) FailoverNamespaceRegion(ctx any, in any, opts ...any) *MockCloudServiceClient_FailoverNamespaceRegion_Call { return &MockCloudServiceClient_FailoverNamespaceRegion_Call{Call: _e.mock.On("FailoverNamespaceRegion", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_FailoverNamespaceRegion_Call) Run(run func(ctx context.Context, in *cloudservice.FailoverNamespaceRegionRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_FailoverNamespaceRegion_Call { @@ -2323,9 +2498,9 @@ type MockCloudServiceClient_GetAccount_Call struct { // - ctx context.Context // - in *cloudservice.GetAccountRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetAccount(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetAccount_Call { +func (_e *MockCloudServiceClient_Expecter) GetAccount(ctx any, in any, opts ...any) *MockCloudServiceClient_GetAccount_Call { return &MockCloudServiceClient_GetAccount_Call{Call: _e.mock.On("GetAccount", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetAccount_Call) Run(run func(ctx context.Context, in *cloudservice.GetAccountRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetAccount_Call { @@ -2406,9 +2581,9 @@ type MockCloudServiceClient_GetAccountAuditLogSink_Call struct { // - ctx context.Context // - in *cloudservice.GetAccountAuditLogSinkRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetAccountAuditLogSink(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetAccountAuditLogSink_Call { +func (_e *MockCloudServiceClient_Expecter) GetAccountAuditLogSink(ctx any, in any, opts ...any) *MockCloudServiceClient_GetAccountAuditLogSink_Call { return &MockCloudServiceClient_GetAccountAuditLogSink_Call{Call: _e.mock.On("GetAccountAuditLogSink", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetAccountAuditLogSink_Call) Run(run func(ctx context.Context, in *cloudservice.GetAccountAuditLogSinkRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetAccountAuditLogSink_Call { @@ -2489,9 +2664,9 @@ type MockCloudServiceClient_GetAccountAuditLogSinks_Call struct { // - ctx context.Context // - in *cloudservice.GetAccountAuditLogSinksRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetAccountAuditLogSinks(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetAccountAuditLogSinks_Call { +func (_e *MockCloudServiceClient_Expecter) GetAccountAuditLogSinks(ctx any, in any, opts ...any) *MockCloudServiceClient_GetAccountAuditLogSinks_Call { return &MockCloudServiceClient_GetAccountAuditLogSinks_Call{Call: _e.mock.On("GetAccountAuditLogSinks", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetAccountAuditLogSinks_Call) Run(run func(ctx context.Context, in *cloudservice.GetAccountAuditLogSinksRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetAccountAuditLogSinks_Call { @@ -2572,9 +2747,9 @@ type MockCloudServiceClient_GetApiKey_Call struct { // - ctx context.Context // - in *cloudservice.GetApiKeyRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetApiKey(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetApiKey_Call { +func (_e *MockCloudServiceClient_Expecter) GetApiKey(ctx any, in any, opts ...any) *MockCloudServiceClient_GetApiKey_Call { return &MockCloudServiceClient_GetApiKey_Call{Call: _e.mock.On("GetApiKey", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetApiKey_Call) Run(run func(ctx context.Context, in *cloudservice.GetApiKeyRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetApiKey_Call { @@ -2655,9 +2830,9 @@ type MockCloudServiceClient_GetApiKeys_Call struct { // - ctx context.Context // - in *cloudservice.GetApiKeysRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetApiKeys(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetApiKeys_Call { +func (_e *MockCloudServiceClient_Expecter) GetApiKeys(ctx any, in any, opts ...any) *MockCloudServiceClient_GetApiKeys_Call { return &MockCloudServiceClient_GetApiKeys_Call{Call: _e.mock.On("GetApiKeys", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetApiKeys_Call) Run(run func(ctx context.Context, in *cloudservice.GetApiKeysRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetApiKeys_Call { @@ -2738,9 +2913,9 @@ type MockCloudServiceClient_GetAsyncOperation_Call struct { // - ctx context.Context // - in *cloudservice.GetAsyncOperationRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetAsyncOperation(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetAsyncOperation_Call { +func (_e *MockCloudServiceClient_Expecter) GetAsyncOperation(ctx any, in any, opts ...any) *MockCloudServiceClient_GetAsyncOperation_Call { return &MockCloudServiceClient_GetAsyncOperation_Call{Call: _e.mock.On("GetAsyncOperation", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetAsyncOperation_Call) Run(run func(ctx context.Context, in *cloudservice.GetAsyncOperationRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetAsyncOperation_Call { @@ -2821,9 +2996,9 @@ type MockCloudServiceClient_GetAuditLogs_Call struct { // - ctx context.Context // - in *cloudservice.GetAuditLogsRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetAuditLogs(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetAuditLogs_Call { +func (_e *MockCloudServiceClient_Expecter) GetAuditLogs(ctx any, in any, opts ...any) *MockCloudServiceClient_GetAuditLogs_Call { return &MockCloudServiceClient_GetAuditLogs_Call{Call: _e.mock.On("GetAuditLogs", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetAuditLogs_Call) Run(run func(ctx context.Context, in *cloudservice.GetAuditLogsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetAuditLogs_Call { @@ -2904,9 +3079,9 @@ type MockCloudServiceClient_GetBillingReport_Call struct { // - ctx context.Context // - in *cloudservice.GetBillingReportRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetBillingReport(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetBillingReport_Call { +func (_e *MockCloudServiceClient_Expecter) GetBillingReport(ctx any, in any, opts ...any) *MockCloudServiceClient_GetBillingReport_Call { return &MockCloudServiceClient_GetBillingReport_Call{Call: _e.mock.On("GetBillingReport", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetBillingReport_Call) Run(run func(ctx context.Context, in *cloudservice.GetBillingReportRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetBillingReport_Call { @@ -2944,6 +3119,172 @@ func (_c *MockCloudServiceClient_GetBillingReport_Call) RunAndReturn(run func(ct return _c } +// GetCallerRateLimit provides a mock function for the type MockCloudServiceClient +func (_mock *MockCloudServiceClient) GetCallerRateLimit(ctx context.Context, in *cloudservice.GetCallerRateLimitRequest, opts ...grpc.CallOption) (*cloudservice.GetCallerRateLimitResponse, error) { + var tmpRet mock.Arguments + if len(opts) > 0 { + tmpRet = _mock.Called(ctx, in, opts) + } else { + tmpRet = _mock.Called(ctx, in) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for GetCallerRateLimit") + } + + var r0 *cloudservice.GetCallerRateLimitResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *cloudservice.GetCallerRateLimitRequest, ...grpc.CallOption) (*cloudservice.GetCallerRateLimitResponse, error)); ok { + return returnFunc(ctx, in, opts...) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *cloudservice.GetCallerRateLimitRequest, ...grpc.CallOption) *cloudservice.GetCallerRateLimitResponse); ok { + r0 = returnFunc(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*cloudservice.GetCallerRateLimitResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *cloudservice.GetCallerRateLimitRequest, ...grpc.CallOption) error); ok { + r1 = returnFunc(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockCloudServiceClient_GetCallerRateLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCallerRateLimit' +type MockCloudServiceClient_GetCallerRateLimit_Call struct { + *mock.Call +} + +// GetCallerRateLimit is a helper method to define mock.On call +// - ctx context.Context +// - in *cloudservice.GetCallerRateLimitRequest +// - opts ...grpc.CallOption +func (_e *MockCloudServiceClient_Expecter) GetCallerRateLimit(ctx any, in any, opts ...any) *MockCloudServiceClient_GetCallerRateLimit_Call { + return &MockCloudServiceClient_GetCallerRateLimit_Call{Call: _e.mock.On("GetCallerRateLimit", + append([]any{ctx, in}, opts...)...)} +} + +func (_c *MockCloudServiceClient_GetCallerRateLimit_Call) Run(run func(ctx context.Context, in *cloudservice.GetCallerRateLimitRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetCallerRateLimit_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *cloudservice.GetCallerRateLimitRequest + if args[1] != nil { + arg1 = args[1].(*cloudservice.GetCallerRateLimitRequest) + } + var arg2 []grpc.CallOption + var variadicArgs []grpc.CallOption + if len(args) > 2 { + variadicArgs = args[2].([]grpc.CallOption) + } + arg2 = variadicArgs + run( + arg0, + arg1, + arg2..., + ) + }) + return _c +} + +func (_c *MockCloudServiceClient_GetCallerRateLimit_Call) Return(getCallerRateLimitResponse *cloudservice.GetCallerRateLimitResponse, err error) *MockCloudServiceClient_GetCallerRateLimit_Call { + _c.Call.Return(getCallerRateLimitResponse, err) + return _c +} + +func (_c *MockCloudServiceClient_GetCallerRateLimit_Call) RunAndReturn(run func(ctx context.Context, in *cloudservice.GetCallerRateLimitRequest, opts ...grpc.CallOption) (*cloudservice.GetCallerRateLimitResponse, error)) *MockCloudServiceClient_GetCallerRateLimit_Call { + _c.Call.Return(run) + return _c +} + +// GetCallerRateLimits provides a mock function for the type MockCloudServiceClient +func (_mock *MockCloudServiceClient) GetCallerRateLimits(ctx context.Context, in *cloudservice.GetCallerRateLimitsRequest, opts ...grpc.CallOption) (*cloudservice.GetCallerRateLimitsResponse, error) { + var tmpRet mock.Arguments + if len(opts) > 0 { + tmpRet = _mock.Called(ctx, in, opts) + } else { + tmpRet = _mock.Called(ctx, in) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for GetCallerRateLimits") + } + + var r0 *cloudservice.GetCallerRateLimitsResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *cloudservice.GetCallerRateLimitsRequest, ...grpc.CallOption) (*cloudservice.GetCallerRateLimitsResponse, error)); ok { + return returnFunc(ctx, in, opts...) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *cloudservice.GetCallerRateLimitsRequest, ...grpc.CallOption) *cloudservice.GetCallerRateLimitsResponse); ok { + r0 = returnFunc(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*cloudservice.GetCallerRateLimitsResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *cloudservice.GetCallerRateLimitsRequest, ...grpc.CallOption) error); ok { + r1 = returnFunc(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockCloudServiceClient_GetCallerRateLimits_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCallerRateLimits' +type MockCloudServiceClient_GetCallerRateLimits_Call struct { + *mock.Call +} + +// GetCallerRateLimits is a helper method to define mock.On call +// - ctx context.Context +// - in *cloudservice.GetCallerRateLimitsRequest +// - opts ...grpc.CallOption +func (_e *MockCloudServiceClient_Expecter) GetCallerRateLimits(ctx any, in any, opts ...any) *MockCloudServiceClient_GetCallerRateLimits_Call { + return &MockCloudServiceClient_GetCallerRateLimits_Call{Call: _e.mock.On("GetCallerRateLimits", + append([]any{ctx, in}, opts...)...)} +} + +func (_c *MockCloudServiceClient_GetCallerRateLimits_Call) Run(run func(ctx context.Context, in *cloudservice.GetCallerRateLimitsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetCallerRateLimits_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *cloudservice.GetCallerRateLimitsRequest + if args[1] != nil { + arg1 = args[1].(*cloudservice.GetCallerRateLimitsRequest) + } + var arg2 []grpc.CallOption + var variadicArgs []grpc.CallOption + if len(args) > 2 { + variadicArgs = args[2].([]grpc.CallOption) + } + arg2 = variadicArgs + run( + arg0, + arg1, + arg2..., + ) + }) + return _c +} + +func (_c *MockCloudServiceClient_GetCallerRateLimits_Call) Return(getCallerRateLimitsResponse *cloudservice.GetCallerRateLimitsResponse, err error) *MockCloudServiceClient_GetCallerRateLimits_Call { + _c.Call.Return(getCallerRateLimitsResponse, err) + return _c +} + +func (_c *MockCloudServiceClient_GetCallerRateLimits_Call) RunAndReturn(run func(ctx context.Context, in *cloudservice.GetCallerRateLimitsRequest, opts ...grpc.CallOption) (*cloudservice.GetCallerRateLimitsResponse, error)) *MockCloudServiceClient_GetCallerRateLimits_Call { + _c.Call.Return(run) + return _c +} + // GetConnectivityRule provides a mock function for the type MockCloudServiceClient func (_mock *MockCloudServiceClient) GetConnectivityRule(ctx context.Context, in *cloudservice.GetConnectivityRuleRequest, opts ...grpc.CallOption) (*cloudservice.GetConnectivityRuleResponse, error) { var tmpRet mock.Arguments @@ -2987,9 +3328,9 @@ type MockCloudServiceClient_GetConnectivityRule_Call struct { // - ctx context.Context // - in *cloudservice.GetConnectivityRuleRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetConnectivityRule(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetConnectivityRule_Call { +func (_e *MockCloudServiceClient_Expecter) GetConnectivityRule(ctx any, in any, opts ...any) *MockCloudServiceClient_GetConnectivityRule_Call { return &MockCloudServiceClient_GetConnectivityRule_Call{Call: _e.mock.On("GetConnectivityRule", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetConnectivityRule_Call) Run(run func(ctx context.Context, in *cloudservice.GetConnectivityRuleRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetConnectivityRule_Call { @@ -3070,9 +3411,9 @@ type MockCloudServiceClient_GetConnectivityRules_Call struct { // - ctx context.Context // - in *cloudservice.GetConnectivityRulesRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetConnectivityRules(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetConnectivityRules_Call { +func (_e *MockCloudServiceClient_Expecter) GetConnectivityRules(ctx any, in any, opts ...any) *MockCloudServiceClient_GetConnectivityRules_Call { return &MockCloudServiceClient_GetConnectivityRules_Call{Call: _e.mock.On("GetConnectivityRules", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetConnectivityRules_Call) Run(run func(ctx context.Context, in *cloudservice.GetConnectivityRulesRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetConnectivityRules_Call { @@ -3153,9 +3494,9 @@ type MockCloudServiceClient_GetCurrentIdentity_Call struct { // - ctx context.Context // - in *cloudservice.GetCurrentIdentityRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetCurrentIdentity(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetCurrentIdentity_Call { +func (_e *MockCloudServiceClient_Expecter) GetCurrentIdentity(ctx any, in any, opts ...any) *MockCloudServiceClient_GetCurrentIdentity_Call { return &MockCloudServiceClient_GetCurrentIdentity_Call{Call: _e.mock.On("GetCurrentIdentity", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetCurrentIdentity_Call) Run(run func(ctx context.Context, in *cloudservice.GetCurrentIdentityRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetCurrentIdentity_Call { @@ -3236,9 +3577,9 @@ type MockCloudServiceClient_GetCustomRole_Call struct { // - ctx context.Context // - in *cloudservice.GetCustomRoleRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetCustomRole(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetCustomRole_Call { +func (_e *MockCloudServiceClient_Expecter) GetCustomRole(ctx any, in any, opts ...any) *MockCloudServiceClient_GetCustomRole_Call { return &MockCloudServiceClient_GetCustomRole_Call{Call: _e.mock.On("GetCustomRole", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetCustomRole_Call) Run(run func(ctx context.Context, in *cloudservice.GetCustomRoleRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetCustomRole_Call { @@ -3319,9 +3660,9 @@ type MockCloudServiceClient_GetCustomRoles_Call struct { // - ctx context.Context // - in *cloudservice.GetCustomRolesRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetCustomRoles(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetCustomRoles_Call { +func (_e *MockCloudServiceClient_Expecter) GetCustomRoles(ctx any, in any, opts ...any) *MockCloudServiceClient_GetCustomRoles_Call { return &MockCloudServiceClient_GetCustomRoles_Call{Call: _e.mock.On("GetCustomRoles", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetCustomRoles_Call) Run(run func(ctx context.Context, in *cloudservice.GetCustomRolesRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetCustomRoles_Call { @@ -3402,9 +3743,9 @@ type MockCloudServiceClient_GetNamespace_Call struct { // - ctx context.Context // - in *cloudservice.GetNamespaceRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetNamespace(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetNamespace_Call { +func (_e *MockCloudServiceClient_Expecter) GetNamespace(ctx any, in any, opts ...any) *MockCloudServiceClient_GetNamespace_Call { return &MockCloudServiceClient_GetNamespace_Call{Call: _e.mock.On("GetNamespace", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetNamespace_Call) Run(run func(ctx context.Context, in *cloudservice.GetNamespaceRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetNamespace_Call { @@ -3485,9 +3826,9 @@ type MockCloudServiceClient_GetNamespaceCapacityInfo_Call struct { // - ctx context.Context // - in *cloudservice.GetNamespaceCapacityInfoRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetNamespaceCapacityInfo(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetNamespaceCapacityInfo_Call { +func (_e *MockCloudServiceClient_Expecter) GetNamespaceCapacityInfo(ctx any, in any, opts ...any) *MockCloudServiceClient_GetNamespaceCapacityInfo_Call { return &MockCloudServiceClient_GetNamespaceCapacityInfo_Call{Call: _e.mock.On("GetNamespaceCapacityInfo", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetNamespaceCapacityInfo_Call) Run(run func(ctx context.Context, in *cloudservice.GetNamespaceCapacityInfoRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetNamespaceCapacityInfo_Call { @@ -3568,9 +3909,9 @@ type MockCloudServiceClient_GetNamespaceExportSink_Call struct { // - ctx context.Context // - in *cloudservice.GetNamespaceExportSinkRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetNamespaceExportSink(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetNamespaceExportSink_Call { +func (_e *MockCloudServiceClient_Expecter) GetNamespaceExportSink(ctx any, in any, opts ...any) *MockCloudServiceClient_GetNamespaceExportSink_Call { return &MockCloudServiceClient_GetNamespaceExportSink_Call{Call: _e.mock.On("GetNamespaceExportSink", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetNamespaceExportSink_Call) Run(run func(ctx context.Context, in *cloudservice.GetNamespaceExportSinkRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetNamespaceExportSink_Call { @@ -3651,9 +3992,9 @@ type MockCloudServiceClient_GetNamespaceExportSinks_Call struct { // - ctx context.Context // - in *cloudservice.GetNamespaceExportSinksRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetNamespaceExportSinks(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetNamespaceExportSinks_Call { +func (_e *MockCloudServiceClient_Expecter) GetNamespaceExportSinks(ctx any, in any, opts ...any) *MockCloudServiceClient_GetNamespaceExportSinks_Call { return &MockCloudServiceClient_GetNamespaceExportSinks_Call{Call: _e.mock.On("GetNamespaceExportSinks", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetNamespaceExportSinks_Call) Run(run func(ctx context.Context, in *cloudservice.GetNamespaceExportSinksRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetNamespaceExportSinks_Call { @@ -3734,9 +4075,9 @@ type MockCloudServiceClient_GetNamespaces_Call struct { // - ctx context.Context // - in *cloudservice.GetNamespacesRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetNamespaces(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetNamespaces_Call { +func (_e *MockCloudServiceClient_Expecter) GetNamespaces(ctx any, in any, opts ...any) *MockCloudServiceClient_GetNamespaces_Call { return &MockCloudServiceClient_GetNamespaces_Call{Call: _e.mock.On("GetNamespaces", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetNamespaces_Call) Run(run func(ctx context.Context, in *cloudservice.GetNamespacesRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetNamespaces_Call { @@ -3817,9 +4158,9 @@ type MockCloudServiceClient_GetNexusEndpoint_Call struct { // - ctx context.Context // - in *cloudservice.GetNexusEndpointRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetNexusEndpoint(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetNexusEndpoint_Call { +func (_e *MockCloudServiceClient_Expecter) GetNexusEndpoint(ctx any, in any, opts ...any) *MockCloudServiceClient_GetNexusEndpoint_Call { return &MockCloudServiceClient_GetNexusEndpoint_Call{Call: _e.mock.On("GetNexusEndpoint", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetNexusEndpoint_Call) Run(run func(ctx context.Context, in *cloudservice.GetNexusEndpointRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetNexusEndpoint_Call { @@ -3900,9 +4241,9 @@ type MockCloudServiceClient_GetNexusEndpoints_Call struct { // - ctx context.Context // - in *cloudservice.GetNexusEndpointsRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetNexusEndpoints(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetNexusEndpoints_Call { +func (_e *MockCloudServiceClient_Expecter) GetNexusEndpoints(ctx any, in any, opts ...any) *MockCloudServiceClient_GetNexusEndpoints_Call { return &MockCloudServiceClient_GetNexusEndpoints_Call{Call: _e.mock.On("GetNexusEndpoints", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetNexusEndpoints_Call) Run(run func(ctx context.Context, in *cloudservice.GetNexusEndpointsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetNexusEndpoints_Call { @@ -3983,9 +4324,9 @@ type MockCloudServiceClient_GetProject_Call struct { // - ctx context.Context // - in *cloudservice.GetProjectRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetProject(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetProject_Call { +func (_e *MockCloudServiceClient_Expecter) GetProject(ctx any, in any, opts ...any) *MockCloudServiceClient_GetProject_Call { return &MockCloudServiceClient_GetProject_Call{Call: _e.mock.On("GetProject", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetProject_Call) Run(run func(ctx context.Context, in *cloudservice.GetProjectRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetProject_Call { @@ -4066,9 +4407,9 @@ type MockCloudServiceClient_GetProjectScopedServiceAccounts_Call struct { // - ctx context.Context // - in *cloudservice.GetProjectScopedServiceAccountsRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetProjectScopedServiceAccounts(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetProjectScopedServiceAccounts_Call { +func (_e *MockCloudServiceClient_Expecter) GetProjectScopedServiceAccounts(ctx any, in any, opts ...any) *MockCloudServiceClient_GetProjectScopedServiceAccounts_Call { return &MockCloudServiceClient_GetProjectScopedServiceAccounts_Call{Call: _e.mock.On("GetProjectScopedServiceAccounts", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetProjectScopedServiceAccounts_Call) Run(run func(ctx context.Context, in *cloudservice.GetProjectScopedServiceAccountsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetProjectScopedServiceAccounts_Call { @@ -4149,9 +4490,9 @@ type MockCloudServiceClient_GetProjects_Call struct { // - ctx context.Context // - in *cloudservice.GetProjectsRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetProjects(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetProjects_Call { +func (_e *MockCloudServiceClient_Expecter) GetProjects(ctx any, in any, opts ...any) *MockCloudServiceClient_GetProjects_Call { return &MockCloudServiceClient_GetProjects_Call{Call: _e.mock.On("GetProjects", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetProjects_Call) Run(run func(ctx context.Context, in *cloudservice.GetProjectsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetProjects_Call { @@ -4232,9 +4573,9 @@ type MockCloudServiceClient_GetRegion_Call struct { // - ctx context.Context // - in *cloudservice.GetRegionRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetRegion(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetRegion_Call { +func (_e *MockCloudServiceClient_Expecter) GetRegion(ctx any, in any, opts ...any) *MockCloudServiceClient_GetRegion_Call { return &MockCloudServiceClient_GetRegion_Call{Call: _e.mock.On("GetRegion", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetRegion_Call) Run(run func(ctx context.Context, in *cloudservice.GetRegionRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetRegion_Call { @@ -4315,9 +4656,9 @@ type MockCloudServiceClient_GetRegions_Call struct { // - ctx context.Context // - in *cloudservice.GetRegionsRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetRegions(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetRegions_Call { +func (_e *MockCloudServiceClient_Expecter) GetRegions(ctx any, in any, opts ...any) *MockCloudServiceClient_GetRegions_Call { return &MockCloudServiceClient_GetRegions_Call{Call: _e.mock.On("GetRegions", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetRegions_Call) Run(run func(ctx context.Context, in *cloudservice.GetRegionsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetRegions_Call { @@ -4398,9 +4739,9 @@ type MockCloudServiceClient_GetServiceAccount_Call struct { // - ctx context.Context // - in *cloudservice.GetServiceAccountRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetServiceAccount(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetServiceAccount_Call { +func (_e *MockCloudServiceClient_Expecter) GetServiceAccount(ctx any, in any, opts ...any) *MockCloudServiceClient_GetServiceAccount_Call { return &MockCloudServiceClient_GetServiceAccount_Call{Call: _e.mock.On("GetServiceAccount", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetServiceAccount_Call) Run(run func(ctx context.Context, in *cloudservice.GetServiceAccountRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetServiceAccount_Call { @@ -4481,9 +4822,9 @@ type MockCloudServiceClient_GetServiceAccountNamespaceAssignments_Call struct { // - ctx context.Context // - in *cloudservice.GetServiceAccountNamespaceAssignmentsRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetServiceAccountNamespaceAssignments(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetServiceAccountNamespaceAssignments_Call { +func (_e *MockCloudServiceClient_Expecter) GetServiceAccountNamespaceAssignments(ctx any, in any, opts ...any) *MockCloudServiceClient_GetServiceAccountNamespaceAssignments_Call { return &MockCloudServiceClient_GetServiceAccountNamespaceAssignments_Call{Call: _e.mock.On("GetServiceAccountNamespaceAssignments", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetServiceAccountNamespaceAssignments_Call) Run(run func(ctx context.Context, in *cloudservice.GetServiceAccountNamespaceAssignmentsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetServiceAccountNamespaceAssignments_Call { @@ -4564,9 +4905,9 @@ type MockCloudServiceClient_GetServiceAccountProjectAssignments_Call struct { // - ctx context.Context // - in *cloudservice.GetServiceAccountProjectAssignmentsRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetServiceAccountProjectAssignments(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetServiceAccountProjectAssignments_Call { +func (_e *MockCloudServiceClient_Expecter) GetServiceAccountProjectAssignments(ctx any, in any, opts ...any) *MockCloudServiceClient_GetServiceAccountProjectAssignments_Call { return &MockCloudServiceClient_GetServiceAccountProjectAssignments_Call{Call: _e.mock.On("GetServiceAccountProjectAssignments", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetServiceAccountProjectAssignments_Call) Run(run func(ctx context.Context, in *cloudservice.GetServiceAccountProjectAssignmentsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetServiceAccountProjectAssignments_Call { @@ -4647,9 +4988,9 @@ type MockCloudServiceClient_GetServiceAccounts_Call struct { // - ctx context.Context // - in *cloudservice.GetServiceAccountsRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetServiceAccounts(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetServiceAccounts_Call { +func (_e *MockCloudServiceClient_Expecter) GetServiceAccounts(ctx any, in any, opts ...any) *MockCloudServiceClient_GetServiceAccounts_Call { return &MockCloudServiceClient_GetServiceAccounts_Call{Call: _e.mock.On("GetServiceAccounts", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetServiceAccounts_Call) Run(run func(ctx context.Context, in *cloudservice.GetServiceAccountsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetServiceAccounts_Call { @@ -4730,9 +5071,9 @@ type MockCloudServiceClient_GetUsage_Call struct { // - ctx context.Context // - in *cloudservice.GetUsageRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetUsage(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetUsage_Call { +func (_e *MockCloudServiceClient_Expecter) GetUsage(ctx any, in any, opts ...any) *MockCloudServiceClient_GetUsage_Call { return &MockCloudServiceClient_GetUsage_Call{Call: _e.mock.On("GetUsage", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetUsage_Call) Run(run func(ctx context.Context, in *cloudservice.GetUsageRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetUsage_Call { @@ -4813,9 +5154,9 @@ type MockCloudServiceClient_GetUser_Call struct { // - ctx context.Context // - in *cloudservice.GetUserRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetUser(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetUser_Call { +func (_e *MockCloudServiceClient_Expecter) GetUser(ctx any, in any, opts ...any) *MockCloudServiceClient_GetUser_Call { return &MockCloudServiceClient_GetUser_Call{Call: _e.mock.On("GetUser", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetUser_Call) Run(run func(ctx context.Context, in *cloudservice.GetUserRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetUser_Call { @@ -4896,9 +5237,9 @@ type MockCloudServiceClient_GetUserGroup_Call struct { // - ctx context.Context // - in *cloudservice.GetUserGroupRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetUserGroup(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetUserGroup_Call { +func (_e *MockCloudServiceClient_Expecter) GetUserGroup(ctx any, in any, opts ...any) *MockCloudServiceClient_GetUserGroup_Call { return &MockCloudServiceClient_GetUserGroup_Call{Call: _e.mock.On("GetUserGroup", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetUserGroup_Call) Run(run func(ctx context.Context, in *cloudservice.GetUserGroupRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetUserGroup_Call { @@ -4979,9 +5320,9 @@ type MockCloudServiceClient_GetUserGroupMembers_Call struct { // - ctx context.Context // - in *cloudservice.GetUserGroupMembersRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetUserGroupMembers(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetUserGroupMembers_Call { +func (_e *MockCloudServiceClient_Expecter) GetUserGroupMembers(ctx any, in any, opts ...any) *MockCloudServiceClient_GetUserGroupMembers_Call { return &MockCloudServiceClient_GetUserGroupMembers_Call{Call: _e.mock.On("GetUserGroupMembers", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetUserGroupMembers_Call) Run(run func(ctx context.Context, in *cloudservice.GetUserGroupMembersRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetUserGroupMembers_Call { @@ -5062,9 +5403,9 @@ type MockCloudServiceClient_GetUserGroupNamespaceAssignments_Call struct { // - ctx context.Context // - in *cloudservice.GetUserGroupNamespaceAssignmentsRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetUserGroupNamespaceAssignments(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetUserGroupNamespaceAssignments_Call { +func (_e *MockCloudServiceClient_Expecter) GetUserGroupNamespaceAssignments(ctx any, in any, opts ...any) *MockCloudServiceClient_GetUserGroupNamespaceAssignments_Call { return &MockCloudServiceClient_GetUserGroupNamespaceAssignments_Call{Call: _e.mock.On("GetUserGroupNamespaceAssignments", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetUserGroupNamespaceAssignments_Call) Run(run func(ctx context.Context, in *cloudservice.GetUserGroupNamespaceAssignmentsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetUserGroupNamespaceAssignments_Call { @@ -5145,9 +5486,9 @@ type MockCloudServiceClient_GetUserGroupProjectAssignments_Call struct { // - ctx context.Context // - in *cloudservice.GetUserGroupProjectAssignmentsRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetUserGroupProjectAssignments(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetUserGroupProjectAssignments_Call { +func (_e *MockCloudServiceClient_Expecter) GetUserGroupProjectAssignments(ctx any, in any, opts ...any) *MockCloudServiceClient_GetUserGroupProjectAssignments_Call { return &MockCloudServiceClient_GetUserGroupProjectAssignments_Call{Call: _e.mock.On("GetUserGroupProjectAssignments", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetUserGroupProjectAssignments_Call) Run(run func(ctx context.Context, in *cloudservice.GetUserGroupProjectAssignmentsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetUserGroupProjectAssignments_Call { @@ -5228,9 +5569,9 @@ type MockCloudServiceClient_GetUserGroups_Call struct { // - ctx context.Context // - in *cloudservice.GetUserGroupsRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetUserGroups(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetUserGroups_Call { +func (_e *MockCloudServiceClient_Expecter) GetUserGroups(ctx any, in any, opts ...any) *MockCloudServiceClient_GetUserGroups_Call { return &MockCloudServiceClient_GetUserGroups_Call{Call: _e.mock.On("GetUserGroups", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetUserGroups_Call) Run(run func(ctx context.Context, in *cloudservice.GetUserGroupsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetUserGroups_Call { @@ -5311,9 +5652,9 @@ type MockCloudServiceClient_GetUserNamespaceAssignments_Call struct { // - ctx context.Context // - in *cloudservice.GetUserNamespaceAssignmentsRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetUserNamespaceAssignments(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetUserNamespaceAssignments_Call { +func (_e *MockCloudServiceClient_Expecter) GetUserNamespaceAssignments(ctx any, in any, opts ...any) *MockCloudServiceClient_GetUserNamespaceAssignments_Call { return &MockCloudServiceClient_GetUserNamespaceAssignments_Call{Call: _e.mock.On("GetUserNamespaceAssignments", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetUserNamespaceAssignments_Call) Run(run func(ctx context.Context, in *cloudservice.GetUserNamespaceAssignmentsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetUserNamespaceAssignments_Call { @@ -5394,9 +5735,9 @@ type MockCloudServiceClient_GetUserProjectAssignments_Call struct { // - ctx context.Context // - in *cloudservice.GetUserProjectAssignmentsRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetUserProjectAssignments(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetUserProjectAssignments_Call { +func (_e *MockCloudServiceClient_Expecter) GetUserProjectAssignments(ctx any, in any, opts ...any) *MockCloudServiceClient_GetUserProjectAssignments_Call { return &MockCloudServiceClient_GetUserProjectAssignments_Call{Call: _e.mock.On("GetUserProjectAssignments", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetUserProjectAssignments_Call) Run(run func(ctx context.Context, in *cloudservice.GetUserProjectAssignmentsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetUserProjectAssignments_Call { @@ -5477,9 +5818,9 @@ type MockCloudServiceClient_GetUsers_Call struct { // - ctx context.Context // - in *cloudservice.GetUsersRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) GetUsers(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_GetUsers_Call { +func (_e *MockCloudServiceClient_Expecter) GetUsers(ctx any, in any, opts ...any) *MockCloudServiceClient_GetUsers_Call { return &MockCloudServiceClient_GetUsers_Call{Call: _e.mock.On("GetUsers", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_GetUsers_Call) Run(run func(ctx context.Context, in *cloudservice.GetUsersRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_GetUsers_Call { @@ -5560,9 +5901,9 @@ type MockCloudServiceClient_MoveNamespaceToProject_Call struct { // - ctx context.Context // - in *cloudservice.MoveNamespaceToProjectRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) MoveNamespaceToProject(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_MoveNamespaceToProject_Call { +func (_e *MockCloudServiceClient_Expecter) MoveNamespaceToProject(ctx any, in any, opts ...any) *MockCloudServiceClient_MoveNamespaceToProject_Call { return &MockCloudServiceClient_MoveNamespaceToProject_Call{Call: _e.mock.On("MoveNamespaceToProject", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_MoveNamespaceToProject_Call) Run(run func(ctx context.Context, in *cloudservice.MoveNamespaceToProjectRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_MoveNamespaceToProject_Call { @@ -5643,9 +5984,9 @@ type MockCloudServiceClient_MoveNexusEndpointToProject_Call struct { // - ctx context.Context // - in *cloudservice.MoveNexusEndpointToProjectRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) MoveNexusEndpointToProject(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_MoveNexusEndpointToProject_Call { +func (_e *MockCloudServiceClient_Expecter) MoveNexusEndpointToProject(ctx any, in any, opts ...any) *MockCloudServiceClient_MoveNexusEndpointToProject_Call { return &MockCloudServiceClient_MoveNexusEndpointToProject_Call{Call: _e.mock.On("MoveNexusEndpointToProject", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_MoveNexusEndpointToProject_Call) Run(run func(ctx context.Context, in *cloudservice.MoveNexusEndpointToProjectRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_MoveNexusEndpointToProject_Call { @@ -5726,9 +6067,9 @@ type MockCloudServiceClient_RemoveUserGroupMember_Call struct { // - ctx context.Context // - in *cloudservice.RemoveUserGroupMemberRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) RemoveUserGroupMember(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_RemoveUserGroupMember_Call { +func (_e *MockCloudServiceClient_Expecter) RemoveUserGroupMember(ctx any, in any, opts ...any) *MockCloudServiceClient_RemoveUserGroupMember_Call { return &MockCloudServiceClient_RemoveUserGroupMember_Call{Call: _e.mock.On("RemoveUserGroupMember", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_RemoveUserGroupMember_Call) Run(run func(ctx context.Context, in *cloudservice.RemoveUserGroupMemberRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_RemoveUserGroupMember_Call { @@ -5809,9 +6150,9 @@ type MockCloudServiceClient_RenameCustomSearchAttribute_Call struct { // - ctx context.Context // - in *cloudservice.RenameCustomSearchAttributeRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) RenameCustomSearchAttribute(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_RenameCustomSearchAttribute_Call { +func (_e *MockCloudServiceClient_Expecter) RenameCustomSearchAttribute(ctx any, in any, opts ...any) *MockCloudServiceClient_RenameCustomSearchAttribute_Call { return &MockCloudServiceClient_RenameCustomSearchAttribute_Call{Call: _e.mock.On("RenameCustomSearchAttribute", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_RenameCustomSearchAttribute_Call) Run(run func(ctx context.Context, in *cloudservice.RenameCustomSearchAttributeRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_RenameCustomSearchAttribute_Call { @@ -5892,9 +6233,9 @@ type MockCloudServiceClient_SetServiceAccountNamespaceAccess_Call struct { // - ctx context.Context // - in *cloudservice.SetServiceAccountNamespaceAccessRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) SetServiceAccountNamespaceAccess(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_SetServiceAccountNamespaceAccess_Call { +func (_e *MockCloudServiceClient_Expecter) SetServiceAccountNamespaceAccess(ctx any, in any, opts ...any) *MockCloudServiceClient_SetServiceAccountNamespaceAccess_Call { return &MockCloudServiceClient_SetServiceAccountNamespaceAccess_Call{Call: _e.mock.On("SetServiceAccountNamespaceAccess", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_SetServiceAccountNamespaceAccess_Call) Run(run func(ctx context.Context, in *cloudservice.SetServiceAccountNamespaceAccessRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_SetServiceAccountNamespaceAccess_Call { @@ -5975,9 +6316,9 @@ type MockCloudServiceClient_SetServiceAccountProjectAccess_Call struct { // - ctx context.Context // - in *cloudservice.SetServiceAccountProjectAccessRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) SetServiceAccountProjectAccess(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_SetServiceAccountProjectAccess_Call { +func (_e *MockCloudServiceClient_Expecter) SetServiceAccountProjectAccess(ctx any, in any, opts ...any) *MockCloudServiceClient_SetServiceAccountProjectAccess_Call { return &MockCloudServiceClient_SetServiceAccountProjectAccess_Call{Call: _e.mock.On("SetServiceAccountProjectAccess", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_SetServiceAccountProjectAccess_Call) Run(run func(ctx context.Context, in *cloudservice.SetServiceAccountProjectAccessRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_SetServiceAccountProjectAccess_Call { @@ -6058,9 +6399,9 @@ type MockCloudServiceClient_SetUserGroupNamespaceAccess_Call struct { // - ctx context.Context // - in *cloudservice.SetUserGroupNamespaceAccessRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) SetUserGroupNamespaceAccess(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_SetUserGroupNamespaceAccess_Call { +func (_e *MockCloudServiceClient_Expecter) SetUserGroupNamespaceAccess(ctx any, in any, opts ...any) *MockCloudServiceClient_SetUserGroupNamespaceAccess_Call { return &MockCloudServiceClient_SetUserGroupNamespaceAccess_Call{Call: _e.mock.On("SetUserGroupNamespaceAccess", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_SetUserGroupNamespaceAccess_Call) Run(run func(ctx context.Context, in *cloudservice.SetUserGroupNamespaceAccessRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_SetUserGroupNamespaceAccess_Call { @@ -6141,9 +6482,9 @@ type MockCloudServiceClient_SetUserGroupProjectAccess_Call struct { // - ctx context.Context // - in *cloudservice.SetUserGroupProjectAccessRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) SetUserGroupProjectAccess(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_SetUserGroupProjectAccess_Call { +func (_e *MockCloudServiceClient_Expecter) SetUserGroupProjectAccess(ctx any, in any, opts ...any) *MockCloudServiceClient_SetUserGroupProjectAccess_Call { return &MockCloudServiceClient_SetUserGroupProjectAccess_Call{Call: _e.mock.On("SetUserGroupProjectAccess", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_SetUserGroupProjectAccess_Call) Run(run func(ctx context.Context, in *cloudservice.SetUserGroupProjectAccessRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_SetUserGroupProjectAccess_Call { @@ -6224,9 +6565,9 @@ type MockCloudServiceClient_SetUserNamespaceAccess_Call struct { // - ctx context.Context // - in *cloudservice.SetUserNamespaceAccessRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) SetUserNamespaceAccess(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_SetUserNamespaceAccess_Call { +func (_e *MockCloudServiceClient_Expecter) SetUserNamespaceAccess(ctx any, in any, opts ...any) *MockCloudServiceClient_SetUserNamespaceAccess_Call { return &MockCloudServiceClient_SetUserNamespaceAccess_Call{Call: _e.mock.On("SetUserNamespaceAccess", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_SetUserNamespaceAccess_Call) Run(run func(ctx context.Context, in *cloudservice.SetUserNamespaceAccessRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_SetUserNamespaceAccess_Call { @@ -6307,9 +6648,9 @@ type MockCloudServiceClient_SetUserProjectAccess_Call struct { // - ctx context.Context // - in *cloudservice.SetUserProjectAccessRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) SetUserProjectAccess(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_SetUserProjectAccess_Call { +func (_e *MockCloudServiceClient_Expecter) SetUserProjectAccess(ctx any, in any, opts ...any) *MockCloudServiceClient_SetUserProjectAccess_Call { return &MockCloudServiceClient_SetUserProjectAccess_Call{Call: _e.mock.On("SetUserProjectAccess", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_SetUserProjectAccess_Call) Run(run func(ctx context.Context, in *cloudservice.SetUserProjectAccessRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_SetUserProjectAccess_Call { @@ -6390,9 +6731,9 @@ type MockCloudServiceClient_UpdateAccount_Call struct { // - ctx context.Context // - in *cloudservice.UpdateAccountRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) UpdateAccount(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_UpdateAccount_Call { +func (_e *MockCloudServiceClient_Expecter) UpdateAccount(ctx any, in any, opts ...any) *MockCloudServiceClient_UpdateAccount_Call { return &MockCloudServiceClient_UpdateAccount_Call{Call: _e.mock.On("UpdateAccount", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_UpdateAccount_Call) Run(run func(ctx context.Context, in *cloudservice.UpdateAccountRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_UpdateAccount_Call { @@ -6473,9 +6814,9 @@ type MockCloudServiceClient_UpdateAccountAuditLogSink_Call struct { // - ctx context.Context // - in *cloudservice.UpdateAccountAuditLogSinkRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) UpdateAccountAuditLogSink(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_UpdateAccountAuditLogSink_Call { +func (_e *MockCloudServiceClient_Expecter) UpdateAccountAuditLogSink(ctx any, in any, opts ...any) *MockCloudServiceClient_UpdateAccountAuditLogSink_Call { return &MockCloudServiceClient_UpdateAccountAuditLogSink_Call{Call: _e.mock.On("UpdateAccountAuditLogSink", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_UpdateAccountAuditLogSink_Call) Run(run func(ctx context.Context, in *cloudservice.UpdateAccountAuditLogSinkRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_UpdateAccountAuditLogSink_Call { @@ -6556,9 +6897,9 @@ type MockCloudServiceClient_UpdateApiKey_Call struct { // - ctx context.Context // - in *cloudservice.UpdateApiKeyRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) UpdateApiKey(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_UpdateApiKey_Call { +func (_e *MockCloudServiceClient_Expecter) UpdateApiKey(ctx any, in any, opts ...any) *MockCloudServiceClient_UpdateApiKey_Call { return &MockCloudServiceClient_UpdateApiKey_Call{Call: _e.mock.On("UpdateApiKey", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_UpdateApiKey_Call) Run(run func(ctx context.Context, in *cloudservice.UpdateApiKeyRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_UpdateApiKey_Call { @@ -6596,6 +6937,89 @@ func (_c *MockCloudServiceClient_UpdateApiKey_Call) RunAndReturn(run func(ctx co return _c } +// UpdateCallerRateLimit provides a mock function for the type MockCloudServiceClient +func (_mock *MockCloudServiceClient) UpdateCallerRateLimit(ctx context.Context, in *cloudservice.UpdateCallerRateLimitRequest, opts ...grpc.CallOption) (*cloudservice.UpdateCallerRateLimitResponse, error) { + var tmpRet mock.Arguments + if len(opts) > 0 { + tmpRet = _mock.Called(ctx, in, opts) + } else { + tmpRet = _mock.Called(ctx, in) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for UpdateCallerRateLimit") + } + + var r0 *cloudservice.UpdateCallerRateLimitResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *cloudservice.UpdateCallerRateLimitRequest, ...grpc.CallOption) (*cloudservice.UpdateCallerRateLimitResponse, error)); ok { + return returnFunc(ctx, in, opts...) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *cloudservice.UpdateCallerRateLimitRequest, ...grpc.CallOption) *cloudservice.UpdateCallerRateLimitResponse); ok { + r0 = returnFunc(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*cloudservice.UpdateCallerRateLimitResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *cloudservice.UpdateCallerRateLimitRequest, ...grpc.CallOption) error); ok { + r1 = returnFunc(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockCloudServiceClient_UpdateCallerRateLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateCallerRateLimit' +type MockCloudServiceClient_UpdateCallerRateLimit_Call struct { + *mock.Call +} + +// UpdateCallerRateLimit is a helper method to define mock.On call +// - ctx context.Context +// - in *cloudservice.UpdateCallerRateLimitRequest +// - opts ...grpc.CallOption +func (_e *MockCloudServiceClient_Expecter) UpdateCallerRateLimit(ctx any, in any, opts ...any) *MockCloudServiceClient_UpdateCallerRateLimit_Call { + return &MockCloudServiceClient_UpdateCallerRateLimit_Call{Call: _e.mock.On("UpdateCallerRateLimit", + append([]any{ctx, in}, opts...)...)} +} + +func (_c *MockCloudServiceClient_UpdateCallerRateLimit_Call) Run(run func(ctx context.Context, in *cloudservice.UpdateCallerRateLimitRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_UpdateCallerRateLimit_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *cloudservice.UpdateCallerRateLimitRequest + if args[1] != nil { + arg1 = args[1].(*cloudservice.UpdateCallerRateLimitRequest) + } + var arg2 []grpc.CallOption + var variadicArgs []grpc.CallOption + if len(args) > 2 { + variadicArgs = args[2].([]grpc.CallOption) + } + arg2 = variadicArgs + run( + arg0, + arg1, + arg2..., + ) + }) + return _c +} + +func (_c *MockCloudServiceClient_UpdateCallerRateLimit_Call) Return(updateCallerRateLimitResponse *cloudservice.UpdateCallerRateLimitResponse, err error) *MockCloudServiceClient_UpdateCallerRateLimit_Call { + _c.Call.Return(updateCallerRateLimitResponse, err) + return _c +} + +func (_c *MockCloudServiceClient_UpdateCallerRateLimit_Call) RunAndReturn(run func(ctx context.Context, in *cloudservice.UpdateCallerRateLimitRequest, opts ...grpc.CallOption) (*cloudservice.UpdateCallerRateLimitResponse, error)) *MockCloudServiceClient_UpdateCallerRateLimit_Call { + _c.Call.Return(run) + return _c +} + // UpdateCustomRole provides a mock function for the type MockCloudServiceClient func (_mock *MockCloudServiceClient) UpdateCustomRole(ctx context.Context, in *cloudservice.UpdateCustomRoleRequest, opts ...grpc.CallOption) (*cloudservice.UpdateCustomRoleResponse, error) { var tmpRet mock.Arguments @@ -6639,9 +7063,9 @@ type MockCloudServiceClient_UpdateCustomRole_Call struct { // - ctx context.Context // - in *cloudservice.UpdateCustomRoleRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) UpdateCustomRole(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_UpdateCustomRole_Call { +func (_e *MockCloudServiceClient_Expecter) UpdateCustomRole(ctx any, in any, opts ...any) *MockCloudServiceClient_UpdateCustomRole_Call { return &MockCloudServiceClient_UpdateCustomRole_Call{Call: _e.mock.On("UpdateCustomRole", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_UpdateCustomRole_Call) Run(run func(ctx context.Context, in *cloudservice.UpdateCustomRoleRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_UpdateCustomRole_Call { @@ -6722,9 +7146,9 @@ type MockCloudServiceClient_UpdateNamespace_Call struct { // - ctx context.Context // - in *cloudservice.UpdateNamespaceRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) UpdateNamespace(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_UpdateNamespace_Call { +func (_e *MockCloudServiceClient_Expecter) UpdateNamespace(ctx any, in any, opts ...any) *MockCloudServiceClient_UpdateNamespace_Call { return &MockCloudServiceClient_UpdateNamespace_Call{Call: _e.mock.On("UpdateNamespace", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_UpdateNamespace_Call) Run(run func(ctx context.Context, in *cloudservice.UpdateNamespaceRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_UpdateNamespace_Call { @@ -6805,9 +7229,9 @@ type MockCloudServiceClient_UpdateNamespaceExportSink_Call struct { // - ctx context.Context // - in *cloudservice.UpdateNamespaceExportSinkRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) UpdateNamespaceExportSink(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_UpdateNamespaceExportSink_Call { +func (_e *MockCloudServiceClient_Expecter) UpdateNamespaceExportSink(ctx any, in any, opts ...any) *MockCloudServiceClient_UpdateNamespaceExportSink_Call { return &MockCloudServiceClient_UpdateNamespaceExportSink_Call{Call: _e.mock.On("UpdateNamespaceExportSink", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_UpdateNamespaceExportSink_Call) Run(run func(ctx context.Context, in *cloudservice.UpdateNamespaceExportSinkRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_UpdateNamespaceExportSink_Call { @@ -6888,9 +7312,9 @@ type MockCloudServiceClient_UpdateNamespaceTags_Call struct { // - ctx context.Context // - in *cloudservice.UpdateNamespaceTagsRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) UpdateNamespaceTags(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_UpdateNamespaceTags_Call { +func (_e *MockCloudServiceClient_Expecter) UpdateNamespaceTags(ctx any, in any, opts ...any) *MockCloudServiceClient_UpdateNamespaceTags_Call { return &MockCloudServiceClient_UpdateNamespaceTags_Call{Call: _e.mock.On("UpdateNamespaceTags", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_UpdateNamespaceTags_Call) Run(run func(ctx context.Context, in *cloudservice.UpdateNamespaceTagsRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_UpdateNamespaceTags_Call { @@ -6971,9 +7395,9 @@ type MockCloudServiceClient_UpdateNexusEndpoint_Call struct { // - ctx context.Context // - in *cloudservice.UpdateNexusEndpointRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) UpdateNexusEndpoint(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_UpdateNexusEndpoint_Call { +func (_e *MockCloudServiceClient_Expecter) UpdateNexusEndpoint(ctx any, in any, opts ...any) *MockCloudServiceClient_UpdateNexusEndpoint_Call { return &MockCloudServiceClient_UpdateNexusEndpoint_Call{Call: _e.mock.On("UpdateNexusEndpoint", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_UpdateNexusEndpoint_Call) Run(run func(ctx context.Context, in *cloudservice.UpdateNexusEndpointRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_UpdateNexusEndpoint_Call { @@ -7054,9 +7478,9 @@ type MockCloudServiceClient_UpdateProject_Call struct { // - ctx context.Context // - in *cloudservice.UpdateProjectRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) UpdateProject(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_UpdateProject_Call { +func (_e *MockCloudServiceClient_Expecter) UpdateProject(ctx any, in any, opts ...any) *MockCloudServiceClient_UpdateProject_Call { return &MockCloudServiceClient_UpdateProject_Call{Call: _e.mock.On("UpdateProject", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_UpdateProject_Call) Run(run func(ctx context.Context, in *cloudservice.UpdateProjectRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_UpdateProject_Call { @@ -7137,9 +7561,9 @@ type MockCloudServiceClient_UpdateServiceAccount_Call struct { // - ctx context.Context // - in *cloudservice.UpdateServiceAccountRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) UpdateServiceAccount(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_UpdateServiceAccount_Call { +func (_e *MockCloudServiceClient_Expecter) UpdateServiceAccount(ctx any, in any, opts ...any) *MockCloudServiceClient_UpdateServiceAccount_Call { return &MockCloudServiceClient_UpdateServiceAccount_Call{Call: _e.mock.On("UpdateServiceAccount", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_UpdateServiceAccount_Call) Run(run func(ctx context.Context, in *cloudservice.UpdateServiceAccountRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_UpdateServiceAccount_Call { @@ -7220,9 +7644,9 @@ type MockCloudServiceClient_UpdateUser_Call struct { // - ctx context.Context // - in *cloudservice.UpdateUserRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) UpdateUser(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_UpdateUser_Call { +func (_e *MockCloudServiceClient_Expecter) UpdateUser(ctx any, in any, opts ...any) *MockCloudServiceClient_UpdateUser_Call { return &MockCloudServiceClient_UpdateUser_Call{Call: _e.mock.On("UpdateUser", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_UpdateUser_Call) Run(run func(ctx context.Context, in *cloudservice.UpdateUserRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_UpdateUser_Call { @@ -7303,9 +7727,9 @@ type MockCloudServiceClient_UpdateUserGroup_Call struct { // - ctx context.Context // - in *cloudservice.UpdateUserGroupRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) UpdateUserGroup(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_UpdateUserGroup_Call { +func (_e *MockCloudServiceClient_Expecter) UpdateUserGroup(ctx any, in any, opts ...any) *MockCloudServiceClient_UpdateUserGroup_Call { return &MockCloudServiceClient_UpdateUserGroup_Call{Call: _e.mock.On("UpdateUserGroup", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_UpdateUserGroup_Call) Run(run func(ctx context.Context, in *cloudservice.UpdateUserGroupRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_UpdateUserGroup_Call { @@ -7386,9 +7810,9 @@ type MockCloudServiceClient_ValidateAccountAuditLogSink_Call struct { // - ctx context.Context // - in *cloudservice.ValidateAccountAuditLogSinkRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) ValidateAccountAuditLogSink(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_ValidateAccountAuditLogSink_Call { +func (_e *MockCloudServiceClient_Expecter) ValidateAccountAuditLogSink(ctx any, in any, opts ...any) *MockCloudServiceClient_ValidateAccountAuditLogSink_Call { return &MockCloudServiceClient_ValidateAccountAuditLogSink_Call{Call: _e.mock.On("ValidateAccountAuditLogSink", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_ValidateAccountAuditLogSink_Call) Run(run func(ctx context.Context, in *cloudservice.ValidateAccountAuditLogSinkRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_ValidateAccountAuditLogSink_Call { @@ -7469,9 +7893,9 @@ type MockCloudServiceClient_ValidateNamespaceExportSink_Call struct { // - ctx context.Context // - in *cloudservice.ValidateNamespaceExportSinkRequest // - opts ...grpc.CallOption -func (_e *MockCloudServiceClient_Expecter) ValidateNamespaceExportSink(ctx interface{}, in interface{}, opts ...interface{}) *MockCloudServiceClient_ValidateNamespaceExportSink_Call { +func (_e *MockCloudServiceClient_Expecter) ValidateNamespaceExportSink(ctx any, in any, opts ...any) *MockCloudServiceClient_ValidateNamespaceExportSink_Call { return &MockCloudServiceClient_ValidateNamespaceExportSink_Call{Call: _e.mock.On("ValidateNamespaceExportSink", - append([]interface{}{ctx, in}, opts...)...)} + append([]any{ctx, in}, opts...)...)} } func (_c *MockCloudServiceClient_ValidateNamespaceExportSink_Call) Run(run func(ctx context.Context, in *cloudservice.ValidateNamespaceExportSinkRequest, opts ...grpc.CallOption)) *MockCloudServiceClient_ValidateNamespaceExportSink_Call { diff --git a/internal/namespace/mock/mock.go b/internal/namespace/mock/mock.go index e88b49b..5592b8e 100644 --- a/internal/namespace/mock/mock.go +++ b/internal/namespace/mock/mock.go @@ -18,10 +18,19 @@ func NewMockCloudService(t interface { mock.TestingT Cleanup(func()) }) *MockCloudService { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock := &MockCloudService{} mock.Mock.Test(t) - t.Cleanup(func() { mock.AssertExpectations(t) }) + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) return mock } @@ -82,9 +91,9 @@ type MockCloudService_GetNamespace_Call struct { // - ctx context.Context // - req *cloudservice.GetNamespaceRequest // - opts ...grpc.CallOption -func (_e *MockCloudService_Expecter) GetNamespace(ctx interface{}, req interface{}, opts ...interface{}) *MockCloudService_GetNamespace_Call { +func (_e *MockCloudService_Expecter) GetNamespace(ctx any, req any, opts ...any) *MockCloudService_GetNamespace_Call { return &MockCloudService_GetNamespace_Call{Call: _e.mock.On("GetNamespace", - append([]interface{}{ctx, req}, opts...)...)} + append([]any{ctx, req}, opts...)...)} } func (_c *MockCloudService_GetNamespace_Call) Run(run func(ctx context.Context, req *cloudservice.GetNamespaceRequest, opts ...grpc.CallOption)) *MockCloudService_GetNamespace_Call { @@ -165,9 +174,9 @@ type MockCloudService_GetNamespaces_Call struct { // - ctx context.Context // - req *cloudservice.GetNamespacesRequest // - opts ...grpc.CallOption -func (_e *MockCloudService_Expecter) GetNamespaces(ctx interface{}, req interface{}, opts ...interface{}) *MockCloudService_GetNamespaces_Call { +func (_e *MockCloudService_Expecter) GetNamespaces(ctx any, req any, opts ...any) *MockCloudService_GetNamespaces_Call { return &MockCloudService_GetNamespaces_Call{Call: _e.mock.On("GetNamespaces", - append([]interface{}{ctx, req}, opts...)...)} + append([]any{ctx, req}, opts...)...)} } func (_c *MockCloudService_GetNamespaces_Call) Run(run func(ctx context.Context, req *cloudservice.GetNamespacesRequest, opts ...grpc.CallOption)) *MockCloudService_GetNamespaces_Call { @@ -248,9 +257,9 @@ type MockCloudService_RenameCustomSearchAttribute_Call struct { // - ctx context.Context // - req *cloudservice.RenameCustomSearchAttributeRequest // - opts ...grpc.CallOption -func (_e *MockCloudService_Expecter) RenameCustomSearchAttribute(ctx interface{}, req interface{}, opts ...interface{}) *MockCloudService_RenameCustomSearchAttribute_Call { +func (_e *MockCloudService_Expecter) RenameCustomSearchAttribute(ctx any, req any, opts ...any) *MockCloudService_RenameCustomSearchAttribute_Call { return &MockCloudService_RenameCustomSearchAttribute_Call{Call: _e.mock.On("RenameCustomSearchAttribute", - append([]interface{}{ctx, req}, opts...)...)} + append([]any{ctx, req}, opts...)...)} } func (_c *MockCloudService_RenameCustomSearchAttribute_Call) Run(run func(ctx context.Context, req *cloudservice.RenameCustomSearchAttributeRequest, opts ...grpc.CallOption)) *MockCloudService_RenameCustomSearchAttribute_Call { @@ -331,9 +340,9 @@ type MockCloudService_UpdateNamespace_Call struct { // - ctx context.Context // - req *cloudservice.UpdateNamespaceRequest // - opts ...grpc.CallOption -func (_e *MockCloudService_Expecter) UpdateNamespace(ctx interface{}, req interface{}, opts ...interface{}) *MockCloudService_UpdateNamespace_Call { +func (_e *MockCloudService_Expecter) UpdateNamespace(ctx any, req any, opts ...any) *MockCloudService_UpdateNamespace_Call { return &MockCloudService_UpdateNamespace_Call{Call: _e.mock.On("UpdateNamespace", - append([]interface{}{ctx, req}, opts...)...)} + append([]any{ctx, req}, opts...)...)} } func (_c *MockCloudService_UpdateNamespace_Call) Run(run func(ctx context.Context, req *cloudservice.UpdateNamespaceRequest, opts ...grpc.CallOption)) *MockCloudService_UpdateNamespace_Call { @@ -414,9 +423,9 @@ type MockCloudService_UpdateNamespaceTags_Call struct { // - ctx context.Context // - req *cloudservice.UpdateNamespaceTagsRequest // - opts ...grpc.CallOption -func (_e *MockCloudService_Expecter) UpdateNamespaceTags(ctx interface{}, req interface{}, opts ...interface{}) *MockCloudService_UpdateNamespaceTags_Call { +func (_e *MockCloudService_Expecter) UpdateNamespaceTags(ctx any, req any, opts ...any) *MockCloudService_UpdateNamespaceTags_Call { return &MockCloudService_UpdateNamespaceTags_Call{Call: _e.mock.On("UpdateNamespaceTags", - append([]interface{}{ctx, req}, opts...)...)} + append([]any{ctx, req}, opts...)...)} } func (_c *MockCloudService_UpdateNamespaceTags_Call) Run(run func(ctx context.Context, req *cloudservice.UpdateNamespaceTagsRequest, opts ...grpc.CallOption)) *MockCloudService_UpdateNamespaceTags_Call { diff --git a/temporalcloudcli/async/mock/mock.go b/temporalcloudcli/async/mock/mock.go index 624306c..7e4baa1 100644 --- a/temporalcloudcli/async/mock/mock.go +++ b/temporalcloudcli/async/mock/mock.go @@ -17,10 +17,19 @@ func NewMockPoller(t interface { mock.TestingT Cleanup(func()) }) *MockPoller { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock := &MockPoller{} mock.Mock.Test(t) - t.Cleanup(func() { mock.AssertExpectations(t) }) + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) return mock } @@ -63,7 +72,7 @@ type MockPoller_AwaitAsyncOperation_Call struct { // AwaitAsyncOperation is a helper method to define mock.On call // - ctx context.Context // - asyncOpID string -func (_e *MockPoller_Expecter) AwaitAsyncOperation(ctx interface{}, asyncOpID interface{}) *MockPoller_AwaitAsyncOperation_Call { +func (_e *MockPoller_Expecter) AwaitAsyncOperation(ctx any, asyncOpID any) *MockPoller_AwaitAsyncOperation_Call { return &MockPoller_AwaitAsyncOperation_Call{Call: _e.mock.On("AwaitAsyncOperation", ctx, asyncOpID)} } @@ -121,7 +130,7 @@ type MockPoller_HandleCreateAsyncOperationResponse_Call struct { // - ctx context.Context // - response async.RespWithAsyncOp // - err error -func (_e *MockPoller_Expecter) HandleCreateAsyncOperationResponse(ctx interface{}, response interface{}, err interface{}) *MockPoller_HandleCreateAsyncOperationResponse_Call { +func (_e *MockPoller_Expecter) HandleCreateAsyncOperationResponse(ctx any, response any, err any) *MockPoller_HandleCreateAsyncOperationResponse_Call { return &MockPoller_HandleCreateAsyncOperationResponse_Call{Call: _e.mock.On("HandleCreateAsyncOperationResponse", ctx, response, err)} } @@ -184,7 +193,7 @@ type MockPoller_HandleDeleteOperation_Call struct { // - ctx context.Context // - response async.RespWithAsyncOp // - err error -func (_e *MockPoller_Expecter) HandleDeleteOperation(ctx interface{}, response interface{}, err interface{}) *MockPoller_HandleDeleteOperation_Call { +func (_e *MockPoller_Expecter) HandleDeleteOperation(ctx any, response any, err any) *MockPoller_HandleDeleteOperation_Call { return &MockPoller_HandleDeleteOperation_Call{Call: _e.mock.On("HandleDeleteOperation", ctx, response, err)} } @@ -247,7 +256,7 @@ type MockPoller_HandleIdempotentOperation_Call struct { // - ctx context.Context // - response async.RespWithAsyncOp // - err error -func (_e *MockPoller_Expecter) HandleIdempotentOperation(ctx interface{}, response interface{}, err interface{}) *MockPoller_HandleIdempotentOperation_Call { +func (_e *MockPoller_Expecter) HandleIdempotentOperation(ctx any, response any, err any) *MockPoller_HandleIdempotentOperation_Call { return &MockPoller_HandleIdempotentOperation_Call{Call: _e.mock.On("HandleIdempotentOperation", ctx, response, err)} } @@ -310,7 +319,7 @@ type MockPoller_HandleUpdateOperation_Call struct { // - ctx context.Context // - response async.RespWithAsyncOp // - err error -func (_e *MockPoller_Expecter) HandleUpdateOperation(ctx interface{}, response interface{}, err interface{}) *MockPoller_HandleUpdateOperation_Call { +func (_e *MockPoller_Expecter) HandleUpdateOperation(ctx any, response any, err any) *MockPoller_HandleUpdateOperation_Call { return &MockPoller_HandleUpdateOperation_Call{Call: _e.mock.On("HandleUpdateOperation", ctx, response, err)} } diff --git a/temporalcloudcli/commands.gen.go b/temporalcloudcli/commands.gen.go index 7bb14ff..a63d539 100644 --- a/temporalcloudcli/commands.gen.go +++ b/temporalcloudcli/commands.gen.go @@ -159,6 +159,18 @@ func (v *CustomRoleOptions) BuildFlags(f *pflag.FlagSet) { f.StringArrayVar(&v.CustomRole, "custom-role", nil, "Custom role ID to assign. Repeat to assign multiple. When provided, replaces the existing custom role list.") } +type CallerRateLimitCallerOptions struct { + CallerNamespaceDefault bool + CallerNamespace string + FlagSet *pflag.FlagSet +} + +func (v *CallerRateLimitCallerOptions) BuildFlags(f *pflag.FlagSet) { + v.FlagSet = f + f.BoolVar(&v.CallerNamespaceDefault, "caller-namespace-default", false, "Target the default rule, which applies to caller namespaces without a specific rule.") + f.StringVar(&v.CallerNamespace, "caller-namespace", "", "The fully qualified caller namespace name in the format 'namespace.account' (e.g., 'caller-ns.my-account').") +} + type ExportSinkOptions struct { SinkName string FlagSet *pflag.FlagSet @@ -1883,6 +1895,7 @@ func NewCloudNamespaceCommand(cctx *CommandContext, parent *CloudCommand) *Cloud s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewCloudNamespaceApiKeyCommand(cctx, &s).Command) s.Command.AddCommand(&NewCloudNamespaceApplyCommand(cctx, &s).Command) + s.Command.AddCommand(&NewCloudNamespaceCallerRateLimitCommand(cctx, &s).Command) s.Command.AddCommand(&NewCloudNamespaceCapacityCommand(cctx, &s).Command) s.Command.AddCommand(&NewCloudNamespaceCodecCommand(cctx, &s).Command) s.Command.AddCommand(&NewCloudNamespaceConnectivityCommand(cctx, &s).Command) @@ -2063,6 +2076,206 @@ func NewCloudNamespaceApplyCommand(cctx *CommandContext, parent *CloudNamespaceC return &s } +type CloudNamespaceCallerRateLimitCommand struct { + Parent *CloudNamespaceCommand + Command cobra.Command +} + +func NewCloudNamespaceCallerRateLimitCommand(cctx *CommandContext, parent *CloudNamespaceCommand) *CloudNamespaceCallerRateLimitCommand { + var s CloudNamespaceCallerRateLimitCommand + s.Parent = parent + s.Command.Use = "caller-rate-limit" + s.Command.Short = "Manage namespace caller rate limits" + s.Command.Long = "Commands for managing caller rate limits on Temporal Cloud namespaces.\n\nA caller rate limit caps the requests per second that callers, such as\nother namespaces, can send to a target namespace. A namespace can have a\ndefault rule for caller namespaces and rules for specific caller namespaces." + s.Command.Args = cobra.NoArgs + s.Command.AddCommand(&NewCloudNamespaceCallerRateLimitApplyCommand(cctx, &s).Command) + s.Command.AddCommand(&NewCloudNamespaceCallerRateLimitDeleteCommand(cctx, &s).Command) + s.Command.AddCommand(&NewCloudNamespaceCallerRateLimitGetCommand(cctx, &s).Command) + s.Command.AddCommand(&NewCloudNamespaceCallerRateLimitListCommand(cctx, &s).Command) + s.Command.AddCommand(&NewCloudNamespaceCallerRateLimitSetCommand(cctx, &s).Command) + return &s +} + +type CloudNamespaceCallerRateLimitApplyCommand struct { + Parent *CloudNamespaceCallerRateLimitCommand + Command cobra.Command + ClientOptions + NamespaceOptions + DiffOptions + AsyncOperationOptions + ResourceVersionOptions + Spec string +} + +func NewCloudNamespaceCallerRateLimitApplyCommand(cctx *CommandContext, parent *CloudNamespaceCallerRateLimitCommand) *CloudNamespaceCallerRateLimitApplyCommand { + var s CloudNamespaceCallerRateLimitApplyCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "apply [flags]" + s.Command.Short = "Create or update namespace caller rate limits from a specification" + if hasHighlighting { + s.Command.Long = "Apply a list of caller rate limit rules to a Temporal Cloud namespace.\nEach rule in the specification is created if it doesn't exist, or updated\nif it differs from the existing rule. Rules that already match and are\nactive are skipped. Shows a diff of the changed rules and asks for\nconfirmation before applying.\n\nApply is additive: existing rules that are not in the specification are left\nuntouched. Use 'temporal cloud namespace caller-rate-limit delete' to remove\na rule.\n\nThe specification is a JSON array of caller rate limit specs. It can be\nprovided as inline JSON or loaded from a file by prefixing the path with '@'.\nAn rps of 0 blocks all traffic from the matched callers.\n\nExample file (limits.json) with the default rule for caller namespaces and\na rule for a specific caller namespace:\n\n\x1b[1m[\n {\"namespaceDefault\": {\"rps\": 100}},\n {\"namespaceLimit\": {\"namespaceId\": \"caller-ns.my-account\", \"rps\": 50}}\n]\x1b[0m\n\nExample:\n\n\x1b[1mtemporal cloud namespace caller-rate-limit apply --namespace my-namespace.my-account \\\n --spec @limits.json\x1b[0m\n\nChanged rules are applied one at a time. Apply stops at the first failure\nand reports which rules were already applied. Rerunning skips rules that\nwere already applied and retries rules whose last update failed. A rule\nthat matches but is not active, including one whose operation is still in\nprogress, is updated again, so wait for in-progress operations (for example\nafter --async) to finish before rerunning.\n\n--async-operation-id and --resource-version can only be used when apply\nchanges a single rule.\n\nWith --async, operations are submitted without waiting; fail-fast then only\ncovers submission errors, so check each printed operation. With -o json, each\noperation prints its own JSON document." + } else { + s.Command.Long = "Apply a list of caller rate limit rules to a Temporal Cloud namespace.\nEach rule in the specification is created if it doesn't exist, or updated\nif it differs from the existing rule. Rules that already match and are\nactive are skipped. Shows a diff of the changed rules and asks for\nconfirmation before applying.\n\nApply is additive: existing rules that are not in the specification are left\nuntouched. Use 'temporal cloud namespace caller-rate-limit delete' to remove\na rule.\n\nThe specification is a JSON array of caller rate limit specs. It can be\nprovided as inline JSON or loaded from a file by prefixing the path with '@'.\nAn rps of 0 blocks all traffic from the matched callers.\n\nExample file (limits.json) with the default rule for caller namespaces and\na rule for a specific caller namespace:\n\n```\n[\n {\"namespaceDefault\": {\"rps\": 100}},\n {\"namespaceLimit\": {\"namespaceId\": \"caller-ns.my-account\", \"rps\": 50}}\n]\n```\n\nExample:\n\n```\ntemporal cloud namespace caller-rate-limit apply --namespace my-namespace.my-account \\\n --spec @limits.json\n```\n\nChanged rules are applied one at a time. Apply stops at the first failure\nand reports which rules were already applied. Rerunning skips rules that\nwere already applied and retries rules whose last update failed. A rule\nthat matches but is not active, including one whose operation is still in\nprogress, is updated again, so wait for in-progress operations (for example\nafter --async) to finish before rerunning.\n\n--async-operation-id and --resource-version can only be used when apply\nchanges a single rule.\n\nWith --async, operations are submitted without waiting; fail-fast then only\ncovers submission errors, so check each printed operation. With -o json, each\noperation prints its own JSON document." + } + s.Command.Args = cobra.NoArgs + s.Command.Flags().StringVar(&s.Spec, "spec", "", "Caller rate limit specifications as a JSON array. Provide inline JSON directly, or use '@path/to/file.json' to load from a file. Required.") + _ = cobra.MarkFlagRequired(s.Command.Flags(), "spec") + s.ClientOptions.BuildFlags(s.Command.Flags()) + s.NamespaceOptions.BuildFlags(s.Command.Flags()) + s.DiffOptions.BuildFlags(s.Command.Flags()) + s.AsyncOperationOptions.BuildFlags(s.Command.Flags()) + s.ResourceVersionOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type CloudNamespaceCallerRateLimitDeleteCommand struct { + Parent *CloudNamespaceCallerRateLimitCommand + Command cobra.Command + ClientOptions + NamespaceOptions + CallerRateLimitCallerOptions + AsyncOperationOptions + ResourceVersionOptions +} + +func NewCloudNamespaceCallerRateLimitDeleteCommand(cctx *CommandContext, parent *CloudNamespaceCallerRateLimitCommand) *CloudNamespaceCallerRateLimitDeleteCommand { + var s CloudNamespaceCallerRateLimitDeleteCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "delete [flags]" + s.Command.Short = "Delete a namespace caller rate limit" + if hasHighlighting { + s.Command.Long = "Delete a caller rate limit rule on a Temporal Cloud namespace: either the\ndefault rule for caller namespaces or the rule for a specific caller namespace.\n\nExactly one of --caller-namespace-default or --caller-namespace is required.\n\nExample (default rule for caller namespaces):\n\n\x1b[1mtemporal cloud namespace caller-rate-limit delete --namespace my-namespace.my-account \\\n --caller-namespace-default\x1b[0m\n\nExample (rule for a specific caller namespace):\n\n\x1b[1mtemporal cloud namespace caller-rate-limit delete --namespace my-namespace.my-account \\\n --caller-namespace caller-ns.my-account\x1b[0m" + } else { + s.Command.Long = "Delete a caller rate limit rule on a Temporal Cloud namespace: either the\ndefault rule for caller namespaces or the rule for a specific caller namespace.\n\nExactly one of --caller-namespace-default or --caller-namespace is required.\n\nExample (default rule for caller namespaces):\n\n```\ntemporal cloud namespace caller-rate-limit delete --namespace my-namespace.my-account \\\n --caller-namespace-default\n```\n\nExample (rule for a specific caller namespace):\n\n```\ntemporal cloud namespace caller-rate-limit delete --namespace my-namespace.my-account \\\n --caller-namespace caller-ns.my-account\n```" + } + s.Command.Args = cobra.NoArgs + s.ClientOptions.BuildFlags(s.Command.Flags()) + s.NamespaceOptions.BuildFlags(s.Command.Flags()) + s.CallerRateLimitCallerOptions.BuildFlags(s.Command.Flags()) + s.AsyncOperationOptions.BuildFlags(s.Command.Flags()) + s.ResourceVersionOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type CloudNamespaceCallerRateLimitGetCommand struct { + Parent *CloudNamespaceCallerRateLimitCommand + Command cobra.Command + ClientOptions + NamespaceOptions + CallerRateLimitCallerOptions +} + +func NewCloudNamespaceCallerRateLimitGetCommand(cctx *CommandContext, parent *CloudNamespaceCallerRateLimitCommand) *CloudNamespaceCallerRateLimitGetCommand { + var s CloudNamespaceCallerRateLimitGetCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "get [flags]" + s.Command.Short = "Get a namespace caller rate limit" + if hasHighlighting { + s.Command.Long = "Retrieve a caller rate limit rule on a Temporal Cloud namespace: either the\ndefault rule for caller namespaces or the rule for a specific caller namespace.\n\nExactly one of --caller-namespace-default or --caller-namespace is required.\n\nExample (default rule for caller namespaces):\n\n\x1b[1mtemporal cloud namespace caller-rate-limit get --namespace my-namespace.my-account \\\n --caller-namespace-default\x1b[0m\n\nExample (rule for a specific caller namespace):\n\n\x1b[1mtemporal cloud namespace caller-rate-limit get --namespace my-namespace.my-account \\\n --caller-namespace caller-ns.my-account\x1b[0m" + } else { + s.Command.Long = "Retrieve a caller rate limit rule on a Temporal Cloud namespace: either the\ndefault rule for caller namespaces or the rule for a specific caller namespace.\n\nExactly one of --caller-namespace-default or --caller-namespace is required.\n\nExample (default rule for caller namespaces):\n\n```\ntemporal cloud namespace caller-rate-limit get --namespace my-namespace.my-account \\\n --caller-namespace-default\n```\n\nExample (rule for a specific caller namespace):\n\n```\ntemporal cloud namespace caller-rate-limit get --namespace my-namespace.my-account \\\n --caller-namespace caller-ns.my-account\n```" + } + s.Command.Args = cobra.NoArgs + s.ClientOptions.BuildFlags(s.Command.Flags()) + s.NamespaceOptions.BuildFlags(s.Command.Flags()) + s.CallerRateLimitCallerOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type CloudNamespaceCallerRateLimitListCommand struct { + Parent *CloudNamespaceCallerRateLimitCommand + Command cobra.Command + ClientOptions + NamespaceOptions + CallerRateLimitCallerOptions + Type cliext.FlagStringEnum + PageSize int + PageToken string +} + +func NewCloudNamespaceCallerRateLimitListCommand(cctx *CommandContext, parent *CloudNamespaceCallerRateLimitCommand) *CloudNamespaceCallerRateLimitListCommand { + var s CloudNamespaceCallerRateLimitListCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "list [flags]" + s.Command.Short = "List namespace caller rate limits" + if hasHighlighting { + s.Command.Long = "List the caller rate limit rules on a Temporal Cloud namespace. With no\nfilter flags, all rules are listed (paginated). Use --type,\n--caller-namespace-default, or --caller-namespace to filter the results.\n\nExample (all rules):\n\n\x1b[1mtemporal cloud namespace caller-rate-limit list --namespace my-namespace.my-account\x1b[0m\n\nExample (default rule for caller namespaces):\n\n\x1b[1mtemporal cloud namespace caller-rate-limit list --namespace my-namespace.my-account \\\n --caller-namespace-default\x1b[0m\n\nExample (rule for a specific caller namespace):\n\n\x1b[1mtemporal cloud namespace caller-rate-limit list --namespace my-namespace.my-account \\\n --caller-namespace caller-ns.my-account\x1b[0m\n\nExample (default rule and a specific caller's rule, for comparison):\n\n\x1b[1mtemporal cloud namespace caller-rate-limit list --namespace my-namespace.my-account \\\n --caller-namespace-default --caller-namespace caller-ns.my-account\x1b[0m" + } else { + s.Command.Long = "List the caller rate limit rules on a Temporal Cloud namespace. With no\nfilter flags, all rules are listed (paginated). Use --type,\n--caller-namespace-default, or --caller-namespace to filter the results.\n\nExample (all rules):\n\n```\ntemporal cloud namespace caller-rate-limit list --namespace my-namespace.my-account\n```\n\nExample (default rule for caller namespaces):\n\n```\ntemporal cloud namespace caller-rate-limit list --namespace my-namespace.my-account \\\n --caller-namespace-default\n```\n\nExample (rule for a specific caller namespace):\n\n```\ntemporal cloud namespace caller-rate-limit list --namespace my-namespace.my-account \\\n --caller-namespace caller-ns.my-account\n```\n\nExample (default rule and a specific caller's rule, for comparison):\n\n```\ntemporal cloud namespace caller-rate-limit list --namespace my-namespace.my-account \\\n --caller-namespace-default --caller-namespace caller-ns.my-account\n```" + } + s.Command.Args = cobra.NoArgs + s.Type = cliext.NewFlagStringEnum([]string{"namespace"}, "") + s.Command.Flags().Var(&s.Type, "type", "Only list rules for this caller type. More caller types may be added in the future. Defaults to 'namespace' when --caller-namespace-default or --caller-namespace is set. Accepted values: namespace.") + s.Command.Flags().IntVar(&s.PageSize, "page-size", 0, "Number of caller rate limits to return per page. Use for paginated results.") + s.Command.Flags().StringVar(&s.PageToken, "page-token", "", "Token for retrieving the next page of results in a paginated list.") + s.ClientOptions.BuildFlags(s.Command.Flags()) + s.NamespaceOptions.BuildFlags(s.Command.Flags()) + s.CallerRateLimitCallerOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type CloudNamespaceCallerRateLimitSetCommand struct { + Parent *CloudNamespaceCallerRateLimitCommand + Command cobra.Command + ClientOptions + NamespaceOptions + CallerRateLimitCallerOptions + AsyncOperationOptions + ResourceVersionOptions + Rps float32 +} + +func NewCloudNamespaceCallerRateLimitSetCommand(cctx *CommandContext, parent *CloudNamespaceCallerRateLimitCommand) *CloudNamespaceCallerRateLimitSetCommand { + var s CloudNamespaceCallerRateLimitSetCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "set [flags]" + s.Command.Short = "Set a namespace caller rate limit" + if hasHighlighting { + s.Command.Long = "Set a caller rate limit rule on a Temporal Cloud namespace: either the\ndefault rule for caller namespaces or the rule for a specific caller namespace.\nCreates the rule if it doesn't exist, otherwise updates it. Shows a diff\nand asks for confirmation before applying.\n\nExactly one of --caller-namespace-default or --caller-namespace is required.\n\nExample (default rule for caller namespaces):\n\n\x1b[1mtemporal cloud namespace caller-rate-limit set --namespace my-namespace.my-account \\\n --caller-namespace-default --rps 100\x1b[0m\n\nExample (rule for a specific caller namespace):\n\n\x1b[1mtemporal cloud namespace caller-rate-limit set --namespace my-namespace.my-account \\\n --caller-namespace caller-ns.my-account --rps 50\x1b[0m" + } else { + s.Command.Long = "Set a caller rate limit rule on a Temporal Cloud namespace: either the\ndefault rule for caller namespaces or the rule for a specific caller namespace.\nCreates the rule if it doesn't exist, otherwise updates it. Shows a diff\nand asks for confirmation before applying.\n\nExactly one of --caller-namespace-default or --caller-namespace is required.\n\nExample (default rule for caller namespaces):\n\n```\ntemporal cloud namespace caller-rate-limit set --namespace my-namespace.my-account \\\n --caller-namespace-default --rps 100\n```\n\nExample (rule for a specific caller namespace):\n\n```\ntemporal cloud namespace caller-rate-limit set --namespace my-namespace.my-account \\\n --caller-namespace caller-ns.my-account --rps 50\n```" + } + s.Command.Args = cobra.NoArgs + s.Command.Flags().Float32Var(&s.Rps, "rps", 0, "The maximum requests per second allowed from the matched callers. 0 blocks all traffic from the matched callers. Required.") + _ = cobra.MarkFlagRequired(s.Command.Flags(), "rps") + s.ClientOptions.BuildFlags(s.Command.Flags()) + s.NamespaceOptions.BuildFlags(s.Command.Flags()) + s.CallerRateLimitCallerOptions.BuildFlags(s.Command.Flags()) + s.AsyncOperationOptions.BuildFlags(s.Command.Flags()) + s.ResourceVersionOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + type CloudNamespaceCapacityCommand struct { Parent *CloudNamespaceCommand Command cobra.Command diff --git a/temporalcloudcli/commands.namespace.caller_rate_limit.go b/temporalcloudcli/commands.namespace.caller_rate_limit.go new file mode 100644 index 0000000..59575f4 --- /dev/null +++ b/temporalcloudcli/commands.namespace.caller_rate_limit.go @@ -0,0 +1,511 @@ +package temporalcloudcli + +import ( + "encoding/json" + "errors" + "fmt" + "slices" + "strconv" + "strings" + + cloudservice "go.temporal.io/cloud-sdk/api/cloudservice/v1" + namespacev1 "go.temporal.io/cloud-sdk/api/namespace/v1" + resourcev1 "go.temporal.io/cloud-sdk/api/resource/v1" + "google.golang.org/protobuf/proto" + + "github.com/temporalio/cloud-cli/temporalcloudcli/internal/printer" +) + +const ( + callerTypeNamespace = "namespace" + // callerRateLimitDefaultKey sorts before the caller namespace keys (callerTypeNamespace + ":" + id). + callerRateLimitDefaultKey = "default" + // callerRateLimitBlocksAllWarning is the rps 0 warning shared by set and apply. Both print it + // with Println, a no-op in JSON mode, matching PromptApply skipping the diff there. + callerRateLimitBlocksAllWarning = "rps 0 blocks all traffic from the matched callers" +) + +// callerRateLimitChange is one rule to create (existing == nil) or update. key orders apply's changes. +type callerRateLimitChange struct { + key string + existing *namespacev1.CallerRateLimit + spec *namespacev1.CallerRateLimitSpec +} + +func (c *CloudNamespaceCallerRateLimitGetCommand) run(cctx *CommandContext, _ []string) error { + filter, err := callerFilterFromFlags(c.CallerNamespaceDefault, c.CallerNamespace) + if err != nil { + return err + } + client, err := cctx.GetCloudClient(c.ClientOptions) + if err != nil { + return err + } + rl, err := findCallerRateLimit(cctx, client, c.Namespace, filter) + if err != nil { + return err + } + if rl == nil { + return callerRateLimitNotFoundErr(c.Namespace, filter) + } + // EmitDefaultValues so a rule with rps 0 (blocks all) still shows its rps. + return cctx.Printer.PrintResource(rl, printer.PrintResourceOptions{EmitDefaultValues: true}) +} + +func (c *CloudNamespaceCallerRateLimitListCommand) run(cctx *CommandContext, _ []string) error { + client, err := cctx.GetCloudClient(c.ClientOptions) + if err != nil { + return err + } + // AIDEV-NOTE: default + caller in one CallerFilter is a server-side union + // (returns the default rule and the caller's rule). Intentionally allowed. + var filter *cloudservice.GetCallerRateLimitsRequest_CallerFilter + if c.Type.Value != "" || c.CallerNamespaceDefault || c.CallerNamespace != "" { + // --type is validated by its FlagStringEnum; "namespace" is the only caller type today. + callerType := c.Type.Value + if callerType == "" { + callerType = callerTypeNamespace + } + filter = &cloudservice.GetCallerRateLimitsRequest_CallerFilter{ + CallerType: callerType, + Default: c.CallerNamespaceDefault, + Caller: c.CallerNamespace, + } + } + res, err := client.GetCallerRateLimits(cctx, &cloudservice.GetCallerRateLimitsRequest{ + Namespace: c.Namespace, + PageSize: int32(c.PageSize), + PageToken: c.PageToken, + CallerFilter: filter, + }) + if err != nil { + return err + } + return cctx.Printer.PrintResourceList( + struct { + CallerRateLimits []*namespacev1.CallerRateLimit + NextPageToken string + }{CallerRateLimits: res.CallerRateLimits, NextPageToken: res.NextPageToken}, + // EmitDefaultValues so a rule with rps 0 (blocks all) still shows its rps. + printer.PrintResourceOptions{Fields: []string{"Id", "State"}, EmitDefaultValues: true}, + printer.TableOptions{}, + ) +} + +// AIDEV-NOTE: A missing rule is an error even with --idempotent, matching the +// custom-role and nexus endpoint deletes. --idempotent only covers the Delete RPC +// itself returning NotFound (e.g. a concurrent delete), via the poller. +func (c *CloudNamespaceCallerRateLimitDeleteCommand) run(cctx *CommandContext, _ []string) error { + filter, err := callerFilterFromFlags(c.CallerNamespaceDefault, c.CallerNamespace) + if err != nil { + return err + } + client, err := cctx.GetCloudClient(c.ClientOptions) + if err != nil { + return err + } + rl, err := findCallerRateLimit(cctx, client, c.Namespace, filter) + if err != nil { + return err + } + if rl == nil { + return callerRateLimitNotFoundErr(c.Namespace, filter) + } + yes, err := cctx.GetPrompter().PromptYes("Delete") + if err != nil { + return err + } + if !yes { + return errors.New("Aborting delete.") + } + rv := rl.ResourceVersion + if c.ResourceVersion != "" { + rv = c.ResourceVersion + } + resp, err := client.DeleteCallerRateLimit(cctx, &cloudservice.DeleteCallerRateLimitRequest{ + Namespace: c.Namespace, + CallerRateLimitId: rl.Id, + ResourceVersion: rv, + AsyncOperationId: c.AsyncOperationId, + }) + return cctx.GetPoller(client, c.AsyncOperationOptions).HandleDeleteOperation(cctx, resp, err) +} + +// AIDEV-NOTE: set is an upsert. PromptApply is always called; existing is a typed nil +// when the rule doesn't exist (an untyped nil makes PrintDiff fail silently). +func (c *CloudNamespaceCallerRateLimitSetCommand) run(cctx *CommandContext, _ []string) error { + filter, err := callerFilterFromFlags(c.CallerNamespaceDefault, c.CallerNamespace) + if err != nil { + return err + } + client, err := cctx.GetCloudClient(c.ClientOptions) + if err != nil { + return err + } + rl, err := findCallerRateLimit(cctx, client, c.Namespace, filter) + if err != nil { + return err + } + rps := float32FlagToFloat64(c.Rps) + spec := callerRateLimitSpec(filter, rps) + var existingSpec *namespacev1.CallerRateLimitSpec + if rl != nil { + existingSpec = rl.Spec + } + if callerRateLimitBlocksAll(spec) { + cctx.Printer.Println("Warning: " + callerRateLimitBlocksAllWarning + ".") + } + yes, err := cctx.GetPrompter().PromptApply(existingSpec, spec, false) + if err != nil { + return err + } + if !yes { + return errors.New("Aborting set.") + } + ch := callerRateLimitChange{existing: rl, spec: spec} + return upsertCallerRateLimit(cctx, client, c.Namespace, ch, c.AsyncOperationOptions, c.ResourceVersion) +} + +// AIDEV-NOTE: apply is an additive upsert: rules in --spec are created or updated, +// rules not in --spec are left untouched. Changed rules are applied one at a time in +// key order (the same order as the diff), failing fast. A rule is skipped only when its +// spec matches and it is active, so a rerun skips applied rules and retries failed ones. +// It also re-sends rules whose operation is still in progress (user decision: documented +// in the help text rather than skipped). +func (c *CloudNamespaceCallerRateLimitApplyCommand) run(cctx *CommandContext, _ []string) error { + specs, err := parseCallerRateLimitSpecs(cctx, c.Spec) + if err != nil { + return err + } + client, err := cctx.GetCloudClient(c.ClientOptions) + if err != nil { + return err + } + byKey, err := listAllCallerRateLimits(cctx, client, c.Namespace) + if err != nil { + return err + } + changes := planCallerRateLimitChanges(byKey, specs) + if len(changes) == 0 { + cctx.Printer.Println("No changes to apply: all rules in --spec already match.") + return nil + } + if len(changes) > 1 && (c.AsyncOperationId != "" || c.ResourceVersion != "") { + return errors.New("--async-operation-id and --resource-version can only be used when apply " + + "changes a single rule") + } + if err := c.confirmChanges(cctx, changes); err != nil { + return err + } + // With --async, earlier rules were only submitted, not applied. + doneVerb := "applied" + if c.Async { + doneVerb = "submitted" + } + var applied []string + for _, ch := range changes { + err := upsertCallerRateLimit(cctx, client, c.Namespace, ch, c.AsyncOperationOptions, c.ResourceVersion) + if err != nil { + done := "none" + if len(applied) > 0 { + done = strings.Join(applied, ", ") + } + return fmt.Errorf("failed to apply %s: %w (already %s: %s)", + describeCallerRateLimit(ch.spec), err, doneVerb, done) + } + applied = append(applied, describeCallerRateLimit(ch.spec)) + } + return nil +} + +// confirmChanges prints one plan line per changed rule, then shows one diff +// of the changed rules and asks for confirmation. +// AIDEV-NOTE: PromptApply diffs a single proto.Message, so the rules are wrapped in a +// GetCallerRateLimitsResponse. Only Spec is set on each rule so the diff shows spec content +// only. Creates appear only on the modified side. +func (c *CloudNamespaceCallerRateLimitApplyCommand) confirmChanges( + cctx *CommandContext, + changes []callerRateLimitChange, +) error { + before := &cloudservice.GetCallerRateLimitsResponse{} + after := &cloudservice.GetCallerRateLimitsResponse{} + for _, ch := range changes { + action := "Create" + if ch.existing != nil { + action = "Update" + before.CallerRateLimits = append(before.CallerRateLimits, + &namespacev1.CallerRateLimit{Spec: ch.existing.Spec}) + } + after.CallerRateLimits = append(after.CallerRateLimits, &namespacev1.CallerRateLimit{Spec: ch.spec}) + // The diff doesn't name the rule, so the plan line does. + line := action + " " + describeCallerRateLimit(ch.spec) + // An unchanged spec is planned only for a rule that isn't active, and its diff is empty, + // so the plan line says why it is sent. + if ch.existing != nil && proto.Equal(ch.existing.Spec, ch.spec) { + line += " (retrying: state " + + strings.TrimPrefix(ch.existing.GetState().String(), "RESOURCE_STATE_") + ")" + } + if callerRateLimitBlocksAll(ch.spec) { + line += " (warning: " + callerRateLimitBlocksAllWarning + ")" + } + cctx.Printer.Println(line) + } + yes, err := cctx.GetPrompter().PromptApply(before, after, c.VerboseDiff) + if err != nil { + return err + } + if !yes { + return errors.New("Aborting apply.") + } + return nil +} + +// upsertCallerRateLimit creates ch.spec when ch.existing is nil, otherwise updates ch.existing, +// and, unless --async, waits for the async operation. resourceVersion overrides the existing +// rule's resource version when set. +// AIDEV-NOTE: --resource-version is ignored on create, as custom-role apply does. +func upsertCallerRateLimit( + cctx *CommandContext, + client cloudservice.CloudServiceClient, + namespace string, + ch callerRateLimitChange, + asyncOpts AsyncOperationOptions, + resourceVersion string, +) error { + poller := cctx.GetPoller(client, asyncOpts) + if ch.existing == nil { + resp, err := client.CreateCallerRateLimit(cctx, &cloudservice.CreateCallerRateLimitRequest{ + Namespace: namespace, + Spec: ch.spec, + AsyncOperationId: asyncOpts.AsyncOperationId, + }) + return poller.HandleCreateAsyncOperationResponse(cctx, resp, err) + } + rv := ch.existing.ResourceVersion + if resourceVersion != "" { + rv = resourceVersion + } + resp, err := client.UpdateCallerRateLimit(cctx, &cloudservice.UpdateCallerRateLimitRequest{ + Namespace: namespace, + CallerRateLimitId: ch.existing.Id, + Spec: ch.spec, + ResourceVersion: rv, + AsyncOperationId: asyncOpts.AsyncOperationId, + }) + return poller.HandleUpdateOperation(cctx, resp, err) +} + +// parseCallerRateLimitSpecs parses --spec as a JSON array of specs and rejects duplicate rules. +// Entry numbers in errors are 1-based. +func parseCallerRateLimitSpecs(cctx *CommandContext, raw string) ([]*namespacev1.CallerRateLimitSpec, error) { + data, err := loadJSONSpec(raw) + if err != nil { + return nil, err + } + var entries []json.RawMessage + if err := json.Unmarshal(data, &entries); err != nil { + return nil, fmt.Errorf("failed to parse JSON spec: expected an array of caller rate limits: %w", err) + } + specs := make([]*namespacev1.CallerRateLimitSpec, len(entries)) + // AIDEV-NOTE: Duplicates are rejected client-side, unlike command-implementation.md's + // "let the server detect duplicates": each rule is a separate request, so the server + // can't see a duplicate within one file, and it would cause a partial apply. + firstEntry := map[string]int{} + for i, entry := range entries { + spec := &namespacev1.CallerRateLimitSpec{} + if err := cctx.UnmarshalProtoJSON(entry, spec); err != nil { + return nil, fmt.Errorf("failed to parse JSON spec entry %d: %w", i+1, err) + } + key := callerRateLimitKey(spec) + if first, ok := firstEntry[key]; ok { + return nil, fmt.Errorf("duplicate %s in spec (entries %d and %d)", + describeCallerRateLimit(spec), first, i+1) + } + firstEntry[key] = i + 1 + specs[i] = spec + } + return specs, nil +} + +// planCallerRateLimitChanges returns the specs that need a create or update, sorted by key. +// AIDEV-NOTE: A matching rule is skipped only when it is active. In any other state (e.g. a +// failed update) it is updated again: the server keeps the desired spec on a failed rule and +// only treats an update as a no-op when the rule is active. +func planCallerRateLimitChanges( + byKey map[string]*namespacev1.CallerRateLimit, + specs []*namespacev1.CallerRateLimitSpec, +) []callerRateLimitChange { + var changes []callerRateLimitChange + for _, spec := range specs { + key := callerRateLimitKey(spec) + rl := byKey[key] + if rl != nil && proto.Equal(rl.Spec, spec) && rl.GetState() == resourcev1.ResourceState_RESOURCE_STATE_ACTIVE { + continue + } + changes = append(changes, callerRateLimitChange{key: key, existing: rl, spec: spec}) + } + slices.SortFunc(changes, func(a, b callerRateLimitChange) int { return strings.Compare(a.key, b.key) }) + return changes +} + +// listAllCallerRateLimits pages through every rule on the namespace, indexed by key. +// AIDEV-NOTE: Existing rules whose caller type this CLI doesn't recognize (Rule decodes as +// nil, keyed "") are skipped: apply can't target them, and skipping them means a spec entry +// with no rule ({}) never matches an existing rule. It is planned as a create and the server +// rejects it. +func listAllCallerRateLimits( + cctx *CommandContext, + client cloudservice.CloudServiceClient, + namespace string, +) (map[string]*namespacev1.CallerRateLimit, error) { + byKey := map[string]*namespacev1.CallerRateLimit{} + var pageToken string + for { + res, err := client.GetCallerRateLimits(cctx, &cloudservice.GetCallerRateLimitsRequest{ + Namespace: namespace, + PageToken: pageToken, + }) + if err != nil { + return nil, err + } + for _, rl := range res.CallerRateLimits { + key := callerRateLimitKey(rl.Spec) + if key == "" { + continue + } + if prev, ok := byKey[key]; ok { + return nil, fmt.Errorf("found more than one %s on namespace %q (ids: %s, %s)", + describeCallerRateLimit(rl.Spec), namespace, prev.Id, rl.Id) + } + byKey[key] = rl + } + if res.NextPageToken == "" { + return byKey, nil + } + pageToken = res.NextPageToken + } +} + +// callerRateLimitKey identifies the caller a rule applies to; "" when the spec has no rule. +func callerRateLimitKey(spec *namespacev1.CallerRateLimitSpec) string { + switch rule := spec.GetRule().(type) { + case *namespacev1.CallerRateLimitSpec_NamespaceDefault: + return callerRateLimitDefaultKey + case *namespacev1.CallerRateLimitSpec_NamespaceLimit: + return callerTypeNamespace + ":" + rule.NamespaceLimit.GetNamespaceId() + } + return "" +} + +// describeCallerRateLimit names a rule for messages. +func describeCallerRateLimit(spec *namespacev1.CallerRateLimitSpec) string { + switch rule := spec.GetRule().(type) { + case *namespacev1.CallerRateLimitSpec_NamespaceDefault: + return "default caller rate limit" + case *namespacev1.CallerRateLimitSpec_NamespaceLimit: + return fmt.Sprintf("caller rate limit for caller namespace %q", rule.NamespaceLimit.GetNamespaceId()) + } + return "caller rate limit with no rule" +} + +// callerRateLimitBlocksAll reports whether spec has a rule whose rps is 0, which blocks all traffic +// from the matched callers. +// AIDEV-TODO: PrintDiff omits proto default values, so rps 0 is invisible in set's and apply's +// diffs; add EmitDefaultValues to printer.DiffOptions (and thread through the prompter) as a +// follow-up, then drop the warning. +// AIDEV-NOTE: The warning and apply's retry plan-line suffix are not covered by unit tests; +// text output includes poller timestamps. +func callerRateLimitBlocksAll(spec *namespacev1.CallerRateLimitSpec) bool { + switch rule := spec.GetRule().(type) { + case *namespacev1.CallerRateLimitSpec_NamespaceDefault: + return rule.NamespaceDefault.GetRps() == 0 + case *namespacev1.CallerRateLimitSpec_NamespaceLimit: + return rule.NamespaceLimit.GetRps() == 0 + } + return false +} + +// callerRateLimitSpec builds the rule for the caller selected by filter. +func callerRateLimitSpec( + filter *cloudservice.GetCallerRateLimitsRequest_CallerFilter, + rps float64, +) *namespacev1.CallerRateLimitSpec { + if filter.Default { + return &namespacev1.CallerRateLimitSpec{ + Rule: &namespacev1.CallerRateLimitSpec_NamespaceDefault{ + NamespaceDefault: &namespacev1.NamespaceDefaultCallerRateLimit{Rps: rps}, + }, + } + } + return &namespacev1.CallerRateLimitSpec{ + Rule: &namespacev1.CallerRateLimitSpec_NamespaceLimit{ + NamespaceLimit: &namespacev1.NamespaceCallerRateLimit{NamespaceId: filter.Caller, Rps: rps}, + }, + } +} + +// AIDEV-NOTE: gen-commands only emits float32 flags; round-trip through the +// shortest float32 decimal so --rps 0.1 is sent as 0.1, not 0.10000000149. +func float32FlagToFloat64(f float32) float64 { + v, _ := strconv.ParseFloat(strconv.FormatFloat(float64(f), 'g', -1, 32), 64) + return v +} + +// callerFilterFromFlags builds the server-side caller filter from the mutually +// exclusive --caller-namespace-default and --caller-namespace flags. +func callerFilterFromFlags( + isDefault bool, + callerNamespace string, +) (*cloudservice.GetCallerRateLimitsRequest_CallerFilter, error) { + if !isDefault && callerNamespace == "" { + return nil, errors.New("either --caller-namespace-default or --caller-namespace is required") + } + if isDefault && callerNamespace != "" { + return nil, errors.New("--caller-namespace-default and --caller-namespace are mutually exclusive") + } + return &cloudservice.GetCallerRateLimitsRequest_CallerFilter{ + CallerType: callerTypeNamespace, + Default: isDefault, + Caller: callerNamespace, + }, nil +} + +// AIDEV-NOTE: The server-side caller filter returns at most one rule per +// (namespace, caller), so a single call without paging is enough. We still +// error on more than one match rather than silently picking one. +// Returns (nil, nil) when no rule matches; callers decide whether that is an error. +func findCallerRateLimit( + cctx *CommandContext, + client cloudservice.CloudServiceClient, + namespace string, + filter *cloudservice.GetCallerRateLimitsRequest_CallerFilter, +) (*namespacev1.CallerRateLimit, error) { + res, err := client.GetCallerRateLimits(cctx, &cloudservice.GetCallerRateLimitsRequest{ + Namespace: namespace, + CallerFilter: filter, + }) + if err != nil { + return nil, err + } + switch len(res.CallerRateLimits) { + case 0: + return nil, nil + case 1: + return res.CallerRateLimits[0], nil + } + ids := make([]string, len(res.CallerRateLimits)) + for i, rl := range res.CallerRateLimits { + ids[i] = rl.Id + } + return nil, fmt.Errorf("found more than one %s on namespace %q (ids: %s)", + describeCallerRateLimit(callerRateLimitSpec(filter, 0)), namespace, strings.Join(ids, ", ")) +} + +// callerRateLimitNotFoundErr describes a missing rule in terms of the flag the user passed. +func callerRateLimitNotFoundErr( + namespace string, + filter *cloudservice.GetCallerRateLimitsRequest_CallerFilter, +) error { + return fmt.Errorf("%s not found on namespace %q", + describeCallerRateLimit(callerRateLimitSpec(filter, 0)), namespace) +} diff --git a/temporalcloudcli/commands.namespace.caller_rate_limit_test.go b/temporalcloudcli/commands.namespace.caller_rate_limit_test.go new file mode 100644 index 0000000..f542f05 --- /dev/null +++ b/temporalcloudcli/commands.namespace.caller_rate_limit_test.go @@ -0,0 +1,1037 @@ +package temporalcloudcli_test + +import ( + "errors" + "fmt" + "testing" + + "github.com/stretchr/testify/mock" + cliext "github.com/temporalio/cli/cliext" + cloudservice "go.temporal.io/cloud-sdk/api/cloudservice/v1" + namespacev1 "go.temporal.io/cloud-sdk/api/namespace/v1" + "go.temporal.io/cloud-sdk/api/operation/v1" + resourcev1 "go.temporal.io/cloud-sdk/api/resource/v1" + "google.golang.org/protobuf/proto" + + cloudmock "github.com/temporalio/cloud-cli/internal/cloudservice/mock" + "github.com/temporalio/cloud-cli/temporalcloudcli" +) + +type ( + callerRateLimitListOutput struct { + CallerRateLimits []*namespacev1.CallerRateLimit + NextPageToken string + } + + callerRateLimitGetFlags struct { + isDefault bool + caller string + } + + callerRateLimitListFlags struct { + callerType string + isDefault bool + caller string + pageSize int + pageToken string + } + + callerRateLimitDeleteFlags struct { + isDefault bool + caller string + resourceVersion string + asyncOperationID string + idempotent bool + } + + callerRateLimitSetFlags struct { + isDefault bool + caller string + rps float32 + resourceVersion string + asyncOperationID string + } + + callerRateLimitApplyFlags struct { + spec string + resourceVersion string + asyncOperationID string + verboseDiff bool + async bool + } + + // mutationExpectation sets one Create or Update expectation and returns it for ordering. + mutationExpectation func(c *cloudmock.MockCloudServiceClient) *mock.Call +) + +var ( + testCallerRateLimitDefault = defaultCallerRateLimit(100) + testCallerRateLimitDefaultRpsZero = defaultCallerRateLimit(0) + testCallerRateLimitCaller = &namespacev1.CallerRateLimit{ + Id: "crl-caller", + Namespace: "my-ns.acct", + ResourceVersion: "rv-caller", + State: resourcev1.ResourceState_RESOURCE_STATE_ACTIVE, + Spec: callerRuleSpec("caller-ns.acct", 10), + } + testCallerRateLimitCallerRpsZero = &namespacev1.CallerRateLimit{ + Id: "crl-caller-rps-zero", + Namespace: "my-ns.acct", + ResourceVersion: "rv-caller-rps-zero", + State: resourcev1.ResourceState_RESOURCE_STATE_ACTIVE, + Spec: callerRuleSpec("blocked-ns.acct", 0), + } +) + +func defaultCallerRateLimit(rps float64) *namespacev1.CallerRateLimit { + return &namespacev1.CallerRateLimit{ + Id: "crl-default", + Namespace: "my-ns.acct", + ResourceVersion: "rv-default", + State: resourcev1.ResourceState_RESOURCE_STATE_ACTIVE, + Spec: defaultRuleSpec(rps), + } +} + +func defaultRuleSpec(rps float64) *namespacev1.CallerRateLimitSpec { + return &namespacev1.CallerRateLimitSpec{ + Rule: &namespacev1.CallerRateLimitSpec_NamespaceDefault{ + NamespaceDefault: &namespacev1.NamespaceDefaultCallerRateLimit{Rps: rps}, + }, + } +} + +func callerRuleSpec(caller string, rps float64) *namespacev1.CallerRateLimitSpec { + return &namespacev1.CallerRateLimitSpec{ + Rule: &namespacev1.CallerRateLimitSpec_NamespaceLimit{ + NamespaceLimit: &namespacev1.NamespaceCallerRateLimit{NamespaceId: caller, Rps: rps}, + }, + } +} + +func callerRateLimitsRequest(isDefault bool, caller string) *cloudservice.GetCallerRateLimitsRequest { + return &cloudservice.GetCallerRateLimitsRequest{ + Namespace: "my-ns.acct", + CallerFilter: &cloudservice.GetCallerRateLimitsRequest_CallerFilter{ + CallerType: "namespace", + Default: isDefault, + Caller: caller, + }, + } +} + +// promptApply expects PromptApply(existing, modified, verbose) and confirms with result. +func promptApply(existing, modified proto.Message, verbose, result bool) temporalcloudcli.TestPromptOptions { + return temporalcloudcli.TestPromptOptions{ + ExpectPrompApply: true, + ExpectPromptApplyExisting: existing, + ExpectPromptApplyModified: modified, + ExpectPromptApplyVerbose: verbose, + PromptResult: result, + } +} + +func (f callerRateLimitGetFlags) command() temporalcloudcli.CloudNamespaceCallerRateLimitGetCommand { + return temporalcloudcli.CloudNamespaceCallerRateLimitGetCommand{ + NamespaceOptions: temporalcloudcli.NamespaceOptions{Namespace: "my-ns.acct"}, + CallerRateLimitCallerOptions: temporalcloudcli.CallerRateLimitCallerOptions{ + CallerNamespaceDefault: f.isDefault, + CallerNamespace: f.caller, + }, + } +} + +func TestGetCallerRateLimit(t *testing.T) { + tests := []struct { + name string + flags callerRateLimitGetFlags + found []*namespacev1.CallerRateLimit + lookupErr error + expectedErr string + expectedJSONOutput any + }{ + { + name: "DefaultFound", + flags: callerRateLimitGetFlags{isDefault: true}, + found: []*namespacev1.CallerRateLimit{testCallerRateLimitDefault}, + expectedJSONOutput: testCallerRateLimitDefault, + }, + { + name: "CallerFound", + flags: callerRateLimitGetFlags{caller: "caller-ns.acct"}, + found: []*namespacev1.CallerRateLimit{testCallerRateLimitCaller}, + expectedJSONOutput: testCallerRateLimitCaller, + }, + { + name: "DefaultFoundRpsZero", + flags: callerRateLimitGetFlags{isDefault: true}, + found: []*namespacev1.CallerRateLimit{testCallerRateLimitDefaultRpsZero}, + // Emit defaults on the expected side too, so the JSON must contain "rps": 0. + expectedJSONOutput: testCallerRateLimitDefaultRpsZero, + }, + { + name: "DefaultNotFound", + flags: callerRateLimitGetFlags{isDefault: true}, + expectedErr: `default caller rate limit not found on namespace "my-ns.acct"`, + }, + { + name: "CallerNotFound", + flags: callerRateLimitGetFlags{caller: "caller-ns.acct"}, + expectedErr: `caller rate limit for caller namespace "caller-ns.acct" not found on namespace "my-ns.acct"`, + }, + { + name: "LookupError", + flags: callerRateLimitGetFlags{isDefault: true}, + lookupErr: errors.New("api error"), + expectedErr: "api error", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + cmd := tt.flags.command() + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ + CloudClientExpectations: func(c *cloudmock.MockCloudServiceClient) { + expectFindCallerRateLimit(c, tt.flags.isDefault, tt.flags.caller, tt.found, tt.lookupErr) + }, + JSONOutput: true, + ExpectedError: tt.expectedErr, + ExpectedOutputJson: tt.expectedJSONOutput, + ExpectedOutputJsonEmitDefaults: true, + }) + }) + } +} + +// Every command that targets one rule validates its caller flags before any RPC or prompt. +func TestCallerRateLimit_FlagValidation(t *testing.T) { + commands := []struct { + name string + build func(isDefault bool, caller string) temporalcloudcli.CommandIfc + }{ + { + name: "Get", + build: func(isDefault bool, caller string) temporalcloudcli.CommandIfc { + cmd := callerRateLimitGetFlags{isDefault: isDefault, caller: caller}.command() + return &cmd + }, + }, + { + name: "Delete", + build: func(isDefault bool, caller string) temporalcloudcli.CommandIfc { + cmd := callerRateLimitDeleteFlags{isDefault: isDefault, caller: caller}.command() + return &cmd + }, + }, + { + name: "Set", + build: func(isDefault bool, caller string) temporalcloudcli.CommandIfc { + cmd := callerRateLimitSetFlags{isDefault: isDefault, caller: caller, rps: 200}.command() + return &cmd + }, + }, + } + tests := []struct { + name string + isDefault bool + caller string + expectedErr string + }{ + { + name: "BothFlagsSet", + isDefault: true, + caller: "caller-ns.acct", + expectedErr: "--caller-namespace-default and --caller-namespace are mutually exclusive", + }, + { + name: "NeitherFlagSet", + expectedErr: "either --caller-namespace-default or --caller-namespace is required", + }, + } + for _, cmd := range commands { + for _, tt := range tests { + t.Run(cmd.name+tt.name, func(t *testing.T) { + // No CloudClientExpectations or PromptOptions: any RPC or prompt fails the test. + temporalcloudcli.TestCommand(t, cmd.build(tt.isDefault, tt.caller), temporalcloudcli.TestCommandOptions{ + ExpectedError: tt.expectedErr, + }) + }) + } + } +} + +func (f callerRateLimitListFlags) command() temporalcloudcli.CloudNamespaceCallerRateLimitListCommand { + return temporalcloudcli.CloudNamespaceCallerRateLimitListCommand{ + NamespaceOptions: temporalcloudcli.NamespaceOptions{Namespace: "my-ns.acct"}, + CallerRateLimitCallerOptions: temporalcloudcli.CallerRateLimitCallerOptions{ + CallerNamespaceDefault: f.isDefault, + CallerNamespace: f.caller, + }, + Type: cliext.FlagStringEnum{Value: f.callerType}, + PageSize: f.pageSize, + PageToken: f.pageToken, + } +} + +func TestListCallerRateLimits(t *testing.T) { + // The mock echoes this response for every case; the cases differ only in the request run builds. + // The rps 0 rule checks the JSON keeps "rps": 0. + allLimits := []*namespacev1.CallerRateLimit{ + testCallerRateLimitDefault, + testCallerRateLimitCaller, + testCallerRateLimitCallerRpsZero, + } + expectedOutput := callerRateLimitListOutput{CallerRateLimits: allLimits, NextPageToken: "page-3"} + tests := []struct { + name string + flags callerRateLimitListFlags + expectedRequest *cloudservice.GetCallerRateLimitsRequest + lookupErr error + expectedErr string + expectedJSONOutput any + }{ + { + name: "NoFilterWithPagination", + flags: callerRateLimitListFlags{pageSize: 5, pageToken: "page-2"}, + expectedRequest: &cloudservice.GetCallerRateLimitsRequest{ + Namespace: "my-ns.acct", + PageSize: 5, + PageToken: "page-2", + }, + expectedJSONOutput: expectedOutput, + }, + { + name: "TypeOnly", + flags: callerRateLimitListFlags{callerType: "namespace"}, + expectedRequest: &cloudservice.GetCallerRateLimitsRequest{ + Namespace: "my-ns.acct", + CallerFilter: &cloudservice.GetCallerRateLimitsRequest_CallerFilter{ + CallerType: "namespace", + }, + }, + expectedJSONOutput: expectedOutput, + }, + { + name: "DefaultOnly", + flags: callerRateLimitListFlags{isDefault: true}, + expectedRequest: callerRateLimitsRequest(true, ""), + expectedJSONOutput: expectedOutput, + }, + { + name: "CallerOnly", + flags: callerRateLimitListFlags{caller: "caller-ns.acct"}, + expectedRequest: callerRateLimitsRequest(false, "caller-ns.acct"), + expectedJSONOutput: expectedOutput, + }, + { + name: "DefaultAndCallerBothSent", + flags: callerRateLimitListFlags{ + callerType: "namespace", + isDefault: true, + caller: "caller-ns.acct", + }, + expectedRequest: callerRateLimitsRequest(true, "caller-ns.acct"), + expectedJSONOutput: expectedOutput, + }, + { + name: "LookupError", + expectedRequest: &cloudservice.GetCallerRateLimitsRequest{Namespace: "my-ns.acct"}, + lookupErr: errors.New("api error"), + expectedErr: "api error", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + cmd := tt.flags.command() + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ + CloudClientExpectations: func(c *cloudmock.MockCloudServiceClient) { + c.EXPECT(). + GetCallerRateLimits(mock.Anything, tt.expectedRequest, mock.Anything). + Return(&cloudservice.GetCallerRateLimitsResponse{ + CallerRateLimits: allLimits, + NextPageToken: "page-3", + }, tt.lookupErr) + }, + JSONOutput: true, + ExpectedError: tt.expectedErr, + ExpectedOutputJson: tt.expectedJSONOutput, + ExpectedOutputJsonEmitDefaults: true, + }) + }) + } +} + +func (f callerRateLimitDeleteFlags) command() temporalcloudcli.CloudNamespaceCallerRateLimitDeleteCommand { + return temporalcloudcli.CloudNamespaceCallerRateLimitDeleteCommand{ + NamespaceOptions: temporalcloudcli.NamespaceOptions{Namespace: "my-ns.acct"}, + CallerRateLimitCallerOptions: temporalcloudcli.CallerRateLimitCallerOptions{ + CallerNamespaceDefault: f.isDefault, + CallerNamespace: f.caller, + }, + AsyncOperationOptions: temporalcloudcli.AsyncOperationOptions{ + Idempotent: f.idempotent, + AsyncOperationId: f.asyncOperationID, + }, + ResourceVersionOptions: temporalcloudcli.ResourceVersionOptions{ResourceVersion: f.resourceVersion}, + } +} + +// expectFindCallerRateLimit expects the filtered lookup for the caller selected by isDefault and caller. +func expectFindCallerRateLimit( + c *cloudmock.MockCloudServiceClient, + isDefault bool, + caller string, + found []*namespacev1.CallerRateLimit, + err error, +) { + c.EXPECT(). + GetCallerRateLimits(mock.Anything, callerRateLimitsRequest(isDefault, caller), mock.Anything). + Return(&cloudservice.GetCallerRateLimitsResponse{CallerRateLimits: found}, err) +} + +func deleteCallerRateLimitRequest(id, rv, asyncOpID string) *cloudservice.DeleteCallerRateLimitRequest { + return &cloudservice.DeleteCallerRateLimitRequest{ + Namespace: "my-ns.acct", + CallerRateLimitId: id, + ResourceVersion: rv, + AsyncOperationId: asyncOpID, + } +} + +// Cases where the rule is found and the user confirms, so the Delete RPC is sent. +func TestDeleteCallerRateLimit(t *testing.T) { + tests := []struct { + name string + flags callerRateLimitDeleteFlags + found *namespacev1.CallerRateLimit + expectedRequest *cloudservice.DeleteCallerRateLimitRequest + deleteErr error + pollerOptions temporalcloudcli.TestAsyncPollerOptions + expectedErr string + }{ + { + name: "DefaultRule", + flags: callerRateLimitDeleteFlags{isDefault: true}, + found: testCallerRateLimitDefault, + expectedRequest: deleteCallerRateLimitRequest("crl-default", "rv-default", ""), + pollerOptions: temporalcloudcli.TestAsyncPollerOptions{AsyncOperationID: "op-del"}, + }, + { + name: "CallerRule", + flags: callerRateLimitDeleteFlags{caller: "caller-ns.acct"}, + found: testCallerRateLimitCaller, + expectedRequest: deleteCallerRateLimitRequest("crl-caller", "rv-caller", ""), + pollerOptions: temporalcloudcli.TestAsyncPollerOptions{AsyncOperationID: "op-del"}, + }, + { + name: "FlagOverrides", + flags: callerRateLimitDeleteFlags{ + isDefault: true, + resourceVersion: "rv-override", + asyncOperationID: "op-custom", + }, + found: testCallerRateLimitDefault, + expectedRequest: deleteCallerRateLimitRequest("crl-default", "rv-override", "op-custom"), + pollerOptions: temporalcloudcli.TestAsyncPollerOptions{AsyncOperationID: "op-del"}, + }, + { + name: "DeleteError", + flags: callerRateLimitDeleteFlags{isDefault: true}, + found: testCallerRateLimitDefault, + expectedRequest: deleteCallerRateLimitRequest("crl-default", "rv-default", ""), + deleteErr: errors.New("api error"), + expectedErr: "delete operation failed: api error", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + cmd := tt.flags.command() + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ + CloudClientExpectations: func(c *cloudmock.MockCloudServiceClient) { + expectFindCallerRateLimit(c, tt.flags.isDefault, tt.flags.caller, + []*namespacev1.CallerRateLimit{tt.found}, nil) + c.EXPECT(). + DeleteCallerRateLimit(mock.Anything, tt.expectedRequest, mock.Anything). + Return(&cloudservice.DeleteCallerRateLimitResponse{ + AsyncOperation: &operation.AsyncOperation{Id: "op-del"}, + }, tt.deleteErr) + }, + PromptOptions: temporalcloudcli.TestPromptOptions{ + ExpectPromptYes: true, + ExpectPromptYesMessage: "Delete", + PromptResult: true, + }, + AsyncPollerOptions: tt.pollerOptions, + ExpectedError: tt.expectedErr, + }) + }) + } +} + +func TestDeleteCallerRateLimit_Declined(t *testing.T) { + cmd := callerRateLimitDeleteFlags{isDefault: true}.command() + // No DeleteCallerRateLimit expectation: the RPC must not be sent. + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ + CloudClientExpectations: func(c *cloudmock.MockCloudServiceClient) { + expectFindCallerRateLimit(c, true, "", []*namespacev1.CallerRateLimit{testCallerRateLimitDefault}, nil) + }, + PromptOptions: temporalcloudcli.TestPromptOptions{ + ExpectPromptYes: true, + ExpectPromptYesMessage: "Delete", + PromptResult: false, + }, + ExpectedError: "Aborting delete.", + }) +} + +// Cases where the lookup does not yield a rule: no prompt and no Delete RPC. +// A missing rule is an error even with --idempotent. +func TestDeleteCallerRateLimit_LookupFails(t *testing.T) { + tests := []struct { + name string + flags callerRateLimitDeleteFlags + lookupErr error + expectedErr string + }{ + { + name: "NotFound", + flags: callerRateLimitDeleteFlags{isDefault: true}, + expectedErr: `default caller rate limit not found on namespace "my-ns.acct"`, + }, + { + name: "NotFoundIdempotent", + flags: callerRateLimitDeleteFlags{isDefault: true, idempotent: true}, + expectedErr: `default caller rate limit not found on namespace "my-ns.acct"`, + }, + { + name: "CallerNotFound", + flags: callerRateLimitDeleteFlags{caller: "caller-ns.acct"}, + expectedErr: `caller rate limit for caller namespace "caller-ns.acct" not found on namespace "my-ns.acct"`, + }, + { + name: "LookupError", + flags: callerRateLimitDeleteFlags{isDefault: true}, + lookupErr: errors.New("api error"), + expectedErr: "api error", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + cmd := tt.flags.command() + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ + CloudClientExpectations: func(c *cloudmock.MockCloudServiceClient) { + expectFindCallerRateLimit(c, tt.flags.isDefault, tt.flags.caller, nil, tt.lookupErr) + }, + ExpectedError: tt.expectedErr, + }) + }) + } +} + +// createOp expects one Create RPC for spec that returns async operation pollID. +func createOp(spec *namespacev1.CallerRateLimitSpec, asyncOpID, pollID string, err error) mutationExpectation { + return func(c *cloudmock.MockCloudServiceClient) *mock.Call { + return c.EXPECT(). + CreateCallerRateLimit(mock.Anything, &cloudservice.CreateCallerRateLimitRequest{ + Namespace: "my-ns.acct", + Spec: spec, + AsyncOperationId: asyncOpID, + }, mock.Anything). + Return(&cloudservice.CreateCallerRateLimitResponse{ + AsyncOperation: &operation.AsyncOperation{Id: pollID}, + }, err). + Call + } +} + +// updateOp expects one Update RPC of existing to spec that returns async operation pollID. +func updateOp( + existing *namespacev1.CallerRateLimit, + spec *namespacev1.CallerRateLimitSpec, + rv, asyncOpID, pollID string, + err error, +) mutationExpectation { + return func(c *cloudmock.MockCloudServiceClient) *mock.Call { + return c.EXPECT(). + UpdateCallerRateLimit(mock.Anything, &cloudservice.UpdateCallerRateLimitRequest{ + Namespace: "my-ns.acct", + CallerRateLimitId: existing.Id, + Spec: spec, + ResourceVersion: rv, + AsyncOperationId: asyncOpID, + }, mock.Anything). + Return(&cloudservice.UpdateCallerRateLimitResponse{ + AsyncOperation: &operation.AsyncOperation{Id: pollID}, + }, err). + Call + } +} + +func (f callerRateLimitSetFlags) command() temporalcloudcli.CloudNamespaceCallerRateLimitSetCommand { + return temporalcloudcli.CloudNamespaceCallerRateLimitSetCommand{ + NamespaceOptions: temporalcloudcli.NamespaceOptions{Namespace: "my-ns.acct"}, + CallerRateLimitCallerOptions: temporalcloudcli.CallerRateLimitCallerOptions{ + CallerNamespaceDefault: f.isDefault, + CallerNamespace: f.caller, + }, + AsyncOperationOptions: temporalcloudcli.AsyncOperationOptions{AsyncOperationId: f.asyncOperationID}, + ResourceVersionOptions: temporalcloudcli.ResourceVersionOptions{ResourceVersion: f.resourceVersion}, + Rps: f.rps, + } +} + +// Cases where no rule exists and the user confirms, so the Create RPC is sent. +func TestSetCallerRateLimit_Create(t *testing.T) { + // Typed nil: PromptApply receives a nil *CallerRateLimitSpec, not a nil interface. + noRule := (*namespacev1.CallerRateLimitSpec)(nil) + tests := []struct { + name string + flags callerRateLimitSetFlags + expectedSpec *namespacev1.CallerRateLimitSpec + mutationErr error + expectedErr string + }{ + { + name: "DefaultRuleRpsTenth", + flags: callerRateLimitSetFlags{isDefault: true, rps: 0.1}, + expectedSpec: defaultRuleSpec(0.1), + }, + { + name: "CallerRule", + flags: callerRateLimitSetFlags{caller: "caller-ns.acct", rps: 10}, + expectedSpec: callerRuleSpec("caller-ns.acct", 10), + }, + { + name: "AsyncOperationID", + flags: callerRateLimitSetFlags{isDefault: true, rps: 100, asyncOperationID: "op-custom"}, + expectedSpec: defaultRuleSpec(100), + }, + { + name: "CreateError", + flags: callerRateLimitSetFlags{isDefault: true, rps: 100}, + expectedSpec: defaultRuleSpec(100), + mutationErr: errors.New("api error"), + expectedErr: "create operation failed: api error", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + pollerOptions := temporalcloudcli.TestAsyncPollerOptions{AsyncOperationID: "op-create"} + if tt.mutationErr != nil { + // A failed Create is never polled. + pollerOptions = temporalcloudcli.TestAsyncPollerOptions{} + } + cmd := tt.flags.command() + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ + CloudClientExpectations: func(c *cloudmock.MockCloudServiceClient) { + expectFindCallerRateLimit(c, tt.flags.isDefault, tt.flags.caller, nil, nil) + createOp(tt.expectedSpec, tt.flags.asyncOperationID, "op-create", tt.mutationErr)(c) + }, + PromptOptions: promptApply(noRule, tt.expectedSpec, false, true), + AsyncPollerOptions: pollerOptions, + ExpectedError: tt.expectedErr, + }) + }) + } +} + +// Cases where the rule exists and the user confirms, so the Update RPC is sent. +func TestSetCallerRateLimit_Update(t *testing.T) { + tests := []struct { + name string + flags callerRateLimitSetFlags + found *namespacev1.CallerRateLimit + expectedSpec *namespacev1.CallerRateLimitSpec + expectedRV string + mutationErr error + expectedErr string + }{ + { + name: "DefaultRule", + flags: callerRateLimitSetFlags{isDefault: true, rps: 200}, + found: testCallerRateLimitDefault, + expectedSpec: defaultRuleSpec(200), + expectedRV: "rv-default", + }, + { + name: "CallerRuleFlagOverrides", + flags: callerRateLimitSetFlags{ + caller: "caller-ns.acct", + rps: 20, + resourceVersion: "rv-override", + asyncOperationID: "op-custom", + }, + found: testCallerRateLimitCaller, + expectedSpec: callerRuleSpec("caller-ns.acct", 20), + expectedRV: "rv-override", + }, + { + name: "UpdateError", + flags: callerRateLimitSetFlags{isDefault: true, rps: 200}, + found: testCallerRateLimitDefault, + expectedSpec: defaultRuleSpec(200), + expectedRV: "rv-default", + mutationErr: errors.New("api error"), + expectedErr: "update operation failed: api error", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + pollerOptions := temporalcloudcli.TestAsyncPollerOptions{AsyncOperationID: "op-update"} + if tt.mutationErr != nil { + // A failed Update is never polled. + pollerOptions = temporalcloudcli.TestAsyncPollerOptions{} + } + cmd := tt.flags.command() + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ + CloudClientExpectations: func(c *cloudmock.MockCloudServiceClient) { + expectFindCallerRateLimit(c, tt.flags.isDefault, tt.flags.caller, + []*namespacev1.CallerRateLimit{tt.found}, nil) + updateOp(tt.found, tt.expectedSpec, tt.expectedRV, tt.flags.asyncOperationID, "op-update", + tt.mutationErr)(c) + }, + PromptOptions: promptApply(tt.found.Spec, tt.expectedSpec, false, true), + AsyncPollerOptions: pollerOptions, + ExpectedError: tt.expectedErr, + }) + }) + } +} + +func TestSetCallerRateLimit_Declined(t *testing.T) { + cmd := callerRateLimitSetFlags{isDefault: true, rps: 200}.command() + // No Create/Update expectation: neither RPC may be sent. + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ + CloudClientExpectations: func(c *cloudmock.MockCloudServiceClient) { + expectFindCallerRateLimit(c, true, "", []*namespacev1.CallerRateLimit{testCallerRateLimitDefault}, nil) + }, + PromptOptions: promptApply(testCallerRateLimitDefault.Spec, defaultRuleSpec(200), false, false), + ExpectedError: "Aborting set.", + }) +} + +func TestSetCallerRateLimit_LookupFails(t *testing.T) { + cmd := callerRateLimitSetFlags{isDefault: true, rps: 200}.command() + // No PromptOptions: a prompt fails the test. + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ + CloudClientExpectations: func(c *cloudmock.MockCloudServiceClient) { + expectFindCallerRateLimit(c, true, "", nil, errors.New("api error")) + }, + ExpectedError: "api error", + }) +} + +func (f callerRateLimitApplyFlags) command() temporalcloudcli.CloudNamespaceCallerRateLimitApplyCommand { + return temporalcloudcli.CloudNamespaceCallerRateLimitApplyCommand{ + NamespaceOptions: temporalcloudcli.NamespaceOptions{Namespace: "my-ns.acct"}, + AsyncOperationOptions: temporalcloudcli.AsyncOperationOptions{ + AsyncOperationId: f.asyncOperationID, + Async: f.async, + }, + ResourceVersionOptions: temporalcloudcli.ResourceVersionOptions{ResourceVersion: f.resourceVersion}, + DiffOptions: temporalcloudcli.DiffOptions{VerboseDiff: f.verboseDiff}, + Spec: f.spec, + } +} + +// expectListAllCallerRateLimits expects one unfiltered GetCallerRateLimits call per page, +// chained by page tokens. +func expectListAllCallerRateLimits(c *cloudmock.MockCloudServiceClient, pages ...[]*namespacev1.CallerRateLimit) { + tokens := make([]string, len(pages)+1) // tokens[0] and tokens[len(pages)] stay "" + for i := 1; i < len(pages); i++ { + tokens[i] = fmt.Sprintf("page-%d", i) + } + for i, page := range pages { + c.EXPECT(). + GetCallerRateLimits(mock.Anything, &cloudservice.GetCallerRateLimitsRequest{ + Namespace: "my-ns.acct", + PageToken: tokens[i], + }, mock.Anything). + Return(&cloudservice.GetCallerRateLimitsResponse{CallerRateLimits: page, NextPageToken: tokens[i+1]}, nil) + } +} + +// callerRateLimitDiffList is the PromptApply side for specs: spec-only rules in a response. +func callerRateLimitDiffList(specs ...*namespacev1.CallerRateLimitSpec) *cloudservice.GetCallerRateLimitsResponse { + res := &cloudservice.GetCallerRateLimitsResponse{} + for _, spec := range specs { + res.CallerRateLimits = append(res.CallerRateLimits, &namespacev1.CallerRateLimit{Spec: spec}) + } + return res +} + +// Cases where the user confirms the diff, so the changed rules are sent in key order. +// Ops after a failing op have no expectation, so sending them fails the test. +// Every case's first op succeeds as "op-1", the only op polled. +func TestApplyCallerRateLimits(t *testing.T) { + existingPage := []*namespacev1.CallerRateLimit{testCallerRateLimitDefault, testCallerRateLimitCaller} + newCaller := callerRuleSpec("new-ns.acct", 5) + callerUpdated := callerRuleSpec("caller-ns.acct", 20) + updateFailedDefault := defaultCallerRateLimit(100) + updateFailedDefault.State = resourcev1.ResourceState_RESOURCE_STATE_UPDATE_FAILED + tests := []struct { + name string + flags callerRateLimitApplyFlags + pages [][]*namespacev1.CallerRateLimit + expectedBefore *cloudservice.GetCallerRateLimitsResponse + expectedAfter *cloudservice.GetCallerRateLimitsResponse + ops []mutationExpectation + expectedErr string + }{ + { + name: "UpdateVerboseDiff", + flags: callerRateLimitApplyFlags{spec: `[{"namespaceDefault":{"rps":200}}]`, verboseDiff: true}, + pages: [][]*namespacev1.CallerRateLimit{existingPage}, + expectedBefore: callerRateLimitDiffList(testCallerRateLimitDefault.Spec), + expectedAfter: callerRateLimitDiffList(defaultRuleSpec(200)), + ops: []mutationExpectation{ + updateOp(testCallerRateLimitDefault, defaultRuleSpec(200), "rv-default", "", "op-1", nil), + }, + }, + { + // The unchanged caller rule is on the second page, so it is only skipped if lookup pages. + name: "UnchangedRuleOnLaterPageSkipped", + flags: callerRateLimitApplyFlags{ + spec: `[{"namespaceLimit":{"namespaceId":"caller-ns.acct","rps":10}},{"namespaceDefault":{"rps":200}}]`, + }, + pages: [][]*namespacev1.CallerRateLimit{ + {testCallerRateLimitDefault}, + {testCallerRateLimitCaller}, + }, + expectedBefore: callerRateLimitDiffList(testCallerRateLimitDefault.Spec), + expectedAfter: callerRateLimitDiffList(defaultRuleSpec(200)), + ops: []mutationExpectation{ + updateOp(testCallerRateLimitDefault, defaultRuleSpec(200), "rv-default", "", "op-1", nil), + }, + }, + { + name: "SingleUpdateFlagOverrides", + flags: callerRateLimitApplyFlags{ + spec: `[{"namespaceLimit":{"namespaceId":"caller-ns.acct","rps":20}}]`, + resourceVersion: "rv-override", + asyncOperationID: "op-custom", + }, + pages: [][]*namespacev1.CallerRateLimit{existingPage}, + expectedBefore: callerRateLimitDiffList(testCallerRateLimitCaller.Spec), + expectedAfter: callerRateLimitDiffList(callerUpdated), + ops: []mutationExpectation{ + updateOp(testCallerRateLimitCaller, callerUpdated, "rv-override", "op-custom", "op-1", nil), + }, + }, + { + name: "SingleCreateAsyncOperationID", + flags: callerRateLimitApplyFlags{ + spec: `[{"namespaceLimit":{"namespaceId":"new-ns.acct","rps":5}}]`, + asyncOperationID: "op-custom", + }, + pages: [][]*namespacev1.CallerRateLimit{existingPage}, + expectedBefore: callerRateLimitDiffList(), + expectedAfter: callerRateLimitDiffList(newCaller), + ops: []mutationExpectation{createOp(newCaller, "op-custom", "op-1", nil)}, + }, + { + // The existing rule matches the file but its last update failed, so it is updated again. + name: "UnchangedButUpdateFailedRetried", + flags: callerRateLimitApplyFlags{spec: `[{"namespaceDefault":{"rps":100}}]`}, + pages: [][]*namespacev1.CallerRateLimit{{updateFailedDefault}}, + expectedBefore: callerRateLimitDiffList(defaultRuleSpec(100)), + expectedAfter: callerRateLimitDiffList(defaultRuleSpec(100)), + ops: []mutationExpectation{ + updateOp(updateFailedDefault, defaultRuleSpec(100), "rv-default", "", "op-1", nil), + }, + }, + { + // Existing rules with no rule (a caller type this CLI doesn't recognize) are skipped, + // so two of them are not reported as duplicates. + name: "UnrecognizedExistingRulesSkipped", + flags: callerRateLimitApplyFlags{spec: `[{"namespaceDefault":{"rps":200}}]`}, + pages: [][]*namespacev1.CallerRateLimit{{ + {Id: "crl-unknown-1", Spec: &namespacev1.CallerRateLimitSpec{}}, + {Id: "crl-unknown-2", Spec: &namespacev1.CallerRateLimitSpec{}}, + testCallerRateLimitDefault, + }}, + expectedBefore: callerRateLimitDiffList(testCallerRateLimitDefault.Spec), + expectedAfter: callerRateLimitDiffList(defaultRuleSpec(200)), + ops: []mutationExpectation{ + updateOp(testCallerRateLimitDefault, defaultRuleSpec(200), "rv-default", "", "op-1", nil), + }, + }, + { + // File order is the reverse of key order, so ops run default, caller, new-ns. + // The second op fails: the error names it and the first as applied; the third is never sent. + name: "FailFastAfterFirstOpInKeyOrder", + flags: callerRateLimitApplyFlags{spec: `[ + {"namespaceLimit":{"namespaceId":"new-ns.acct","rps":5}}, + {"namespaceLimit":{"namespaceId":"caller-ns.acct","rps":20}}, + {"namespaceDefault":{"rps":200}} + ]`}, + pages: [][]*namespacev1.CallerRateLimit{existingPage}, + expectedBefore: callerRateLimitDiffList(testCallerRateLimitDefault.Spec, testCallerRateLimitCaller.Spec), + expectedAfter: callerRateLimitDiffList(defaultRuleSpec(200), callerUpdated, newCaller), + ops: []mutationExpectation{ + updateOp(testCallerRateLimitDefault, defaultRuleSpec(200), "rv-default", "", "op-1", nil), + updateOp(testCallerRateLimitCaller, callerUpdated, "rv-caller", "", "op-2", errors.New("api error")), + }, + expectedErr: `failed to apply caller rate limit for caller namespace "caller-ns.acct": ` + + `update operation failed: api error (already applied: default caller rate limit)`, + }, + { + // With --async, earlier rules were only submitted, so the error says so. + // The harness poller always waits, so the first op is still polled. + name: "FailFastAsyncReportsSubmitted", + flags: callerRateLimitApplyFlags{ + spec: `[{"namespaceLimit":{"namespaceId":"caller-ns.acct","rps":20}},{"namespaceDefault":{"rps":200}}]`, + async: true, + }, + pages: [][]*namespacev1.CallerRateLimit{existingPage}, + expectedBefore: callerRateLimitDiffList(testCallerRateLimitDefault.Spec, testCallerRateLimitCaller.Spec), + expectedAfter: callerRateLimitDiffList(defaultRuleSpec(200), callerUpdated), + ops: []mutationExpectation{ + updateOp(testCallerRateLimitDefault, defaultRuleSpec(200), "rv-default", "", "op-1", nil), + updateOp(testCallerRateLimitCaller, callerUpdated, "rv-caller", "", "op-2", errors.New("api error")), + }, + expectedErr: `failed to apply caller rate limit for caller namespace "caller-ns.acct": ` + + `update operation failed: api error (already submitted: default caller rate limit)`, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + cmd := tt.flags.command() + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ + CloudClientExpectations: func(c *cloudmock.MockCloudServiceClient) { + expectListAllCallerRateLimits(c, tt.pages...) + calls := make([]*mock.Call, len(tt.ops)) + for i, op := range tt.ops { + calls[i] = op(c) + } + mock.InOrder(calls...) + }, + PromptOptions: promptApply(tt.expectedBefore, tt.expectedAfter, tt.flags.verboseDiff, true), + AsyncPollerOptions: temporalcloudcli.TestAsyncPollerOptions{AsyncOperationID: "op-1"}, + ExpectedError: tt.expectedErr, + }) + }) + } +} + +// Cases where nothing changes: a no-op message is printed with no prompt and no mutation. +func TestApplyCallerRateLimits_NoChanges(t *testing.T) { + tests := []struct { + name string + spec string + }{ + { + name: "AllUnchanged", + spec: `[{"namespaceLimit":{"namespaceId":"caller-ns.acct","rps":10}},{"namespaceDefault":{"rps":100}}]`, + }, + {name: "EmptyArray", spec: `[]`}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + cmd := callerRateLimitApplyFlags{spec: tt.spec}.command() + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ + CloudClientExpectations: func(c *cloudmock.MockCloudServiceClient) { + expectListAllCallerRateLimits(c, + []*namespacev1.CallerRateLimit{testCallerRateLimitDefault, testCallerRateLimitCaller}) + }, + ExpectedOutput: "No changes to apply: all rules in --spec already match.\n", + }) + }) + } +} + +// Cases rejected while parsing --spec, before any RPC. +func TestApplyCallerRateLimits_InvalidSpec(t *testing.T) { + tests := []struct { + name string + spec string + expectedErr string + }{ + { + name: "NotAnArray", + spec: `{"namespaceDefault":{"rps":1}}`, + expectedErr: "failed to parse JSON spec: expected an array", + }, + { + name: "InvalidEntry", + spec: `[{"namespaceDefault":{"rps":1}},{"namespaceDefault":{"rps":"fast"}}]`, + expectedErr: "failed to parse JSON spec entry 2", + }, + { + name: "DuplicateDefault", + spec: `[{"namespaceDefault":{"rps":1}},{"namespaceLimit":{"namespaceId":"caller-ns.acct","rps":1}},` + + `{"namespaceDefault":{"rps":2}}]`, + expectedErr: "duplicate default caller rate limit in spec (entries 1 and 3)", + }, + { + // Rules for different caller namespaces are not duplicates; only the repeated caller is. + name: "DuplicateCaller", + spec: `[{"namespaceLimit":{"namespaceId":"caller-ns.acct","rps":1}},` + + `{"namespaceLimit":{"namespaceId":"other-ns.acct","rps":1}},` + + `{"namespaceLimit":{"namespaceId":"caller-ns.acct","rps":2}}]`, + expectedErr: `duplicate caller rate limit for caller namespace "caller-ns.acct" in spec (entries 1 and 3)`, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + cmd := callerRateLimitApplyFlags{spec: tt.spec}.command() + // No CloudClientExpectations or PromptOptions: any RPC or prompt fails the test. + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ExpectedError: tt.expectedErr}) + }) + } +} + +// No prompt and no mutation when the lookup fails. +func TestApplyCallerRateLimits_LookupFails(t *testing.T) { + cmd := callerRateLimitApplyFlags{spec: `[{"namespaceDefault":{"rps":1}}]`}.command() + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ + CloudClientExpectations: func(c *cloudmock.MockCloudServiceClient) { + c.EXPECT(). + GetCallerRateLimits(mock.Anything, + &cloudservice.GetCallerRateLimitsRequest{Namespace: "my-ns.acct"}, mock.Anything). + Return(nil, errors.New("api error")) + }, + ExpectedError: "api error", + }) +} + +// With more than one changed rule, --async-operation-id and --resource-version are rejected +// before the prompt. +func TestApplyCallerRateLimits_FlagsWithMultipleChanges(t *testing.T) { + spec := `[{"namespaceDefault":{"rps":200}},{"namespaceLimit":{"namespaceId":"new-ns.acct","rps":5}}]` + tests := []struct { + name string + flags callerRateLimitApplyFlags + }{ + {name: "AsyncOperationID", flags: callerRateLimitApplyFlags{spec: spec, asyncOperationID: "op-custom"}}, + {name: "ResourceVersion", flags: callerRateLimitApplyFlags{spec: spec, resourceVersion: "rv-override"}}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + cmd := tt.flags.command() + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ + CloudClientExpectations: func(c *cloudmock.MockCloudServiceClient) { + expectListAllCallerRateLimits(c, []*namespacev1.CallerRateLimit{testCallerRateLimitDefault}) + }, + ExpectedError: "--async-operation-id and --resource-version can only be used when apply " + + "changes a single rule", + }) + }) + } +} + +func TestApplyCallerRateLimits_Declined(t *testing.T) { + cmd := callerRateLimitApplyFlags{spec: `[{"namespaceDefault":{"rps":200}}]`}.command() + // No Create/Update expectation: neither RPC may be sent. + temporalcloudcli.TestCommand(t, &cmd, temporalcloudcli.TestCommandOptions{ + CloudClientExpectations: func(c *cloudmock.MockCloudServiceClient) { + expectListAllCallerRateLimits(c, []*namespacev1.CallerRateLimit{testCallerRateLimitDefault}) + }, + PromptOptions: promptApply( + callerRateLimitDiffList(testCallerRateLimitDefault.Spec), + callerRateLimitDiffList(defaultRuleSpec(200)), + false, + false, + ), + ExpectedError: "Aborting apply.", + }) +} diff --git a/temporalcloudcli/commands.yml b/temporalcloudcli/commands.yml index c4a947f..3185f88 100644 --- a/temporalcloudcli/commands.yml +++ b/temporalcloudcli/commands.yml @@ -2013,6 +2013,223 @@ commands: must be greater than 0 when --capacity-mode is 'provisioned'. Ignored when --capacity-mode is 'on_demand'. + # Namespace caller rate limit commands + - name: cloud namespace caller-rate-limit + summary: Manage namespace caller rate limits + description: | + Commands for managing caller rate limits on Temporal Cloud namespaces. + + A caller rate limit caps the requests per second that callers, such as + other namespaces, can send to a target namespace. A namespace can have a + default rule for caller namespaces and rules for specific caller namespaces. + has-init: false + - name: cloud namespace caller-rate-limit get + summary: Get a namespace caller rate limit + description: | + Retrieve a caller rate limit rule on a Temporal Cloud namespace: either the + default rule for caller namespaces or the rule for a specific caller namespace. + + Exactly one of --caller-namespace-default or --caller-namespace is required. + + Example (default rule for caller namespaces): + + ``` + temporal cloud namespace caller-rate-limit get --namespace my-namespace.my-account \ + --caller-namespace-default + ``` + + Example (rule for a specific caller namespace): + + ``` + temporal cloud namespace caller-rate-limit get --namespace my-namespace.my-account \ + --caller-namespace caller-ns.my-account + ``` + has-init: false + option-sets: + - client + - namespace + - caller-rate-limit-caller + - name: cloud namespace caller-rate-limit list + summary: List namespace caller rate limits + description: | + List the caller rate limit rules on a Temporal Cloud namespace. With no + filter flags, all rules are listed (paginated). Use --type, + --caller-namespace-default, or --caller-namespace to filter the results. + + Example (all rules): + + ``` + temporal cloud namespace caller-rate-limit list --namespace my-namespace.my-account + ``` + + Example (default rule for caller namespaces): + + ``` + temporal cloud namespace caller-rate-limit list --namespace my-namespace.my-account \ + --caller-namespace-default + ``` + + Example (rule for a specific caller namespace): + + ``` + temporal cloud namespace caller-rate-limit list --namespace my-namespace.my-account \ + --caller-namespace caller-ns.my-account + ``` + + Example (default rule and a specific caller's rule, for comparison): + + ``` + temporal cloud namespace caller-rate-limit list --namespace my-namespace.my-account \ + --caller-namespace-default --caller-namespace caller-ns.my-account + ``` + has-init: false + option-sets: + - client + - namespace + - caller-rate-limit-caller + options: + - name: type + type: string-enum + enum-values: [namespace] + description: | + Only list rules for this caller type. More caller types may be + added in the future. Defaults to 'namespace' when + --caller-namespace-default or --caller-namespace is set. + - name: page-size + type: int + description: | + Number of caller rate limits to return per page. Use for paginated results. + - name: page-token + type: string + description: | + Token for retrieving the next page of results in a paginated list. + - name: cloud namespace caller-rate-limit delete + summary: Delete a namespace caller rate limit + description: | + Delete a caller rate limit rule on a Temporal Cloud namespace: either the + default rule for caller namespaces or the rule for a specific caller namespace. + + Exactly one of --caller-namespace-default or --caller-namespace is required. + + Example (default rule for caller namespaces): + + ``` + temporal cloud namespace caller-rate-limit delete --namespace my-namespace.my-account \ + --caller-namespace-default + ``` + + Example (rule for a specific caller namespace): + + ``` + temporal cloud namespace caller-rate-limit delete --namespace my-namespace.my-account \ + --caller-namespace caller-ns.my-account + ``` + has-init: false + option-sets: + - client + - namespace + - caller-rate-limit-caller + - async-operation + - resource-version + - name: cloud namespace caller-rate-limit set + summary: Set a namespace caller rate limit + description: | + Set a caller rate limit rule on a Temporal Cloud namespace: either the + default rule for caller namespaces or the rule for a specific caller namespace. + Creates the rule if it doesn't exist, otherwise updates it. Shows a diff + and asks for confirmation before applying. + + Exactly one of --caller-namespace-default or --caller-namespace is required. + + Example (default rule for caller namespaces): + + ``` + temporal cloud namespace caller-rate-limit set --namespace my-namespace.my-account \ + --caller-namespace-default --rps 100 + ``` + + Example (rule for a specific caller namespace): + + ``` + temporal cloud namespace caller-rate-limit set --namespace my-namespace.my-account \ + --caller-namespace caller-ns.my-account --rps 50 + ``` + has-init: false + option-sets: + - client + - namespace + - caller-rate-limit-caller + - async-operation + - resource-version + options: + - name: rps + type: float + required: true + description: | + The maximum requests per second allowed from the matched callers. + 0 blocks all traffic from the matched callers. + - name: cloud namespace caller-rate-limit apply + summary: Create or update namespace caller rate limits from a specification + description: | + Apply a list of caller rate limit rules to a Temporal Cloud namespace. + Each rule in the specification is created if it doesn't exist, or updated + if it differs from the existing rule. Rules that already match and are + active are skipped. Shows a diff of the changed rules and asks for + confirmation before applying. + + Apply is additive: existing rules that are not in the specification are left + untouched. Use 'temporal cloud namespace caller-rate-limit delete' to remove + a rule. + + The specification is a JSON array of caller rate limit specs. It can be + provided as inline JSON or loaded from a file by prefixing the path with '@'. + An rps of 0 blocks all traffic from the matched callers. + + Example file (limits.json) with the default rule for caller namespaces and + a rule for a specific caller namespace: + + ``` + [ + {"namespaceDefault": {"rps": 100}}, + {"namespaceLimit": {"namespaceId": "caller-ns.my-account", "rps": 50}} + ] + ``` + + Example: + + ``` + temporal cloud namespace caller-rate-limit apply --namespace my-namespace.my-account \ + --spec @limits.json + ``` + + Changed rules are applied one at a time. Apply stops at the first failure + and reports which rules were already applied. Rerunning skips rules that + were already applied and retries rules whose last update failed. A rule + that matches but is not active, including one whose operation is still in + progress, is updated again, so wait for in-progress operations (for example + after --async) to finish before rerunning. + + --async-operation-id and --resource-version can only be used when apply + changes a single rule. + + With --async, operations are submitted without waiting; fail-fast then only + covers submission errors, so check each printed operation. With -o json, each + operation prints its own JSON document. + has-init: false + option-sets: + - client + - namespace + - diff + - async-operation + - resource-version + options: + - name: spec + type: string + required: true + description: | + Caller rate limit specifications as a JSON array. Provide inline JSON + directly, or use '@path/to/file.json' to load from a file. + # Namespace access commands (who has access to a namespace) - name: cloud namespace user summary: Inspect users with access to a namespace @@ -5388,6 +5605,18 @@ option-sets: description: | Custom role ID to assign. Repeat to assign multiple. When provided, replaces the existing custom role list. + - name: caller-rate-limit-caller + options: + - name: caller-namespace-default + type: bool + description: | + Target the default rule, which applies to caller namespaces without a + specific rule. + - name: caller-namespace + type: string + description: | + The fully qualified caller namespace name in the format 'namespace.account' + (e.g., 'caller-ns.my-account'). - name: export-sink options: - name: sink-name diff --git a/temporalcloudcli/editor/mock/mock.go b/temporalcloudcli/editor/mock/mock.go index a0ca841..cfff244 100644 --- a/temporalcloudcli/editor/mock/mock.go +++ b/temporalcloudcli/editor/mock/mock.go @@ -15,10 +15,19 @@ func NewMockEditor(t interface { mock.TestingT Cleanup(func()) }) *MockEditor { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock := &MockEditor{} mock.Mock.Test(t) - t.Cleanup(func() { mock.AssertExpectations(t) }) + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) return mock } @@ -71,7 +80,7 @@ type MockEditor_EditProto_Call struct { // EditProto is a helper method to define mock.On call // - existing proto.Message -func (_e *MockEditor_Expecter) EditProto(existing interface{}) *MockEditor_EditProto_Call { +func (_e *MockEditor_Expecter) EditProto(existing any) *MockEditor_EditProto_Call { return &MockEditor_EditProto_Call{Call: _e.mock.On("EditProto", existing)} } @@ -88,8 +97,8 @@ func (_c *MockEditor_EditProto_Call) Run(run func(existing proto.Message)) *Mock return _c } -func (_c *MockEditor_EditProto_Call) Return(v proto.Message, err error) *MockEditor_EditProto_Call { - _c.Call.Return(v, err) +func (_c *MockEditor_EditProto_Call) Return(message proto.Message, err error) *MockEditor_EditProto_Call { + _c.Call.Return(message, err) return _c } diff --git a/temporalcloudcli/mock/mock.go b/temporalcloudcli/mock/mock.go index 4ebedd0..b66d7fc 100644 --- a/temporalcloudcli/mock/mock.go +++ b/temporalcloudcli/mock/mock.go @@ -22,10 +22,19 @@ func NewMockNamespaceClient(t interface { mock.TestingT Cleanup(func()) }) *MockNamespaceClient { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock := &MockNamespaceClient{} mock.Mock.Test(t) - t.Cleanup(func() { mock.AssertExpectations(t) }) + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) return mock } @@ -79,7 +88,7 @@ type MockNamespaceClient_AddCACerts_Call struct { // AddCACerts is a helper method to define mock.On call // - context1 context.Context // - addCACertsParams namespace.AddCACertsParams -func (_e *MockNamespaceClient_Expecter) AddCACerts(context1 interface{}, addCACertsParams interface{}) *MockNamespaceClient_AddCACerts_Call { +func (_e *MockNamespaceClient_Expecter) AddCACerts(context1 any, addCACertsParams any) *MockNamespaceClient_AddCACerts_Call { return &MockNamespaceClient_AddCACerts_Call{Call: _e.mock.On("AddCACerts", context1, addCACertsParams)} } @@ -147,7 +156,7 @@ type MockNamespaceClient_AddCertFilters_Call struct { // AddCertFilters is a helper method to define mock.On call // - context1 context.Context // - addCertFiltersParams namespace.AddCertFiltersParams -func (_e *MockNamespaceClient_Expecter) AddCertFilters(context1 interface{}, addCertFiltersParams interface{}) *MockNamespaceClient_AddCertFilters_Call { +func (_e *MockNamespaceClient_Expecter) AddCertFilters(context1 any, addCertFiltersParams any) *MockNamespaceClient_AddCertFilters_Call { return &MockNamespaceClient_AddCertFilters_Call{Call: _e.mock.On("AddCertFilters", context1, addCertFiltersParams)} } @@ -215,7 +224,7 @@ type MockNamespaceClient_CreateSearchAttribute_Call struct { // CreateSearchAttribute is a helper method to define mock.On call // - context1 context.Context // - createSearchAttributeParams namespace.CreateSearchAttributeParams -func (_e *MockNamespaceClient_Expecter) CreateSearchAttribute(context1 interface{}, createSearchAttributeParams interface{}) *MockNamespaceClient_CreateSearchAttribute_Call { +func (_e *MockNamespaceClient_Expecter) CreateSearchAttribute(context1 any, createSearchAttributeParams any) *MockNamespaceClient_CreateSearchAttribute_Call { return &MockNamespaceClient_CreateSearchAttribute_Call{Call: _e.mock.On("CreateSearchAttribute", context1, createSearchAttributeParams)} } @@ -283,7 +292,7 @@ type MockNamespaceClient_DeleteCACerts_Call struct { // DeleteCACerts is a helper method to define mock.On call // - context1 context.Context // - deleteCACertsParams namespace.DeleteCACertsParams -func (_e *MockNamespaceClient_Expecter) DeleteCACerts(context1 interface{}, deleteCACertsParams interface{}) *MockNamespaceClient_DeleteCACerts_Call { +func (_e *MockNamespaceClient_Expecter) DeleteCACerts(context1 any, deleteCACertsParams any) *MockNamespaceClient_DeleteCACerts_Call { return &MockNamespaceClient_DeleteCACerts_Call{Call: _e.mock.On("DeleteCACerts", context1, deleteCACertsParams)} } @@ -351,7 +360,7 @@ type MockNamespaceClient_DeleteCertFilters_Call struct { // DeleteCertFilters is a helper method to define mock.On call // - context1 context.Context // - deleteCertFiltersParams namespace.DeleteCertFiltersParams -func (_e *MockNamespaceClient_Expecter) DeleteCertFilters(context1 interface{}, deleteCertFiltersParams interface{}) *MockNamespaceClient_DeleteCertFilters_Call { +func (_e *MockNamespaceClient_Expecter) DeleteCertFilters(context1 any, deleteCertFiltersParams any) *MockNamespaceClient_DeleteCertFilters_Call { return &MockNamespaceClient_DeleteCertFilters_Call{Call: _e.mock.On("DeleteCertFilters", context1, deleteCertFiltersParams)} } @@ -419,7 +428,7 @@ type MockNamespaceClient_DeleteCodec_Call struct { // DeleteCodec is a helper method to define mock.On call // - context1 context.Context // - deleteCodecParams namespace.DeleteCodecParams -func (_e *MockNamespaceClient_Expecter) DeleteCodec(context1 interface{}, deleteCodecParams interface{}) *MockNamespaceClient_DeleteCodec_Call { +func (_e *MockNamespaceClient_Expecter) DeleteCodec(context1 any, deleteCodecParams any) *MockNamespaceClient_DeleteCodec_Call { return &MockNamespaceClient_DeleteCodec_Call{Call: _e.mock.On("DeleteCodec", context1, deleteCodecParams)} } @@ -487,7 +496,7 @@ type MockNamespaceClient_GetCodecServer_Call struct { // GetCodecServer is a helper method to define mock.On call // - context1 context.Context // - s string -func (_e *MockNamespaceClient_Expecter) GetCodecServer(context1 interface{}, s interface{}) *MockNamespaceClient_GetCodecServer_Call { +func (_e *MockNamespaceClient_Expecter) GetCodecServer(context1 any, s any) *MockNamespaceClient_GetCodecServer_Call { return &MockNamespaceClient_GetCodecServer_Call{Call: _e.mock.On("GetCodecServer", context1, s)} } @@ -555,7 +564,7 @@ type MockNamespaceClient_GetNamespace_Call struct { // GetNamespace is a helper method to define mock.On call // - context1 context.Context // - s string -func (_e *MockNamespaceClient_Expecter) GetNamespace(context1 interface{}, s interface{}) *MockNamespaceClient_GetNamespace_Call { +func (_e *MockNamespaceClient_Expecter) GetNamespace(context1 any, s any) *MockNamespaceClient_GetNamespace_Call { return &MockNamespaceClient_GetNamespace_Call{Call: _e.mock.On("GetNamespace", context1, s)} } @@ -623,7 +632,7 @@ type MockNamespaceClient_ListCACerts_Call struct { // ListCACerts is a helper method to define mock.On call // - context1 context.Context // - s string -func (_e *MockNamespaceClient_Expecter) ListCACerts(context1 interface{}, s interface{}) *MockNamespaceClient_ListCACerts_Call { +func (_e *MockNamespaceClient_Expecter) ListCACerts(context1 any, s any) *MockNamespaceClient_ListCACerts_Call { return &MockNamespaceClient_ListCACerts_Call{Call: _e.mock.On("ListCACerts", context1, s)} } @@ -691,7 +700,7 @@ type MockNamespaceClient_ListCertFilters_Call struct { // ListCertFilters is a helper method to define mock.On call // - context1 context.Context // - s string -func (_e *MockNamespaceClient_Expecter) ListCertFilters(context1 interface{}, s interface{}) *MockNamespaceClient_ListCertFilters_Call { +func (_e *MockNamespaceClient_Expecter) ListCertFilters(context1 any, s any) *MockNamespaceClient_ListCertFilters_Call { return &MockNamespaceClient_ListCertFilters_Call{Call: _e.mock.On("ListCertFilters", context1, s)} } @@ -759,7 +768,7 @@ type MockNamespaceClient_ListSearchAttributes_Call struct { // ListSearchAttributes is a helper method to define mock.On call // - context1 context.Context // - s string -func (_e *MockNamespaceClient_Expecter) ListSearchAttributes(context1 interface{}, s interface{}) *MockNamespaceClient_ListSearchAttributes_Call { +func (_e *MockNamespaceClient_Expecter) ListSearchAttributes(context1 any, s any) *MockNamespaceClient_ListSearchAttributes_Call { return &MockNamespaceClient_ListSearchAttributes_Call{Call: _e.mock.On("ListSearchAttributes", context1, s)} } @@ -827,7 +836,7 @@ type MockNamespaceClient_RenameSearchAttribute_Call struct { // RenameSearchAttribute is a helper method to define mock.On call // - context1 context.Context // - renameSearchAttributeParams namespace.RenameSearchAttributeParams -func (_e *MockNamespaceClient_Expecter) RenameSearchAttribute(context1 interface{}, renameSearchAttributeParams interface{}) *MockNamespaceClient_RenameSearchAttribute_Call { +func (_e *MockNamespaceClient_Expecter) RenameSearchAttribute(context1 any, renameSearchAttributeParams any) *MockNamespaceClient_RenameSearchAttribute_Call { return &MockNamespaceClient_RenameSearchAttribute_Call{Call: _e.mock.On("RenameSearchAttribute", context1, renameSearchAttributeParams)} } @@ -895,7 +904,7 @@ type MockNamespaceClient_SetCodec_Call struct { // SetCodec is a helper method to define mock.On call // - context1 context.Context // - setCodecParams namespace.SetCodecParams -func (_e *MockNamespaceClient_Expecter) SetCodec(context1 interface{}, setCodecParams interface{}) *MockNamespaceClient_SetCodec_Call { +func (_e *MockNamespaceClient_Expecter) SetCodec(context1 any, setCodecParams any) *MockNamespaceClient_SetCodec_Call { return &MockNamespaceClient_SetCodec_Call{Call: _e.mock.On("SetCodec", context1, setCodecParams)} } @@ -963,7 +972,7 @@ type MockNamespaceClient_UpdateNamespace_Call struct { // UpdateNamespace is a helper method to define mock.On call // - context1 context.Context // - updateNamespaceParams namespace.UpdateNamespaceParams -func (_e *MockNamespaceClient_Expecter) UpdateNamespace(context1 interface{}, updateNamespaceParams interface{}) *MockNamespaceClient_UpdateNamespace_Call { +func (_e *MockNamespaceClient_Expecter) UpdateNamespace(context1 any, updateNamespaceParams any) *MockNamespaceClient_UpdateNamespace_Call { return &MockNamespaceClient_UpdateNamespace_Call{Call: _e.mock.On("UpdateNamespace", context1, updateNamespaceParams)} } @@ -1001,10 +1010,19 @@ func NewMockPoller(t interface { mock.TestingT Cleanup(func()) }) *MockPoller { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock := &MockPoller{} mock.Mock.Test(t) - t.Cleanup(func() { mock.AssertExpectations(t) }) + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) return mock } @@ -1048,7 +1066,7 @@ type MockPoller_PollAsyncOperation_Call struct { // - commandContext *temporalcloudcli.CommandContext // - s string // - s1 string -func (_e *MockPoller_Expecter) PollAsyncOperation(commandContext interface{}, s interface{}, s1 interface{}) *MockPoller_PollAsyncOperation_Call { +func (_e *MockPoller_Expecter) PollAsyncOperation(commandContext any, s any, s1 any) *MockPoller_PollAsyncOperation_Call { return &MockPoller_PollAsyncOperation_Call{Call: _e.mock.On("PollAsyncOperation", commandContext, s, s1)} } @@ -1091,10 +1109,19 @@ func NewMockAsyncOperationHandler(t interface { mock.TestingT Cleanup(func()) }) *MockAsyncOperationHandler { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock := &MockAsyncOperationHandler{} mock.Mock.Test(t) - t.Cleanup(func() { mock.AssertExpectations(t) }) + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) return mock } @@ -1136,7 +1163,7 @@ type MockAsyncOperationHandler_HandleCreateErr_Call struct { // HandleCreateErr is a helper method to define mock.On call // - err error -func (_e *MockAsyncOperationHandler_Expecter) HandleCreateErr(err interface{}) *MockAsyncOperationHandler_HandleCreateErr_Call { +func (_e *MockAsyncOperationHandler_Expecter) HandleCreateErr(err any) *MockAsyncOperationHandler_HandleCreateErr_Call { return &MockAsyncOperationHandler_HandleCreateErr_Call{Call: _e.mock.On("HandleCreateErr", err)} } @@ -1187,7 +1214,7 @@ type MockAsyncOperationHandler_HandleDeleteErr_Call struct { // HandleDeleteErr is a helper method to define mock.On call // - err error -func (_e *MockAsyncOperationHandler_Expecter) HandleDeleteErr(err interface{}) *MockAsyncOperationHandler_HandleDeleteErr_Call { +func (_e *MockAsyncOperationHandler_Expecter) HandleDeleteErr(err any) *MockAsyncOperationHandler_HandleDeleteErr_Call { return &MockAsyncOperationHandler_HandleDeleteErr_Call{Call: _e.mock.On("HandleDeleteErr", err)} } @@ -1239,7 +1266,7 @@ type MockAsyncOperationHandler_HandleOperation_Call struct { // HandleOperation is a helper method to define mock.On call // - op *operation.AsyncOperation // - id string -func (_e *MockAsyncOperationHandler_Expecter) HandleOperation(op interface{}, id interface{}) *MockAsyncOperationHandler_HandleOperation_Call { +func (_e *MockAsyncOperationHandler_Expecter) HandleOperation(op any, id any) *MockAsyncOperationHandler_HandleOperation_Call { return &MockAsyncOperationHandler_HandleOperation_Call{Call: _e.mock.On("HandleOperation", op, id)} } @@ -1295,7 +1322,7 @@ type MockAsyncOperationHandler_HandleUpdateErr_Call struct { // HandleUpdateErr is a helper method to define mock.On call // - err error -func (_e *MockAsyncOperationHandler_Expecter) HandleUpdateErr(err interface{}) *MockAsyncOperationHandler_HandleUpdateErr_Call { +func (_e *MockAsyncOperationHandler_Expecter) HandleUpdateErr(err any) *MockAsyncOperationHandler_HandleUpdateErr_Call { return &MockAsyncOperationHandler_HandleUpdateErr_Call{Call: _e.mock.On("HandleUpdateErr", err)} } @@ -1328,10 +1355,19 @@ func NewMockPrompter(t interface { mock.TestingT Cleanup(func()) }) *MockPrompter { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock := &MockPrompter{} mock.Mock.Test(t) - t.Cleanup(func() { mock.AssertExpectations(t) }) + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) return mock } @@ -1375,7 +1411,7 @@ type MockPrompter_PromptApply_Call struct { // - old proto.Message // - new proto.Message // - verbose bool -func (_e *MockPrompter_Expecter) PromptApply(old interface{}, new interface{}, verbose interface{}) *MockPrompter_PromptApply_Call { +func (_e *MockPrompter_Expecter) PromptApply(old any, new any, verbose any) *MockPrompter_PromptApply_Call { return &MockPrompter_PromptApply_Call{Call: _e.mock.On("PromptApply", old, new, verbose)} } diff --git a/temporalcloudcli/prompter/mock/mock.go b/temporalcloudcli/prompter/mock/mock.go index 1a4a013..a2c140e 100644 --- a/temporalcloudcli/prompter/mock/mock.go +++ b/temporalcloudcli/prompter/mock/mock.go @@ -15,10 +15,19 @@ func NewMockPrompter(t interface { mock.TestingT Cleanup(func()) }) *MockPrompter { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock := &MockPrompter{} mock.Mock.Test(t) - t.Cleanup(func() { mock.AssertExpectations(t) }) + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) return mock } @@ -71,7 +80,7 @@ type MockPrompter_PromptApply_Call struct { // - existing proto.Message // - modified proto.Message // - verbose bool -func (_e *MockPrompter_Expecter) PromptApply(existing interface{}, modified interface{}, verbose interface{}) *MockPrompter_PromptApply_Call { +func (_e *MockPrompter_Expecter) PromptApply(existing any, modified any, verbose any) *MockPrompter_PromptApply_Call { return &MockPrompter_PromptApply_Call{Call: _e.mock.On("PromptApply", existing, modified, verbose)} } @@ -141,7 +150,7 @@ type MockPrompter_PromptYes_Call struct { // PromptYes is a helper method to define mock.On call // - message string -func (_e *MockPrompter_Expecter) PromptYes(message interface{}) *MockPrompter_PromptYes_Call { +func (_e *MockPrompter_Expecter) PromptYes(message any) *MockPrompter_PromptYes_Call { return &MockPrompter_PromptYes_Call{Call: _e.mock.On("PromptYes", message)} }