From e6ed3b7004479e2139daac4309040daa26b3a561 Mon Sep 17 00:00:00 2001 From: "narcis.gemene" <narcis.gemene@huawei-partners.com> Date: Wed, 4 Sep 2024 10:27:27 +0300 Subject: [PATCH] rename region_name to region_id and simplify CesClient interface --- receiver/huaweicloudcesreceiver/README.md | 8 +- receiver/huaweicloudcesreceiver/config.go | 10 +- .../huaweicloudcesreceiver/config_test.go | 58 +- .../generated_package_test.go | 3 +- receiver/huaweicloudcesreceiver/go.mod | 42 +- receiver/huaweicloudcesreceiver/go.sum | 42 + .../integration_test.go | 2 +- .../internal/ces_client.go | 49 - .../internal/ces_to_otlp.go | 4 +- .../internal/ces_to_otlp_test.go | 2 +- .../internal/mocks/ces_client.go | 1207 +---------------- receiver/huaweicloudcesreceiver/receiver.go | 4 +- 12 files changed, 116 insertions(+), 1315 deletions(-) diff --git a/receiver/huaweicloudcesreceiver/README.md b/receiver/huaweicloudcesreceiver/README.md index b645bc7e912a..81439790557f 100644 --- a/receiver/huaweicloudcesreceiver/README.md +++ b/receiver/huaweicloudcesreceiver/README.md @@ -17,7 +17,7 @@ This receiver contains the implementation of the Huawei Cloud [Cloud Eye Service The following settings are required: -- `region_name`: The name of the Huawei Cloud region from which metrics are collected. For example, `eu-west-101`. The full list of the available regions can be found [here](https://pkg.go.dev/github.com/huaweicloud/huaweicloud-sdk-go-v3@v0.1.104/services/ces/v1/region). +- `region_id`: The ID of the Huawei Cloud region from which metrics are collected. For example, `eu-west-101`. The full list of the available regions can be found [here](https://pkg.go.dev/github.com/huaweicloud/huaweicloud-sdk-go-v3@v0.1.104/services/ces/v1/region). - `project_id`: The ID of the project in Huawei Cloud. This is used to identify which project's metrics are to be collected. See [Obtaining a Project ID](https://support.huaweicloud.com/intl/en-us/devg-apisign/api-sign-provide-proid.html). @@ -63,7 +63,7 @@ receivers: huaweicloudcesreceiver: collection_interval: 3h initial_delay: 5s - region_name: eu-west-101 + region_id: eu-west-101 access_key: ${env:HUAWEICLOUD_SDK_AK} secret_key: ${env:HUAWEICLOUD_SDK_SK} project_id: "project_1" @@ -112,7 +112,7 @@ If you encounter any CES errors, please refer to the [Huawei Cloud Error Codes]( | **dimensions.name** | key of `metrics.metadata` | The dimension name stored as metadata key. | | **dimensions.value** | value of `metrics.metadata` | The dimension value stored as metadata value. | | **Receiver Config** | `resource.attributes.project.id` | The project id used in the configuration file of the receiver. | -| **Receiver Config** | `resource.attributes.region` | The region name used in the configuration file of the receiver. | +| **Receiver Config** | `resource.attributes.region.id` | The region id used in the configuration file of the receiver. | | *N/A* | `resource.attributes.cloud.provider` | Set to `"huawei_cloud"` as the cloud provider. | | *N/A* | `resource.attributes.service.name` | Set to `"ces_service"` to indicate the service name. | | *N/A* | `resource.attributes.service.version` | Set to `"v1"` as the service version. | @@ -171,7 +171,7 @@ converts to "attributes": { "cloud.provider": "huawei_cloud", "project.id": "project_1", - "region": "eu-west-101" + "region.id": "eu-west-101" } }, "scopeMetrics": [ diff --git a/receiver/huaweicloudcesreceiver/config.go b/receiver/huaweicloudcesreceiver/config.go index 6ebe667d41f9..076ec7a9c024 100644 --- a/receiver/huaweicloudcesreceiver/config.go +++ b/receiver/huaweicloudcesreceiver/config.go @@ -19,7 +19,7 @@ import ( var ( // Predefined error responses for configuration validation failures - errMissingRegionName = errors.New(`"region_name" is not specified in config`) + errMissingRegionID = errors.New(`"region_id" is not specified in config`) errMissingProjectID = errors.New(`"project_id" is not specified in config`) errInvalidCollectionInterval = errors.New(`invalid period; must be less than "collection_interval"`) errInvalidProxy = errors.New(`"proxy_address" must be specified if "proxy_user" or "proxy_password" is set"`) @@ -47,8 +47,8 @@ type Config struct { // If ProjectID is not filled in, the SDK will automatically call the IAM service to query the project id corresponding to the region. ProjectID string `mapstructure:"project_id"` - // RegionName is the full name of the CES region exporter should send metrics to - RegionName string `mapstructure:"region_name"` + // RegionID is the ID of the CES region. + RegionID string `mapstructure:"region_id"` // How retrieved data from Cloud Eye is aggregated. // Possible values are 1, 300, 1200, 3600, 14400, and 86400. @@ -96,8 +96,8 @@ var validFilters = map[string]model.ShowMetricDataRequestFilter{ // Validate config func (config *Config) Validate() error { var err error - if config.RegionName == "" { - err = multierr.Append(err, errMissingRegionName) + if config.RegionID == "" { + err = multierr.Append(err, errMissingRegionID) } if config.ProjectID == "" { diff --git a/receiver/huaweicloudcesreceiver/config_test.go b/receiver/huaweicloudcesreceiver/config_test.go index 9dc2b08debae..7edf5ed2a7c2 100644 --- a/receiver/huaweicloudcesreceiver/config_test.go +++ b/receiver/huaweicloudcesreceiver/config_test.go @@ -11,7 +11,7 @@ import ( "go.opentelemetry.io/collector/receiver/scraperhelper" ) -func TestConfig_Validate(t *testing.T) { +func TestConfigValidate(t *testing.T) { tests := []struct { name string config Config @@ -23,10 +23,10 @@ func TestConfig_Validate(t *testing.T) { ControllerConfig: scraperhelper.ControllerConfig{ CollectionInterval: time.Hour, }, - RegionName: "cn-north-1", - ProjectID: "my_project", - Period: 300, - Filter: "min", + RegionID: "cn-north-1", + ProjectID: "my_project", + Period: 300, + Filter: "min", }, expectedError: "", }, @@ -36,20 +36,20 @@ func TestConfig_Validate(t *testing.T) { ControllerConfig: scraperhelper.ControllerConfig{ CollectionInterval: time.Hour, }, - RegionName: "cn-north-1", - ProjectID: "my_project", - Period: 100, - Filter: "min", + RegionID: "cn-north-1", + ProjectID: "my_project", + Period: 100, + Filter: "min", }, expectedError: "invalid period", }, { name: "Invalid Filter", config: Config{ - RegionName: "cn-north-1", - ProjectID: "my_project", - Period: 300, - Filter: "invalid", + RegionID: "cn-north-1", + ProjectID: "my_project", + Period: 300, + Filter: "invalid", }, expectedError: "invalid filter", }, @@ -63,7 +63,7 @@ func TestConfig_Validate(t *testing.T) { Period: 300, Filter: "min", }, - expectedError: errMissingRegionName.Error(), + expectedError: errMissingRegionID.Error(), }, { name: "Missing project id", @@ -71,9 +71,9 @@ func TestConfig_Validate(t *testing.T) { ControllerConfig: scraperhelper.ControllerConfig{ CollectionInterval: time.Hour, }, - RegionName: "cn-north-1", - Period: 300, - Filter: "min", + RegionID: "cn-north-1", + Period: 300, + Filter: "min", }, expectedError: errMissingProjectID.Error(), }, @@ -86,10 +86,10 @@ func TestConfig_Validate(t *testing.T) { ControllerConfig: scraperhelper.ControllerConfig{ CollectionInterval: time.Hour, }, - RegionName: "cn-north-1", - ProjectID: "my_project", - Period: 300, - Filter: "min", + RegionID: "cn-north-1", + ProjectID: "my_project", + Period: 300, + Filter: "min", }, expectedError: errInvalidProxy.Error(), }, @@ -102,10 +102,10 @@ func TestConfig_Validate(t *testing.T) { ControllerConfig: scraperhelper.ControllerConfig{ CollectionInterval: time.Hour, }, - RegionName: "cn-north-1", - ProjectID: "my_project", - Period: 300, - Filter: "min", + RegionID: "cn-north-1", + ProjectID: "my_project", + Period: 300, + Filter: "min", }, expectedError: errInvalidProxy.Error(), }, @@ -120,10 +120,10 @@ func TestConfig_Validate(t *testing.T) { ControllerConfig: scraperhelper.ControllerConfig{ CollectionInterval: time.Hour, }, - RegionName: "cn-north-1", - ProjectID: "my_project", - Period: 300, - Filter: "min", + RegionID: "cn-north-1", + ProjectID: "my_project", + Period: 300, + Filter: "min", }, expectedError: "", }, diff --git a/receiver/huaweicloudcesreceiver/generated_package_test.go b/receiver/huaweicloudcesreceiver/generated_package_test.go index e3abd7c8e13f..ebacfa323d23 100644 --- a/receiver/huaweicloudcesreceiver/generated_package_test.go +++ b/receiver/huaweicloudcesreceiver/generated_package_test.go @@ -3,9 +3,8 @@ package huaweicloudcesreceiver import ( - "testing" - "go.uber.org/goleak" + "testing" ) func TestMain(m *testing.M) { diff --git a/receiver/huaweicloudcesreceiver/go.mod b/receiver/huaweicloudcesreceiver/go.mod index 6869eb67900c..bfac07e02e37 100644 --- a/receiver/huaweicloudcesreceiver/go.mod +++ b/receiver/huaweicloudcesreceiver/go.mod @@ -10,15 +10,15 @@ require ( github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.108.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.107.0 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.107.0 - go.opentelemetry.io/collector/config/confighttp v0.107.0 - go.opentelemetry.io/collector/config/configopaque v1.13.0 + go.opentelemetry.io/collector/component v0.108.1 + go.opentelemetry.io/collector/config/confighttp v0.108.1 + go.opentelemetry.io/collector/config/configopaque v1.14.1 go.opentelemetry.io/collector/config/configretry v1.13.0 - go.opentelemetry.io/collector/confmap v0.107.0 - go.opentelemetry.io/collector/consumer v0.107.0 - go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/confmap v1.14.1 + go.opentelemetry.io/collector/consumer v0.108.1 + go.opentelemetry.io/collector/consumer/consumertest v0.108.1 go.opentelemetry.io/collector/pdata v1.14.1 - go.opentelemetry.io/collector/receiver v0.106.1 + go.opentelemetry.io/collector/receiver v0.108.1 go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -32,7 +32,7 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.6.0 // indirect @@ -49,7 +49,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.108.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.1 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect @@ -57,19 +57,19 @@ require ( github.com/stretchr/objx v0.5.2 // indirect github.com/tjfoc/gmsm v1.4.1 // indirect go.mongodb.org/mongo-driver v1.15.0 // indirect - go.opentelemetry.io/collector v0.107.0 // indirect - go.opentelemetry.io/collector/client v1.13.0 // indirect - go.opentelemetry.io/collector/config/configauth v0.107.0 // indirect - go.opentelemetry.io/collector/config/configcompression v1.13.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect - go.opentelemetry.io/collector/config/configtls v1.13.0 // indirect - go.opentelemetry.io/collector/config/internal v0.107.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect - go.opentelemetry.io/collector/extension v0.107.0 // indirect - go.opentelemetry.io/collector/extension/auth v0.107.0 // indirect - go.opentelemetry.io/collector/featuregate v1.13.0 // indirect + go.opentelemetry.io/collector v0.108.1 // indirect + go.opentelemetry.io/collector/client v1.14.1 // indirect + go.opentelemetry.io/collector/config/configauth v0.108.1 // indirect + go.opentelemetry.io/collector/config/configcompression v1.14.1 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.108.1 // indirect + go.opentelemetry.io/collector/config/configtls v1.14.1 // indirect + go.opentelemetry.io/collector/config/internal v0.108.1 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.108.1 // indirect + go.opentelemetry.io/collector/extension v0.108.1 // indirect + go.opentelemetry.io/collector/extension/auth v0.108.1 // indirect + go.opentelemetry.io/collector/featuregate v1.14.1 // indirect go.opentelemetry.io/collector/internal/globalgates v0.107.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.108.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.50.0 // indirect diff --git a/receiver/huaweicloudcesreceiver/go.sum b/receiver/huaweicloudcesreceiver/go.sum index c9dc3a760183..833ec8ed7e93 100644 --- a/receiver/huaweicloudcesreceiver/go.sum +++ b/receiver/huaweicloudcesreceiver/go.sum @@ -26,6 +26,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -89,6 +91,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= @@ -125,50 +129,88 @@ go.mongodb.org/mongo-driver v1.15.0 h1:rJCKC8eEliewXjZGf0ddURtl7tTVy1TK3bfl0gkUS go.mongodb.org/mongo-driver v1.15.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= go.opentelemetry.io/collector v0.107.0 h1:C1Mng03iE73flGhEg795IFVlr3qhDLef5GESjIVtx5g= go.opentelemetry.io/collector v0.107.0/go.mod h1:7xDYvzBb3Ez6qFQl0IArBbmNNazIxZMVoRkbgJYRjyg= +go.opentelemetry.io/collector v0.108.1 h1:c3JZU5g5KezDXaMgL7GDFB7ihuLNzXo6eBuaJOmBiDA= +go.opentelemetry.io/collector v0.108.1/go.mod h1:7GL32WiQkZzJjxHstHme9igzYumDsw1hFPep3v1guHQ= go.opentelemetry.io/collector/client v1.13.0 h1:I0GzZPcOG+F6BY46SgsdcpCN+L0xPfjzTRN2Y4Etdrw= go.opentelemetry.io/collector/client v1.13.0/go.mod h1:GOE/UvRdklwPCqYLRUOSiU/syl1BGQWa48ex7OGOq9Y= +go.opentelemetry.io/collector/client v1.14.1 h1:UiBhFP07YbZlv3fW2D/Xi0DrEMRGw2QB1DLV2JiJEis= +go.opentelemetry.io/collector/client v1.14.1/go.mod h1:a8A6aWydaeiItFzY0zlHO/Q6mLNnZsW0Y/iVxbJsO4A= go.opentelemetry.io/collector/component v0.107.0 h1:3ReaEAtKwrPj7HrlKjEGBDKbBaxdRMPC2mfZ9b6zjXE= go.opentelemetry.io/collector/component v0.107.0/go.mod h1:1xMIYKvpnP7laipjgEw7kq1ozG7ySLkA0Evhr2Bp8M4= +go.opentelemetry.io/collector/component v0.108.1 h1:X+Afj07brX0NC36t6PvAq+ehaeUO/Q9eJNOUwhInpeY= +go.opentelemetry.io/collector/component v0.108.1/go.mod h1:qrP2TiJT5qw4sSiAKne+gb+hb1qTixLXuQRZjMCnLjY= go.opentelemetry.io/collector/config/configauth v0.107.0 h1:2rAoMJjSfdP+ao5i7Ku68QYW5p0jjZ9y6a0nj3cIFp0= go.opentelemetry.io/collector/config/configauth v0.107.0/go.mod h1:IQx5BBZRoyPX9Qr3W4Ajy/4AnyJZb6jylI4rITrZMHQ= +go.opentelemetry.io/collector/config/configauth v0.108.1 h1:If0hRGyfDbC9Y80CYcLBKeSdY7BXcs98r7gPJlzH5uU= +go.opentelemetry.io/collector/config/configauth v0.108.1/go.mod h1:8P3fOkwwP7k09xaTKmu7MrMgTZmMXtWdUrJQgjhy3a4= go.opentelemetry.io/collector/config/configcompression v1.13.0 h1:2LApl3qDZgjsVblY1Qu0gJaw9ZyYnZ6ZDUvid9rCZVg= go.opentelemetry.io/collector/config/configcompression v1.13.0/go.mod h1:6+m0GKCv7JKzaumn7u80A2dLNCuYf5wdR87HWreoBO0= +go.opentelemetry.io/collector/config/configcompression v1.14.1 h1:YiNlBSeyDaFWrDPFpMJ7y7XlWYMDV0bh8GwO9ukXNa8= +go.opentelemetry.io/collector/config/configcompression v1.14.1/go.mod h1:pnxkFCLUZLKWzYJvfSwZnPrnm0twX14CYj2ADth5xiU= go.opentelemetry.io/collector/config/confighttp v0.107.0 h1:HnfFg/n3xu+XH7onWrFZl8jBrVVUCe+updh3ANUB3w8= go.opentelemetry.io/collector/config/confighttp v0.107.0/go.mod h1:/slm41hcfOwAxv8ZcGCKHC22jnQZ71z42OSWChKuIgU= +go.opentelemetry.io/collector/config/confighttp v0.108.1 h1:+KRFQfm0W2NHEtNMa1UuXvXvBX6B/2CTBvJk6Zi3Jhk= +go.opentelemetry.io/collector/config/confighttp v0.108.1/go.mod h1:iqdC0Gljy2U7HDX3a7pZlAH2EI3TNhFWyoVwc9R16XE= go.opentelemetry.io/collector/config/configopaque v1.13.0 h1:EDB9JIifmBth1z9IsEduoE1bT1Q8jV0sR005EMW7q1w= go.opentelemetry.io/collector/config/configopaque v1.13.0/go.mod h1:0xURn2sOy5j4fbaocpEYfM97HPGsiffkkVudSPyTJlM= +go.opentelemetry.io/collector/config/configopaque v1.14.1 h1:5xAEa4ld+57xWKdU2gR5/6+rBa7LTCPfShJQFUxN0Zw= +go.opentelemetry.io/collector/config/configopaque v1.14.1/go.mod h1:6zlLIyOoRpJJ+0bEKrlZOZon3rOp5Jrz9fMdR4twOS4= go.opentelemetry.io/collector/config/configretry v1.13.0 h1:gcjWB6FOG1u1e5ecs3nOtOysXWtxJxeL+cNiFLI+nCo= go.opentelemetry.io/collector/config/configretry v1.13.0/go.mod h1:P+RA0IA+QoxnDn4072uyeAk1RIoYiCbxYsjpKX5eFC4= go.opentelemetry.io/collector/config/configtelemetry v0.107.0 h1:pSGd4FWQ/Up/Af+XZTR8JNneH/wmQ/TAU4Z16JHQeUc= go.opentelemetry.io/collector/config/configtelemetry v0.107.0/go.mod h1:WxWKNVAQJg/Io1nA3xLgn/DWLE/W1QOB2+/Js3ACi40= +go.opentelemetry.io/collector/config/configtelemetry v0.108.1 h1:jjdH1R6FMz4l1nSvY7F3H0F09xW9LKTke7k3ZAPcmSU= +go.opentelemetry.io/collector/config/configtelemetry v0.108.1/go.mod h1:R0MBUxjSMVMIhljuDHWIygzzJWQyZHXXWIgQNxcFwhc= go.opentelemetry.io/collector/config/configtls v1.13.0 h1:N57vOibMIPX9YZq4ZLFjj5ZjUHMYW7bpkPkygU3vt8w= go.opentelemetry.io/collector/config/configtls v1.13.0/go.mod h1:3CBJYFQYTCYIPJMRvzn3NVtasv8out21ZNXkSCPepuY= +go.opentelemetry.io/collector/config/configtls v1.14.1 h1:cd5kNvLnIe+GVHUV6Fk6O5fkwS4at8dVCrFo7t0O8kE= +go.opentelemetry.io/collector/config/configtls v1.14.1/go.mod h1:StxglrVWeRIFaqc2hpsF9xSsv2A5MOAx5GhG4WjFuP4= go.opentelemetry.io/collector/config/internal v0.107.0 h1:aENT1bVin8HCHZuKXc8U1sTYalzl6+RpOMDWpt+VoCQ= go.opentelemetry.io/collector/config/internal v0.107.0/go.mod h1:2LQPVQPDeIyXN6AXazlls1M0zmlhIM7q80V4K7mQ6PM= +go.opentelemetry.io/collector/config/internal v0.108.1 h1:Z/U8+UpvGT2DZ64/kp/nlosJgjCkhZ7MaEqQ3QHudyo= +go.opentelemetry.io/collector/config/internal v0.108.1/go.mod h1:tRaaE2CNdXE3lUQcIBGJkdBPSGYY3Taa6DzkWmxmgzk= go.opentelemetry.io/collector/confmap v0.107.0 h1:M2o7jvQM9bnMU3pE2N6BK4KHYtSnvsSZkegUD89y8BU= go.opentelemetry.io/collector/confmap v0.107.0/go.mod h1:9Fs/ZEIeiMa38VqkqIpn+JKQkcPf/lhAKA9fHu6c9GY= +go.opentelemetry.io/collector/confmap v1.14.1 h1:GPMa+q5ThiBFQaYKJ7xeomiw9tIokkTA1AiF1zwKJck= +go.opentelemetry.io/collector/confmap v1.14.1/go.mod h1:GrIZ12P/9DPOuTpe2PIS51a0P/ZM6iKtByVee1Uf3+k= go.opentelemetry.io/collector/consumer v0.107.0 h1:fF/+xyv9BfXQUvuJqkljrpzKyBQExDQt6zB5rzGyuHs= go.opentelemetry.io/collector/consumer v0.107.0/go.mod h1:wgWpFes9sbnZ11XeJPSeutU8GJx6dT/gzSUqHpaZZQA= +go.opentelemetry.io/collector/consumer v0.108.1 h1:75zHUpIDfgZMp3t9fYdpXXE6/wsBs9DwTZdfwS3+NDI= +go.opentelemetry.io/collector/consumer v0.108.1/go.mod h1:xu2pOTqK+uCFXZWd9RcU8s6sCRwK5GyuP64YuHLMzzA= go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 h1:SEP5rLm4KgBaELciRQO4m9U2q3xn16KGjpIw8zQn6Ik= go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0/go.mod h1:Vi/aqlZjCBdGgGu+iOEfUyHvq2TJBar0WfsQSOMhR6Y= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.108.1 h1:inFvEN7nB9ECFUjJzv+TsylCM8r1ocqOUrnNVdkMkZo= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.108.1/go.mod h1:F6Shxg3TqoDZe2+p2PkVRUsnJMqATQxbs4c1nfaJrAc= go.opentelemetry.io/collector/consumer/consumertest v0.107.0 h1:BfjFHHAqbTmCN32akYvMhWKYC+ayHTX935/fRChwohM= go.opentelemetry.io/collector/consumer/consumertest v0.107.0/go.mod h1:qNMedscdVyuxbV+wWUt4yGKQM3c0YEgQJTFeAtGZjRY= +go.opentelemetry.io/collector/consumer/consumertest v0.108.1 h1:WLvi27Vu5nkltjhmdN+pDO9EuRphYpOQxoqZ9A3RkKU= +go.opentelemetry.io/collector/consumer/consumertest v0.108.1/go.mod h1:tRqOtUukG76iBlPTAUwFSU87dDO+x33Gyn2x9mecfko= go.opentelemetry.io/collector/extension v0.107.0 h1:wstZXb24RwdcchZu3juTH9M0xryKG4sYmb1/w6J3tqQ= go.opentelemetry.io/collector/extension v0.107.0/go.mod h1:w/+HXzRO7jPutUIMyBlzX6deUPl205QCEwteB0YgWOg= +go.opentelemetry.io/collector/extension v0.108.1 h1:XNQ9bOegD38gktyLJXlGN2Wb6AbiBi2nAuiOIdg+zA0= +go.opentelemetry.io/collector/extension v0.108.1/go.mod h1:fZE5j4jL9XVbm4H53gj9y/VDhP/5assmZ4yU0EwSjBc= go.opentelemetry.io/collector/extension/auth v0.107.0 h1:xv+MI9ce8RG1UP4XihTaPR3pCKVvKOl2iIyFqYa0bvE= go.opentelemetry.io/collector/extension/auth v0.107.0/go.mod h1:tFMzaKaUAx3eWpp3lOLZ8OcLbryydyof9+GCvCWmKmU= +go.opentelemetry.io/collector/extension/auth v0.108.1 h1:h1kuC5Lvzxb3LcShUXdVHjh+PpqX/Kpd2ypNObwxH0s= +go.opentelemetry.io/collector/extension/auth v0.108.1/go.mod h1:QLvy/dJdiPEhUbkhqIythMoVnZxmvbzeA2Wnm4oZSgU= go.opentelemetry.io/collector/featuregate v1.13.0 h1:rc84eCf5hesXQ8/bP6Zc15wqthbomfLBHmox5tT7AwM= go.opentelemetry.io/collector/featuregate v1.13.0/go.mod h1:PsOINaGgTiFc+Tzu2K/X2jP+Ngmlp7YKGV1XrnBkH7U= +go.opentelemetry.io/collector/featuregate v1.14.1 h1:5jvlRe1b5FqhGsyYtuwrzNhFLthGCfm98b3PsCRgXDA= +go.opentelemetry.io/collector/featuregate v1.14.1/go.mod h1:47xrISO71vJ83LSMm8+yIDsUbKktUp48Ovt7RR6VbRs= go.opentelemetry.io/collector/internal/globalgates v0.107.0 h1:PaD6WgQg80YTVxg8OF+YEqgI7WRd13wMu/R6GIG7uNU= go.opentelemetry.io/collector/internal/globalgates v0.107.0/go.mod h1:hca7Tpzu6JmBrAOgmlyp/ZM6kxprPRMKqSYoq/Tdzjw= go.opentelemetry.io/collector/pdata v1.14.1 h1:wXZjtQA7Vy5HFqco+yA95ENyMQU5heBB1IxMHQf6mUk= go.opentelemetry.io/collector/pdata v1.14.1/go.mod h1:z1dTjwwtcoXxZx2/nkHysjxMeaxe9pEmYTEr4SMNIx8= go.opentelemetry.io/collector/pdata/pprofile v0.107.0 h1:F25VZrEkSaneIBNcNI9LEBWf9nRC/WHKluSBTP0gKAA= go.opentelemetry.io/collector/pdata/pprofile v0.107.0/go.mod h1:1GrwsKtgogRCt8aG/0lfJ037yDdFtYqF+OtJr+snxRQ= +go.opentelemetry.io/collector/pdata/pprofile v0.108.1 h1:/XbunfZ+/jt1+d1p4zM4vZ/AgeaIJsayjYdlN1fV+tk= +go.opentelemetry.io/collector/pdata/pprofile v0.108.1/go.mod h1:/GvG2WcN9Dajlw4QaIOjgz7N32wSfPL3qxJ0BKOcVPo= go.opentelemetry.io/collector/pdata/testdata v0.107.0 h1:02CqvJrYjkrBlWDD+6yrByN1AhG2zT61OScLPhyyMwU= go.opentelemetry.io/collector/pdata/testdata v0.107.0/go.mod h1:bqaeiDH1Lc5DFJXvjVHwO50x00TXj+oFre+EbOVeZXs= go.opentelemetry.io/collector/receiver v0.106.1 h1:9kDLDJmInnz+AzAV9oV/UGMoc1+oI1pwMMs7+uMiJq4= go.opentelemetry.io/collector/receiver v0.106.1/go.mod h1:3j9asWz7mqsgE77rPaNhlNQhRwgFhRynf0UEPs/4rkM= +go.opentelemetry.io/collector/receiver v0.108.1 h1:YQgDv69v3fgd6uoiGZ+vUdUPdNzoodbLzjB7XfdQvxs= +go.opentelemetry.io/collector/receiver v0.108.1/go.mod h1:eKe/VJgdvHr8JsBDma/PF3DlaheTRC2X6AmCUByJCNU= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= diff --git a/receiver/huaweicloudcesreceiver/integration_test.go b/receiver/huaweicloudcesreceiver/integration_test.go index 23420930ca47..4e771783a6b3 100644 --- a/receiver/huaweicloudcesreceiver/integration_test.go +++ b/receiver/huaweicloudcesreceiver/integration_test.go @@ -58,7 +58,7 @@ func TestHuaweiCloudCESReceiverIntegration(t *testing.T) { sink := &consumertest.MetricsSink{} cfg := createDefaultConfig().(*Config) - cfg.RegionName = "us-east-2" + cfg.RegionID = "us-east-2" cfg.CollectionInterval = time.Second cfg.ProjectID = "my-project" cfg.Filter = "average" diff --git a/receiver/huaweicloudcesreceiver/internal/ces_client.go b/receiver/huaweicloudcesreceiver/internal/ces_client.go index dc44ff830ffc..e6f1c4f6fe90 100644 --- a/receiver/huaweicloudcesreceiver/internal/ces_client.go +++ b/receiver/huaweicloudcesreceiver/internal/ces_client.go @@ -4,7 +4,6 @@ package internal // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/huaweicloudcesreceiver/internal" import ( - ces "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ces/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ces/v1/model" ) @@ -13,54 +12,6 @@ import ( // //go:generate mockery --name CesClient --case=underscore --output=./mocks type CesClient interface { - BatchListMetricData(request *model.BatchListMetricDataRequest) (*model.BatchListMetricDataResponse, error) - BatchListMetricDataInvoker(request *model.BatchListMetricDataRequest) *ces.BatchListMetricDataInvoker - CreateAlarm(request *model.CreateAlarmRequest) (*model.CreateAlarmResponse, error) - CreateAlarmInvoker(request *model.CreateAlarmRequest) *ces.CreateAlarmInvoker - CreateAlarmTemplate(request *model.CreateAlarmTemplateRequest) (*model.CreateAlarmTemplateResponse, error) - CreateAlarmTemplateInvoker(request *model.CreateAlarmTemplateRequest) *ces.CreateAlarmTemplateInvoker - CreateEvents(request *model.CreateEventsRequest) (*model.CreateEventsResponse, error) - CreateEventsInvoker(request *model.CreateEventsRequest) *ces.CreateEventsInvoker - CreateMetricData(request *model.CreateMetricDataRequest) (*model.CreateMetricDataResponse, error) - CreateMetricDataInvoker(request *model.CreateMetricDataRequest) *ces.CreateMetricDataInvoker - CreateResourceGroup(request *model.CreateResourceGroupRequest) (*model.CreateResourceGroupResponse, error) - CreateResourceGroupInvoker(request *model.CreateResourceGroupRequest) *ces.CreateResourceGroupInvoker - DeleteAlarm(request *model.DeleteAlarmRequest) (*model.DeleteAlarmResponse, error) - DeleteAlarmInvoker(request *model.DeleteAlarmRequest) *ces.DeleteAlarmInvoker - DeleteAlarmTemplate(request *model.DeleteAlarmTemplateRequest) (*model.DeleteAlarmTemplateResponse, error) - DeleteAlarmTemplateInvoker(request *model.DeleteAlarmTemplateRequest) *ces.DeleteAlarmTemplateInvoker - DeleteResourceGroup(request *model.DeleteResourceGroupRequest) (*model.DeleteResourceGroupResponse, error) - DeleteResourceGroupInvoker(request *model.DeleteResourceGroupRequest) *ces.DeleteResourceGroupInvoker - ListAlarmHistories(request *model.ListAlarmHistoriesRequest) (*model.ListAlarmHistoriesResponse, error) - ListAlarmHistoriesInvoker(request *model.ListAlarmHistoriesRequest) *ces.ListAlarmHistoriesInvoker - ListAlarmTemplates(request *model.ListAlarmTemplatesRequest) (*model.ListAlarmTemplatesResponse, error) - ListAlarmTemplatesInvoker(request *model.ListAlarmTemplatesRequest) *ces.ListAlarmTemplatesInvoker - ListAlarms(request *model.ListAlarmsRequest) (*model.ListAlarmsResponse, error) - ListAlarmsInvoker(request *model.ListAlarmsRequest) *ces.ListAlarmsInvoker - ListEventDetail(request *model.ListEventDetailRequest) (*model.ListEventDetailResponse, error) - ListEventDetailInvoker(request *model.ListEventDetailRequest) *ces.ListEventDetailInvoker - ListEvents(request *model.ListEventsRequest) (*model.ListEventsResponse, error) - ListEventsInvoker(request *model.ListEventsRequest) *ces.ListEventsInvoker ListMetrics(request *model.ListMetricsRequest) (*model.ListMetricsResponse, error) - ListMetricsInvoker(request *model.ListMetricsRequest) *ces.ListMetricsInvoker - ListResourceGroup(request *model.ListResourceGroupRequest) (*model.ListResourceGroupResponse, error) - ListResourceGroupInvoker(request *model.ListResourceGroupRequest) *ces.ListResourceGroupInvoker - ShowAlarm(request *model.ShowAlarmRequest) (*model.ShowAlarmResponse, error) - ShowAlarmInvoker(request *model.ShowAlarmRequest) *ces.ShowAlarmInvoker - ShowEventData(request *model.ShowEventDataRequest) (*model.ShowEventDataResponse, error) - ShowEventDataInvoker(request *model.ShowEventDataRequest) *ces.ShowEventDataInvoker ShowMetricData(request *model.ShowMetricDataRequest) (*model.ShowMetricDataResponse, error) - ShowMetricDataInvoker(request *model.ShowMetricDataRequest) *ces.ShowMetricDataInvoker - ShowQuotas(request *model.ShowQuotasRequest) (*model.ShowQuotasResponse, error) - ShowQuotasInvoker(request *model.ShowQuotasRequest) *ces.ShowQuotasInvoker - ShowResourceGroup(request *model.ShowResourceGroupRequest) (*model.ShowResourceGroupResponse, error) - ShowResourceGroupInvoker(request *model.ShowResourceGroupRequest) *ces.ShowResourceGroupInvoker - UpdateAlarm(request *model.UpdateAlarmRequest) (*model.UpdateAlarmResponse, error) - UpdateAlarmAction(request *model.UpdateAlarmActionRequest) (*model.UpdateAlarmActionResponse, error) - UpdateAlarmActionInvoker(request *model.UpdateAlarmActionRequest) *ces.UpdateAlarmActionInvoker - UpdateAlarmInvoker(request *model.UpdateAlarmRequest) *ces.UpdateAlarmInvoker - UpdateAlarmTemplate(request *model.UpdateAlarmTemplateRequest) (*model.UpdateAlarmTemplateResponse, error) - UpdateAlarmTemplateInvoker(request *model.UpdateAlarmTemplateRequest) *ces.UpdateAlarmTemplateInvoker - UpdateResourceGroup(request *model.UpdateResourceGroupRequest) (*model.UpdateResourceGroupResponse, error) - UpdateResourceGroupInvoker(request *model.UpdateResourceGroupRequest) *ces.UpdateResourceGroupInvoker } diff --git a/receiver/huaweicloudcesreceiver/internal/ces_to_otlp.go b/receiver/huaweicloudcesreceiver/internal/ces_to_otlp.go index fc10a42ffadd..5c91f5b247a5 100644 --- a/receiver/huaweicloudcesreceiver/internal/ces_to_otlp.go +++ b/receiver/huaweicloudcesreceiver/internal/ces_to_otlp.go @@ -37,7 +37,7 @@ func GetDimension(dimensions []model.MetricsDimension, index int) *string { return nil } -func ConvertCESMetricsToOTLP(projectID, region, filter string, cesMetrics map[string]MetricData) pmetric.Metrics { +func ConvertCESMetricsToOTLP(projectID, regionID, filter string, cesMetrics map[string]MetricData) pmetric.Metrics { metrics := pmetric.NewMetrics() if len(cesMetrics) == 0 { return metrics @@ -47,7 +47,7 @@ func ConvertCESMetricsToOTLP(projectID, region, filter string, cesMetrics map[st resource := resourceMetric.Resource() resource.Attributes().PutStr("cloud.provider", "huawei_cloud") resource.Attributes().PutStr("project.id", projectID) - resource.Attributes().PutStr("region", region) + resource.Attributes().PutStr("region.id", regionID) for _, cesMetric := range cesMetrics { scopedMetric := resourceMetric.ScopeMetrics().AppendEmpty() diff --git a/receiver/huaweicloudcesreceiver/internal/ces_to_otlp_test.go b/receiver/huaweicloudcesreceiver/internal/ces_to_otlp_test.go index fe464d21c0f2..50b02a9aeb28 100644 --- a/receiver/huaweicloudcesreceiver/internal/ces_to_otlp_test.go +++ b/receiver/huaweicloudcesreceiver/internal/ces_to_otlp_test.go @@ -92,7 +92,7 @@ func expectedMetrics() pmetric.Metrics { resource := resourceMetric.Resource() resource.Attributes().PutStr("cloud.provider", "huawei_cloud") resource.Attributes().PutStr("project.id", "project_1") - resource.Attributes().PutStr("region", "eu-west-101") + resource.Attributes().PutStr("region.id", "eu-west-101") scopedMetric := resourceMetric.ScopeMetrics().AppendEmpty() scopedMetric.Scope().SetName("huawei_cloud_ces") diff --git a/receiver/huaweicloudcesreceiver/internal/mocks/ces_client.go b/receiver/huaweicloudcesreceiver/internal/mocks/ces_client.go index d242db9c9b57..fbd4b6132044 100644 --- a/receiver/huaweicloudcesreceiver/internal/mocks/ces_client.go +++ b/receiver/huaweicloudcesreceiver/internal/mocks/ces_client.go @@ -3,7 +3,6 @@ package mocks import ( - v1 "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ces/v1" model "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ces/v1/model" mock "github.com/stretchr/testify/mock" ) @@ -13,878 +12,28 @@ type CesClient struct { mock.Mock } -// BatchListMetricData provides a mock function with given fields: request -func (_m *CesClient) BatchListMetricData(request *model.BatchListMetricDataRequest) (*model.BatchListMetricDataResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for BatchListMetricData") - } - - var r0 *model.BatchListMetricDataResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.BatchListMetricDataRequest) (*model.BatchListMetricDataResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.BatchListMetricDataRequest) *model.BatchListMetricDataResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.BatchListMetricDataResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.BatchListMetricDataRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// BatchListMetricDataInvoker provides a mock function with given fields: request -func (_m *CesClient) BatchListMetricDataInvoker(request *model.BatchListMetricDataRequest) *v1.BatchListMetricDataInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for BatchListMetricDataInvoker") - } - - var r0 *v1.BatchListMetricDataInvoker - if rf, ok := ret.Get(0).(func(*model.BatchListMetricDataRequest) *v1.BatchListMetricDataInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.BatchListMetricDataInvoker) - } - } - - return r0 -} - -// CreateAlarm provides a mock function with given fields: request -func (_m *CesClient) CreateAlarm(request *model.CreateAlarmRequest) (*model.CreateAlarmResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for CreateAlarm") - } - - var r0 *model.CreateAlarmResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.CreateAlarmRequest) (*model.CreateAlarmResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.CreateAlarmRequest) *model.CreateAlarmResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.CreateAlarmResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.CreateAlarmRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateAlarmInvoker provides a mock function with given fields: request -func (_m *CesClient) CreateAlarmInvoker(request *model.CreateAlarmRequest) *v1.CreateAlarmInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for CreateAlarmInvoker") - } - - var r0 *v1.CreateAlarmInvoker - if rf, ok := ret.Get(0).(func(*model.CreateAlarmRequest) *v1.CreateAlarmInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.CreateAlarmInvoker) - } - } - - return r0 -} - -// CreateAlarmTemplate provides a mock function with given fields: request -func (_m *CesClient) CreateAlarmTemplate(request *model.CreateAlarmTemplateRequest) (*model.CreateAlarmTemplateResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for CreateAlarmTemplate") - } - - var r0 *model.CreateAlarmTemplateResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.CreateAlarmTemplateRequest) (*model.CreateAlarmTemplateResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.CreateAlarmTemplateRequest) *model.CreateAlarmTemplateResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.CreateAlarmTemplateResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.CreateAlarmTemplateRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateAlarmTemplateInvoker provides a mock function with given fields: request -func (_m *CesClient) CreateAlarmTemplateInvoker(request *model.CreateAlarmTemplateRequest) *v1.CreateAlarmTemplateInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for CreateAlarmTemplateInvoker") - } - - var r0 *v1.CreateAlarmTemplateInvoker - if rf, ok := ret.Get(0).(func(*model.CreateAlarmTemplateRequest) *v1.CreateAlarmTemplateInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.CreateAlarmTemplateInvoker) - } - } - - return r0 -} - -// CreateEvents provides a mock function with given fields: request -func (_m *CesClient) CreateEvents(request *model.CreateEventsRequest) (*model.CreateEventsResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for CreateEvents") - } - - var r0 *model.CreateEventsResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.CreateEventsRequest) (*model.CreateEventsResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.CreateEventsRequest) *model.CreateEventsResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.CreateEventsResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.CreateEventsRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateEventsInvoker provides a mock function with given fields: request -func (_m *CesClient) CreateEventsInvoker(request *model.CreateEventsRequest) *v1.CreateEventsInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for CreateEventsInvoker") - } - - var r0 *v1.CreateEventsInvoker - if rf, ok := ret.Get(0).(func(*model.CreateEventsRequest) *v1.CreateEventsInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.CreateEventsInvoker) - } - } - - return r0 -} - -// CreateMetricData provides a mock function with given fields: request -func (_m *CesClient) CreateMetricData(request *model.CreateMetricDataRequest) (*model.CreateMetricDataResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for CreateMetricData") - } - - var r0 *model.CreateMetricDataResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.CreateMetricDataRequest) (*model.CreateMetricDataResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.CreateMetricDataRequest) *model.CreateMetricDataResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.CreateMetricDataResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.CreateMetricDataRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateMetricDataInvoker provides a mock function with given fields: request -func (_m *CesClient) CreateMetricDataInvoker(request *model.CreateMetricDataRequest) *v1.CreateMetricDataInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for CreateMetricDataInvoker") - } - - var r0 *v1.CreateMetricDataInvoker - if rf, ok := ret.Get(0).(func(*model.CreateMetricDataRequest) *v1.CreateMetricDataInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.CreateMetricDataInvoker) - } - } - - return r0 -} - -// CreateResourceGroup provides a mock function with given fields: request -func (_m *CesClient) CreateResourceGroup(request *model.CreateResourceGroupRequest) (*model.CreateResourceGroupResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for CreateResourceGroup") - } - - var r0 *model.CreateResourceGroupResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.CreateResourceGroupRequest) (*model.CreateResourceGroupResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.CreateResourceGroupRequest) *model.CreateResourceGroupResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.CreateResourceGroupResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.CreateResourceGroupRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateResourceGroupInvoker provides a mock function with given fields: request -func (_m *CesClient) CreateResourceGroupInvoker(request *model.CreateResourceGroupRequest) *v1.CreateResourceGroupInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for CreateResourceGroupInvoker") - } - - var r0 *v1.CreateResourceGroupInvoker - if rf, ok := ret.Get(0).(func(*model.CreateResourceGroupRequest) *v1.CreateResourceGroupInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.CreateResourceGroupInvoker) - } - } - - return r0 -} - -// DeleteAlarm provides a mock function with given fields: request -func (_m *CesClient) DeleteAlarm(request *model.DeleteAlarmRequest) (*model.DeleteAlarmResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for DeleteAlarm") - } - - var r0 *model.DeleteAlarmResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.DeleteAlarmRequest) (*model.DeleteAlarmResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.DeleteAlarmRequest) *model.DeleteAlarmResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.DeleteAlarmResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.DeleteAlarmRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteAlarmInvoker provides a mock function with given fields: request -func (_m *CesClient) DeleteAlarmInvoker(request *model.DeleteAlarmRequest) *v1.DeleteAlarmInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for DeleteAlarmInvoker") - } - - var r0 *v1.DeleteAlarmInvoker - if rf, ok := ret.Get(0).(func(*model.DeleteAlarmRequest) *v1.DeleteAlarmInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.DeleteAlarmInvoker) - } - } - - return r0 -} - -// DeleteAlarmTemplate provides a mock function with given fields: request -func (_m *CesClient) DeleteAlarmTemplate(request *model.DeleteAlarmTemplateRequest) (*model.DeleteAlarmTemplateResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for DeleteAlarmTemplate") - } - - var r0 *model.DeleteAlarmTemplateResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.DeleteAlarmTemplateRequest) (*model.DeleteAlarmTemplateResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.DeleteAlarmTemplateRequest) *model.DeleteAlarmTemplateResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.DeleteAlarmTemplateResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.DeleteAlarmTemplateRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteAlarmTemplateInvoker provides a mock function with given fields: request -func (_m *CesClient) DeleteAlarmTemplateInvoker(request *model.DeleteAlarmTemplateRequest) *v1.DeleteAlarmTemplateInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for DeleteAlarmTemplateInvoker") - } - - var r0 *v1.DeleteAlarmTemplateInvoker - if rf, ok := ret.Get(0).(func(*model.DeleteAlarmTemplateRequest) *v1.DeleteAlarmTemplateInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.DeleteAlarmTemplateInvoker) - } - } - - return r0 -} - -// DeleteResourceGroup provides a mock function with given fields: request -func (_m *CesClient) DeleteResourceGroup(request *model.DeleteResourceGroupRequest) (*model.DeleteResourceGroupResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for DeleteResourceGroup") - } - - var r0 *model.DeleteResourceGroupResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.DeleteResourceGroupRequest) (*model.DeleteResourceGroupResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.DeleteResourceGroupRequest) *model.DeleteResourceGroupResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.DeleteResourceGroupResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.DeleteResourceGroupRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteResourceGroupInvoker provides a mock function with given fields: request -func (_m *CesClient) DeleteResourceGroupInvoker(request *model.DeleteResourceGroupRequest) *v1.DeleteResourceGroupInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for DeleteResourceGroupInvoker") - } - - var r0 *v1.DeleteResourceGroupInvoker - if rf, ok := ret.Get(0).(func(*model.DeleteResourceGroupRequest) *v1.DeleteResourceGroupInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.DeleteResourceGroupInvoker) - } - } - - return r0 -} - -// ListAlarmHistories provides a mock function with given fields: request -func (_m *CesClient) ListAlarmHistories(request *model.ListAlarmHistoriesRequest) (*model.ListAlarmHistoriesResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ListAlarmHistories") - } - - var r0 *model.ListAlarmHistoriesResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.ListAlarmHistoriesRequest) (*model.ListAlarmHistoriesResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.ListAlarmHistoriesRequest) *model.ListAlarmHistoriesResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.ListAlarmHistoriesResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.ListAlarmHistoriesRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListAlarmHistoriesInvoker provides a mock function with given fields: request -func (_m *CesClient) ListAlarmHistoriesInvoker(request *model.ListAlarmHistoriesRequest) *v1.ListAlarmHistoriesInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ListAlarmHistoriesInvoker") - } - - var r0 *v1.ListAlarmHistoriesInvoker - if rf, ok := ret.Get(0).(func(*model.ListAlarmHistoriesRequest) *v1.ListAlarmHistoriesInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.ListAlarmHistoriesInvoker) - } - } - - return r0 -} - -// ListAlarmTemplates provides a mock function with given fields: request -func (_m *CesClient) ListAlarmTemplates(request *model.ListAlarmTemplatesRequest) (*model.ListAlarmTemplatesResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ListAlarmTemplates") - } - - var r0 *model.ListAlarmTemplatesResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.ListAlarmTemplatesRequest) (*model.ListAlarmTemplatesResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.ListAlarmTemplatesRequest) *model.ListAlarmTemplatesResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.ListAlarmTemplatesResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.ListAlarmTemplatesRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListAlarmTemplatesInvoker provides a mock function with given fields: request -func (_m *CesClient) ListAlarmTemplatesInvoker(request *model.ListAlarmTemplatesRequest) *v1.ListAlarmTemplatesInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ListAlarmTemplatesInvoker") - } - - var r0 *v1.ListAlarmTemplatesInvoker - if rf, ok := ret.Get(0).(func(*model.ListAlarmTemplatesRequest) *v1.ListAlarmTemplatesInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.ListAlarmTemplatesInvoker) - } - } - - return r0 -} - -// ListAlarms provides a mock function with given fields: request -func (_m *CesClient) ListAlarms(request *model.ListAlarmsRequest) (*model.ListAlarmsResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ListAlarms") - } - - var r0 *model.ListAlarmsResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.ListAlarmsRequest) (*model.ListAlarmsResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.ListAlarmsRequest) *model.ListAlarmsResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.ListAlarmsResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.ListAlarmsRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListAlarmsInvoker provides a mock function with given fields: request -func (_m *CesClient) ListAlarmsInvoker(request *model.ListAlarmsRequest) *v1.ListAlarmsInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ListAlarmsInvoker") - } - - var r0 *v1.ListAlarmsInvoker - if rf, ok := ret.Get(0).(func(*model.ListAlarmsRequest) *v1.ListAlarmsInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.ListAlarmsInvoker) - } - } - - return r0 -} - -// ListEventDetail provides a mock function with given fields: request -func (_m *CesClient) ListEventDetail(request *model.ListEventDetailRequest) (*model.ListEventDetailResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ListEventDetail") - } - - var r0 *model.ListEventDetailResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.ListEventDetailRequest) (*model.ListEventDetailResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.ListEventDetailRequest) *model.ListEventDetailResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.ListEventDetailResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.ListEventDetailRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListEventDetailInvoker provides a mock function with given fields: request -func (_m *CesClient) ListEventDetailInvoker(request *model.ListEventDetailRequest) *v1.ListEventDetailInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ListEventDetailInvoker") - } - - var r0 *v1.ListEventDetailInvoker - if rf, ok := ret.Get(0).(func(*model.ListEventDetailRequest) *v1.ListEventDetailInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.ListEventDetailInvoker) - } - } - - return r0 -} - -// ListEvents provides a mock function with given fields: request -func (_m *CesClient) ListEvents(request *model.ListEventsRequest) (*model.ListEventsResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ListEvents") - } - - var r0 *model.ListEventsResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.ListEventsRequest) (*model.ListEventsResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.ListEventsRequest) *model.ListEventsResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.ListEventsResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.ListEventsRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListEventsInvoker provides a mock function with given fields: request -func (_m *CesClient) ListEventsInvoker(request *model.ListEventsRequest) *v1.ListEventsInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ListEventsInvoker") - } - - var r0 *v1.ListEventsInvoker - if rf, ok := ret.Get(0).(func(*model.ListEventsRequest) *v1.ListEventsInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.ListEventsInvoker) - } - } - - return r0 -} - -// ListMetrics provides a mock function with given fields: request -func (_m *CesClient) ListMetrics(request *model.ListMetricsRequest) (*model.ListMetricsResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ListMetrics") - } - - var r0 *model.ListMetricsResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.ListMetricsRequest) (*model.ListMetricsResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.ListMetricsRequest) *model.ListMetricsResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.ListMetricsResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.ListMetricsRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListMetricsInvoker provides a mock function with given fields: request -func (_m *CesClient) ListMetricsInvoker(request *model.ListMetricsRequest) *v1.ListMetricsInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ListMetricsInvoker") - } - - var r0 *v1.ListMetricsInvoker - if rf, ok := ret.Get(0).(func(*model.ListMetricsRequest) *v1.ListMetricsInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.ListMetricsInvoker) - } - } - - return r0 -} - -// ListResourceGroup provides a mock function with given fields: request -func (_m *CesClient) ListResourceGroup(request *model.ListResourceGroupRequest) (*model.ListResourceGroupResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ListResourceGroup") - } - - var r0 *model.ListResourceGroupResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.ListResourceGroupRequest) (*model.ListResourceGroupResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.ListResourceGroupRequest) *model.ListResourceGroupResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.ListResourceGroupResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.ListResourceGroupRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListResourceGroupInvoker provides a mock function with given fields: request -func (_m *CesClient) ListResourceGroupInvoker(request *model.ListResourceGroupRequest) *v1.ListResourceGroupInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ListResourceGroupInvoker") - } - - var r0 *v1.ListResourceGroupInvoker - if rf, ok := ret.Get(0).(func(*model.ListResourceGroupRequest) *v1.ListResourceGroupInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.ListResourceGroupInvoker) - } - } - - return r0 -} - -// ShowAlarm provides a mock function with given fields: request -func (_m *CesClient) ShowAlarm(request *model.ShowAlarmRequest) (*model.ShowAlarmResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ShowAlarm") - } - - var r0 *model.ShowAlarmResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.ShowAlarmRequest) (*model.ShowAlarmResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.ShowAlarmRequest) *model.ShowAlarmResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.ShowAlarmResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.ShowAlarmRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ShowAlarmInvoker provides a mock function with given fields: request -func (_m *CesClient) ShowAlarmInvoker(request *model.ShowAlarmRequest) *v1.ShowAlarmInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ShowAlarmInvoker") - } - - var r0 *v1.ShowAlarmInvoker - if rf, ok := ret.Get(0).(func(*model.ShowAlarmRequest) *v1.ShowAlarmInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.ShowAlarmInvoker) - } - } - - return r0 -} - -// ShowEventData provides a mock function with given fields: request -func (_m *CesClient) ShowEventData(request *model.ShowEventDataRequest) (*model.ShowEventDataResponse, error) { +// ListMetrics provides a mock function with given fields: request +func (_m *CesClient) ListMetrics(request *model.ListMetricsRequest) (*model.ListMetricsResponse, error) { ret := _m.Called(request) if len(ret) == 0 { - panic("no return value specified for ShowEventData") + panic("no return value specified for ListMetrics") } - var r0 *model.ShowEventDataResponse + var r0 *model.ListMetricsResponse var r1 error - if rf, ok := ret.Get(0).(func(*model.ShowEventDataRequest) (*model.ShowEventDataResponse, error)); ok { + if rf, ok := ret.Get(0).(func(*model.ListMetricsRequest) (*model.ListMetricsResponse, error)); ok { return rf(request) } - if rf, ok := ret.Get(0).(func(*model.ShowEventDataRequest) *model.ShowEventDataResponse); ok { + if rf, ok := ret.Get(0).(func(*model.ListMetricsRequest) *model.ListMetricsResponse); ok { r0 = rf(request) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.ShowEventDataResponse) + r0 = ret.Get(0).(*model.ListMetricsResponse) } } - if rf, ok := ret.Get(1).(func(*model.ShowEventDataRequest) error); ok { + if rf, ok := ret.Get(1).(func(*model.ListMetricsRequest) error); ok { r1 = rf(request) } else { r1 = ret.Error(1) @@ -893,26 +42,6 @@ func (_m *CesClient) ShowEventData(request *model.ShowEventDataRequest) (*model. return r0, r1 } -// ShowEventDataInvoker provides a mock function with given fields: request -func (_m *CesClient) ShowEventDataInvoker(request *model.ShowEventDataRequest) *v1.ShowEventDataInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ShowEventDataInvoker") - } - - var r0 *v1.ShowEventDataInvoker - if rf, ok := ret.Get(0).(func(*model.ShowEventDataRequest) *v1.ShowEventDataInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.ShowEventDataInvoker) - } - } - - return r0 -} - // ShowMetricData provides a mock function with given fields: request func (_m *CesClient) ShowMetricData(request *model.ShowMetricDataRequest) (*model.ShowMetricDataResponse, error) { ret := _m.Called(request) @@ -943,326 +72,6 @@ func (_m *CesClient) ShowMetricData(request *model.ShowMetricDataRequest) (*mode return r0, r1 } -// ShowMetricDataInvoker provides a mock function with given fields: request -func (_m *CesClient) ShowMetricDataInvoker(request *model.ShowMetricDataRequest) *v1.ShowMetricDataInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ShowMetricDataInvoker") - } - - var r0 *v1.ShowMetricDataInvoker - if rf, ok := ret.Get(0).(func(*model.ShowMetricDataRequest) *v1.ShowMetricDataInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.ShowMetricDataInvoker) - } - } - - return r0 -} - -// ShowQuotas provides a mock function with given fields: request -func (_m *CesClient) ShowQuotas(request *model.ShowQuotasRequest) (*model.ShowQuotasResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ShowQuotas") - } - - var r0 *model.ShowQuotasResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.ShowQuotasRequest) (*model.ShowQuotasResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.ShowQuotasRequest) *model.ShowQuotasResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.ShowQuotasResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.ShowQuotasRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ShowQuotasInvoker provides a mock function with given fields: request -func (_m *CesClient) ShowQuotasInvoker(request *model.ShowQuotasRequest) *v1.ShowQuotasInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ShowQuotasInvoker") - } - - var r0 *v1.ShowQuotasInvoker - if rf, ok := ret.Get(0).(func(*model.ShowQuotasRequest) *v1.ShowQuotasInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.ShowQuotasInvoker) - } - } - - return r0 -} - -// ShowResourceGroup provides a mock function with given fields: request -func (_m *CesClient) ShowResourceGroup(request *model.ShowResourceGroupRequest) (*model.ShowResourceGroupResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ShowResourceGroup") - } - - var r0 *model.ShowResourceGroupResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.ShowResourceGroupRequest) (*model.ShowResourceGroupResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.ShowResourceGroupRequest) *model.ShowResourceGroupResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.ShowResourceGroupResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.ShowResourceGroupRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ShowResourceGroupInvoker provides a mock function with given fields: request -func (_m *CesClient) ShowResourceGroupInvoker(request *model.ShowResourceGroupRequest) *v1.ShowResourceGroupInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for ShowResourceGroupInvoker") - } - - var r0 *v1.ShowResourceGroupInvoker - if rf, ok := ret.Get(0).(func(*model.ShowResourceGroupRequest) *v1.ShowResourceGroupInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.ShowResourceGroupInvoker) - } - } - - return r0 -} - -// UpdateAlarm provides a mock function with given fields: request -func (_m *CesClient) UpdateAlarm(request *model.UpdateAlarmRequest) (*model.UpdateAlarmResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for UpdateAlarm") - } - - var r0 *model.UpdateAlarmResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.UpdateAlarmRequest) (*model.UpdateAlarmResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.UpdateAlarmRequest) *model.UpdateAlarmResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.UpdateAlarmResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.UpdateAlarmRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateAlarmAction provides a mock function with given fields: request -func (_m *CesClient) UpdateAlarmAction(request *model.UpdateAlarmActionRequest) (*model.UpdateAlarmActionResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for UpdateAlarmAction") - } - - var r0 *model.UpdateAlarmActionResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.UpdateAlarmActionRequest) (*model.UpdateAlarmActionResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.UpdateAlarmActionRequest) *model.UpdateAlarmActionResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.UpdateAlarmActionResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.UpdateAlarmActionRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateAlarmActionInvoker provides a mock function with given fields: request -func (_m *CesClient) UpdateAlarmActionInvoker(request *model.UpdateAlarmActionRequest) *v1.UpdateAlarmActionInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for UpdateAlarmActionInvoker") - } - - var r0 *v1.UpdateAlarmActionInvoker - if rf, ok := ret.Get(0).(func(*model.UpdateAlarmActionRequest) *v1.UpdateAlarmActionInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.UpdateAlarmActionInvoker) - } - } - - return r0 -} - -// UpdateAlarmInvoker provides a mock function with given fields: request -func (_m *CesClient) UpdateAlarmInvoker(request *model.UpdateAlarmRequest) *v1.UpdateAlarmInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for UpdateAlarmInvoker") - } - - var r0 *v1.UpdateAlarmInvoker - if rf, ok := ret.Get(0).(func(*model.UpdateAlarmRequest) *v1.UpdateAlarmInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.UpdateAlarmInvoker) - } - } - - return r0 -} - -// UpdateAlarmTemplate provides a mock function with given fields: request -func (_m *CesClient) UpdateAlarmTemplate(request *model.UpdateAlarmTemplateRequest) (*model.UpdateAlarmTemplateResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for UpdateAlarmTemplate") - } - - var r0 *model.UpdateAlarmTemplateResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.UpdateAlarmTemplateRequest) (*model.UpdateAlarmTemplateResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.UpdateAlarmTemplateRequest) *model.UpdateAlarmTemplateResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.UpdateAlarmTemplateResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.UpdateAlarmTemplateRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateAlarmTemplateInvoker provides a mock function with given fields: request -func (_m *CesClient) UpdateAlarmTemplateInvoker(request *model.UpdateAlarmTemplateRequest) *v1.UpdateAlarmTemplateInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for UpdateAlarmTemplateInvoker") - } - - var r0 *v1.UpdateAlarmTemplateInvoker - if rf, ok := ret.Get(0).(func(*model.UpdateAlarmTemplateRequest) *v1.UpdateAlarmTemplateInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.UpdateAlarmTemplateInvoker) - } - } - - return r0 -} - -// UpdateResourceGroup provides a mock function with given fields: request -func (_m *CesClient) UpdateResourceGroup(request *model.UpdateResourceGroupRequest) (*model.UpdateResourceGroupResponse, error) { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for UpdateResourceGroup") - } - - var r0 *model.UpdateResourceGroupResponse - var r1 error - if rf, ok := ret.Get(0).(func(*model.UpdateResourceGroupRequest) (*model.UpdateResourceGroupResponse, error)); ok { - return rf(request) - } - if rf, ok := ret.Get(0).(func(*model.UpdateResourceGroupRequest) *model.UpdateResourceGroupResponse); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*model.UpdateResourceGroupResponse) - } - } - - if rf, ok := ret.Get(1).(func(*model.UpdateResourceGroupRequest) error); ok { - r1 = rf(request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateResourceGroupInvoker provides a mock function with given fields: request -func (_m *CesClient) UpdateResourceGroupInvoker(request *model.UpdateResourceGroupRequest) *v1.UpdateResourceGroupInvoker { - ret := _m.Called(request) - - if len(ret) == 0 { - panic("no return value specified for UpdateResourceGroupInvoker") - } - - var r0 *v1.UpdateResourceGroupInvoker - if rf, ok := ret.Get(0).(func(*model.UpdateResourceGroupRequest) *v1.UpdateResourceGroupInvoker); ok { - r0 = rf(request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.UpdateResourceGroupInvoker) - } - } - - return r0 -} - // NewCesClient creates a new instance of CesClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewCesClient(t interface { diff --git a/receiver/huaweicloudcesreceiver/receiver.go b/receiver/huaweicloudcesreceiver/receiver.go index eeee7917f0d2..6436be4e5be0 100644 --- a/receiver/huaweicloudcesreceiver/receiver.go +++ b/receiver/huaweicloudcesreceiver/receiver.go @@ -118,7 +118,7 @@ func (rcvr *cesReceiver) createClient() (*ces.CesClient, error) { if err != nil { return nil, err } - r, err := region.SafeValueOf(rcvr.config.RegionName) + r, err := region.SafeValueOf(rcvr.config.RegionID) if err != nil { return nil, err } @@ -147,7 +147,7 @@ func (rcvr *cesReceiver) pollMetricsAndConsume(ctx context.Context) error { return err } metrics := rcvr.listDataPoints(ctx, metricDefinitions) - otpMetrics := internal.ConvertCESMetricsToOTLP(rcvr.config.ProjectID, rcvr.config.RegionName, rcvr.config.Filter, metrics) + otpMetrics := internal.ConvertCESMetricsToOTLP(rcvr.config.ProjectID, rcvr.config.RegionID, rcvr.config.Filter, metrics) if err := rcvr.nextConsumer.ConsumeMetrics(ctx, otpMetrics); err != nil { return err }