← Back to Skills Marketplace
yndu13

Alibabacloud Sdk Client Initialization For Java

by yndu13 · GitHub ↗ · v0.0.2-beta · MIT-0
cross-platform ⚠ suspicious
103
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install alibabacloud-sdk-client-initialization-for-java
Description
Initialize and manage Alibaba Cloud SDK clients in Java. Covers singleton pattern, thread safety, endpoint vs region configuration, VPC endpoints, sync vs as...
README (SKILL.md)

Client Initialization Best Practices (Java)

Core Rules

  • Client is thread-safe — safe to share across threads without synchronization.
  • Use singleton pattern — do NOT create new client instances per request. Frequent new Client() calls waste resources and hurt performance.
  • Prefer explicit endpoint over region-based endpoint resolution.
  • preview version

Recommended Client Creation

public class ClientFactory {
    private static volatile com.aliyun.ecs20140526.Client instance;

    public static com.aliyun.ecs20140526.Client getInstance() throws Exception {
        if (instance == null) {
            synchronized (ClientFactory.class) {
                if (instance == null) {
                    com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                        .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                        .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
                    config.setEndpoint("ecs.cn-hangzhou.aliyuncs.com");
                    instance = new com.aliyun.ecs20140526.Client(config);
                }
            }
        }
        return instance;
    }
}

Endpoint Configuration

Priority: explicit endpoint > region-based resolution via regionId.

// Preferred: explicit endpoint
config.setEndpoint("ecs.cn-hangzhou.aliyuncs.com");

// Alternative: SDK resolves endpoint from region
config.setRegionId("cn-hangzhou");

VPC Endpoints

Use VPC endpoints when running inside Alibaba Cloud VPC (hybrid cloud, leased lines, multi-region):

config.setEndpoint("ecs-vpc.cn-hangzhou.aliyuncs.com");

File Upload APIs (Advance)

For file upload APIs (e.g., Visual Intelligence), set both regionId and endpoint to the same region. Otherwise you may see timeouts due to cross-region OSS access:

config.setRegionId("cn-shanghai");
config.setEndpoint("objectdet.cn-shanghai.aliyuncs.com");
// For VPC file upload authorization:
client._openPlatformEndpoint = "openplatform-vpc.cn-shanghai.aliyuncs.com";

Synchronous vs Asynchronous

Mode SDK Artifact When to Use
Synchronous com.aliyun:{productCode}{version} Simple flows, low concurrency, easier debugging
Asynchronous com.aliyun:alibabacloud-{productCode}{version} High concurrency/throughput, non-blocking I/O

Async example:

AsyncClient client = AsyncClient.builder()
    .region("cn-hangzhou")
    .credentialsProvider(provider)
    .overrideConfiguration(ClientOverrideConfiguration.create()
        .setEndpointOverride("ecs.cn-chengdu.aliyuncs.com"))
    .build();

CompletableFuture\x3CDescribeRegionsResponse> response = client.describeRegions(request);
response.thenAccept(resp -> System.out.println(new Gson().toJson(resp)))
    .exceptionally(throwable -> { System.out.println(throwable.getMessage()); return null; });
// Always close async client when done
client.close();
Usage Guidance
This is primarily an examples/instructions-only skill for Alibaba Cloud Java SDK clients and appears functionally coherent, but note two issues before installing or using it: (1) the SKILL.md examples rely on ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variables, yet the skill metadata does not declare any required credentials — ask the publisher to explicitly declare required env vars or update the metadata; (2) the source and homepage are unknown, which reduces trust — prefer skills with a verifiable author or repo. If you proceed, avoid exposing long-lived root keys: use least-privilege credentials, Alibaba RAM roles or STS temporary tokens where possible, don't paste secrets into chat, and confirm how the agent will obtain/use those environment variables. Request clarification from the author about credential handling and the intended deployment environment to raise confidence.
Capability Analysis
Type: OpenClaw Skill Name: alibabacloud-sdk-client-initialization-for-java Version: 0.0.2-beta The skill bundle provides standard documentation and best practices for initializing Alibaba Cloud SDK clients in Java. The instructions in SKILL.md cover legitimate topics such as the singleton pattern, thread safety, and VPC endpoint configuration. There is no evidence of malicious intent, data exfiltration, or prompt injection; the code snippets provided are typical for legitimate SDK usage and follow standard security practices like reading credentials from environment variables.
Capability Assessment
Purpose & Capability
The skill's name and content are consistent with initializing Alibaba Cloud Java SDK clients. However, the example code calls System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID") and System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET") while the skill metadata declares no required environment variables or primary credential. Credentials are central to the skill's purpose and should be explicitly declared.
Instruction Scope
The SKILL.md contains runnable Java examples that read environment variables for credentials and set endpoints; these actions are within scope for a cloud SDK guide. It does not instruct the agent to read unrelated files, system config, or exfiltrate data. Still, the examples implicitly expect secrets in the environment which the metadata omits.
Install Mechanism
No install spec and no code files (instruction-only). This minimizes filesystem risk; nothing is fetched or executed by an installer.
Credentials
The SKILL.md uses sensitive environment variables (ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET) but the skill metadata does not list them under required env or primary credential. Requiring cloud credentials would be proportionate to the purpose, but the omission is an inconsistency that could hide expected secret access.
Persistence & Privilege
always is false and there are no install actions or configuration changes. The skill does not request persistent system privileges or to modify other skills.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install alibabacloud-sdk-client-initialization-for-java
  3. After installation, invoke the skill by name or use /alibabacloud-sdk-client-initialization-for-java
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.0.2-beta
- Bumped version to 0.0.2-beta. - Added "preview version" mention to Core Rules section in documentation. - No other changes to guidance, examples, or API recommendations.
v0.0.1
Initial release providing best practices and code examples for Alibaba Cloud SDK client initialization in Java. - Explains thread safety and recommends the singleton pattern for client reuse. - Details explicit endpoint configuration, region-based alternatives, and VPC endpoint usage. - Covers both synchronous and asynchronous client usage scenarios. - Includes advice for file upload APIs to ensure reliable, region-matched configuration. - Provides ready-to-use sample code for client factory implementation and async API calls.
Metadata
Slug alibabacloud-sdk-client-initialization-for-java
Version 0.0.2-beta
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is Alibabacloud Sdk Client Initialization For Java?

Initialize and manage Alibaba Cloud SDK clients in Java. Covers singleton pattern, thread safety, endpoint vs region configuration, VPC endpoints, sync vs as... It is an AI Agent Skill for Claude Code / OpenClaw, with 103 downloads so far.

How do I install Alibabacloud Sdk Client Initialization For Java?

Run "/install alibabacloud-sdk-client-initialization-for-java" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Alibabacloud Sdk Client Initialization For Java free?

Yes, Alibabacloud Sdk Client Initialization For Java is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Alibabacloud Sdk Client Initialization For Java support?

Alibabacloud Sdk Client Initialization For Java is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Alibabacloud Sdk Client Initialization For Java?

It is built and maintained by yndu13 (@yndu13); the current version is v0.0.2-beta.

💬 Comments