Skip to content

Feat/support alibabacloud resource#67

Merged
j3ttt merged 40 commits intoantgroup:mainfrom
j3ttt:feat/support-alibabacloud-resource
Aug 14, 2025
Merged

Feat/support alibabacloud resource#67
j3ttt merged 40 commits intoantgroup:mainfrom
j3ttt:feat/support-alibabacloud-resource

Conversation

@j3ttt
Copy link
Collaborator

@j3ttt j3ttt commented Aug 14, 2025

Thank you for your contribution to CloudRec!

What About:

  • Server (java)
  • Collector (go)
  • Rule (opa)

Description:

Add support for new Alibaba Cloud resources:

  1. GA Accelerator
  2. Elastic Cloud Phone (ECP) Instance
  3. ONS Instance
  4. EFLO Node
  5. Cloud Storage Gateway and its Storage Bundles
  6. DCDN Domains (standard and IPA)
  7. Live Domains
  8. VOD Domains
  9. SMS Templates
  10. API Gateway Apps
  11. ARMS Prometheus
  12. Elasticsearch Logstash

Bug Fixes:

  • Restrict ECS image listing to ownerAlias "self"

Summary by Sourcery

Expand the Alibaba Cloud collector to support a broad set of new services by adding corresponding SDK clients, resource detail functions, and registrations in platform configuration

New Features:

  • Add support for new Alibaba Cloud resources: GA Accelerator, Elastic Cloud Phone (ECP), ONS Instance, EFLO Node, Cloud Storage Gateway and its Storage Bundles, DCDN Domains (standard and IPA), Live Domains, VOD Domains, SMS Templates, API Gateway Apps, ARMS Prometheus, and Elasticsearch Logstash

Bug Fixes:

  • Restrict ECS image listing to ownerAlias "self"

Enhancements:

  • Update Services struct and InitServices to initialize clients for eds-aic (ECP), dysmsapi (SMS), eflo-controller, ga, dcdn, vod, sgw, live, ons, and include ARMSPrometheus and API Gateway App in client cases
  • Register all new resources in platform configuration and extend constants for resource types and resource group MONITORING

j3ttt and others added 30 commits June 10, 2025 10:28
change docker-image.yaml, add lint.yaml
- Add ONS instance collector
- Add GA accelerator collector with listeners and endpoint groups
- Add EFLO node collector for edge computing
- Update service initialization and platform config
@gemini-code-assist
Copy link
Contributor

Important

Installation incomplete: to start using Gemini Code Assist, please ask the organization owner(s) to visit the Gemini Code Assist Admin Console and sign the Terms of Services.

@sourcery-ai
Copy link

sourcery-ai bot commented Aug 14, 2025

Reviewer's Guide

This pull request adds support for a wide range of new Alibaba Cloud (Aliyun) resources to the collector, including new resource types, service clients, resource detail implementations, and platform configuration updates. It introduces new Go modules and updates dependencies to enable these integrations.

Class diagram for new Alibaba Cloud resource detail implementations

classDiagram
    class Services {
        +APIGatewayApp : *cloudapi20160714.Client
        +ARMSPrometheus : *arms20190808.Client
        +ECP : *eds_aic20230930.Client
        +Ons : *ons.Client
        +GA : *ga.Client
        +DCDN : *dcdn.Client
        +VOD : *vod.Client
        +SGW : *sgw.Client
        +Live : *live.Client
        +EfloController : *eflo_controller.Client
        +Dysmsapi : *dysmsapi.Client
    }
    class APIGatewayAppDetail {
        +App : *cloudapi20160714.DescribeAppsResponseBodyAppsAppItem
        +AppSecurity : *cloudapi20160714.DescribeAppSecurityResponseBody
        +AuthorizedAPIs : []*cloudapi20160714.DescribeAuthorizedApisResponseBodyAuthorizedApisAuthorizedApi
    }
    class PrometheusDetail {
        +PrometheusInstance : *arms20190808.GetPrometheusInstanceResponseBodyData
        +AlertRules : []*arms20190808.ListPrometheusAlertRulesResponseBodyPrometheusAlertRules
        +MonitoringConfigs : []*arms20190808.ListPrometheusMonitoringResponseBodyData
        +SubClusters : []SubClusterDetail
    }
    class CloudStorageGatewayDetail {
        +Gateway : sgw.Gateway
        +AuthInfo : *sgw.DescribeGatewayAuthInfoResponse
        +FileShares : []sgw.FileShare
        +BlockVolumes : []sgw.BlockVolume
        +SMBUsers : []sgw.User
        +NFSClients : []sgw.ClientInfo
        +LDAPInfo : *sgw.DescribeGatewayLDAPInfoResponse
    }
    class CloudStorageGatewayStorageBundleDetail {
        +StorageBundle : sgw.StorageBundle
    }
    class LiveDomainDetail {
        +Domain : live.PageData
        +DomainDetail : live.DomainDetail
        +DomainConfigs : live.DomainConfigsInDescribeLiveDomainConfigs
        +CertificateInfo : live.CertInfosInDescribeLiveDomainCertificateInfo
        +DomainMapping : live.LiveDomainModels
    }
    class DCDNIpaDomainDetail {
        +Domain : dcdn.PageData
        +DomainDetail : dcdn.DomainDetail
        +DomainConfigs : dcdn.DomainConfigsInDescribeDcdnIpaDomainConfigs
        +CertificateInfo : dcdn.CertInfosInDescribeDcdnDomainCertificateInfo
    }
    class DCDNDomainDetail {
        +Domains : dcdn.PageData
        +DomainConfigs : []dcdn.DomainConfig
    }
    class VODDomainDetail {
        +Domains : vod.PageData
        +DomainDetail : vod.DomainDetail
        +DomainConfigs : []vod.DomainConfig
        +CertificateList : vod.CertificateListModel
    }
    class SMSTemplateDetail {
        +Template : dysmsapi.SmsStatsResultDTO
    }
    class EfloNodeDetail {
        +Node : eflo_controller.NodesItem
    }
    class GAAcceleratorDetail {
        +Accelerator : ga.AcceleratorsItem
        +Listeners : []Listener
        +EndpointGroups : []ga.EndpointGroupsItem
    }
    class ECPInstanceDetail {
        +Instance : *aic20230930.DescribeAndroidInstancesResponseBodyInstanceModel
    }
    class ONSInstanceDetail {
        +Instance : ons.InstanceVO
        +InstanceBaseInfo : ons.InstanceBaseInfo
    }
    class LogstashDetail {
        +Instance : *client.ListLogstashResponseBodyResult
    }
Loading

Class diagram for updated resource type constants

classDiagram
    class CollectorConstants {
        +ElasticsearchLogstash : string
        +APIGatewayApp : string
        +ARMSPrometheus : string
        +ONS_INSTANCE : string
        +GAAccelerator : string
        +CloudStorageGateway : string
        +CloudStorageGatewayStorageBundle : string
        +DCDNIpaDomain : string
        +LiveDomain : string
        +EfloNode : string
        +ECPInstance : string
        +VODDomain : string
        +SMSTemplate : string
    }
Loading

Class diagram for new resource group type constant

classDiagram
    class ResourceGroupType {
        +MONITORING : string
    }
Loading

File-Level Changes

Change Details Files
Added support for new Alibaba Cloud resource types and services.
  • Introduced new constants for additional Aliyun resources (e.g., Logstash, API Gateway App, ARMS Prometheus, GA Accelerator, CloudStorageGateway, ONS Instance, etc.).
  • Added new service client initializations for these resources in the service layer.
  • Implemented resource detail collection logic for each new resource type (e.g., accelerator.go, prometheus.go, gateway.go, etc.).
  • Registered new resources in the platform configuration to enable their discovery and collection.
collector/alicloud/collector/constant.go
collector/alicloud/collector/services.go
collector/alicloud/platform/platform_config.go
collector/alicloud/collector/ga/accelerator.go
collector/alicloud/collector/arms/prometheus.go
collector/alicloud/collector/cloudstoragegateway/gateway.go
collector/alicloud/collector/cloudstoragegateway/storage_bundle.go
collector/alicloud/collector/live/live_domain.go
collector/alicloud/collector/vod/domain.go
collector/alicloud/collector/dcdn/domain.go
collector/alicloud/collector/dcdn/ipa_domain.go
collector/alicloud/collector/cloudapi/api_gateway_app.go
collector/alicloud/collector/ons/instance.go
collector/alicloud/collector/eflo/node.go
collector/alicloud/collector/ecp/instance.go
collector/alicloud/collector/elasticsearch/logstash.go
collector/alicloud/collector/sms/template.go
Updated Go module dependencies to support new Alibaba Cloud SDKs and features.
  • Added and updated dependencies in go.mod and go.sum for new Aliyun SDKs (e.g., eds-aic, dcdn, ga, live, ons, sgw, vod, etc.).
  • Bumped versions of existing dependencies to ensure compatibility.
collector/alicloud/go.mod
collector/alicloud/go.sum
collector/go.mod
collector/go.sum
Enhanced resource group type constants and minor resource logic improvements.
  • Added MONITORING to resource group types.
  • Minor improvements to resource detail logic (e.g., ECS images now filter by owner alias).
collector/core-sdk/constant/resource_group_type.go
collector/alicloud/collector/ecs/images.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `collector/alicloud/collector/cloudapi/api_gateway_app.go:96` </location>
<code_context>
+	return nil
+}
+
+func getAppSecurity(ctx context.Context, cli *cloudapi20160714.Client, appId *int64) *cloudapi20160714.DescribeAppSecurityResponseBody {
+	describeAppSecurityRequest := &cloudapi20160714.DescribeAppSecurityRequest{AppId: appId}
+
</code_context>

<issue_to_address>
Check for nil pointer dereference on appId.

A nil appId will trigger a runtime panic. Add a nil check before using appId.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

return nil
}

func getAppSecurity(ctx context.Context, cli *cloudapi20160714.Client, appId *int64) *cloudapi20160714.DescribeAppSecurityResponseBody {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Check for nil pointer dereference on appId.

A nil appId will trigger a runtime panic. Add a nil check before using appId.

@j3ttt j3ttt merged commit 564d5fb into antgroup:main Aug 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants