MyGit

aliyun/aliyun-openapi-net-sdk

Fork: 625 Star: 542 (更新于 2024-11-18 10:07:06)

license: NOASSERTION

Language: C# .

Alibaba Cloud SDK for .NET

最后发布版本: v1.5.2 ( 2019-08-20 14:33:22)

官方网址 GitHub网址

English | 简体中文

Alibaba Cloud SDK for .NET

.NET CI codecov Nuget Version Nuget Download License FOSSA Status

The Alibaba Cloud SDK for .NET allows you to access Alibaba Cloud services such as Elastic Compute Service (ECS), Server Load Balancer (SLB), CloudMonitor, etc. You can access Alibaba Cloud services without the need to handle API related tasks, such as signing and constructing your requests.

Troubleshoot

Troubleshoot Provide OpenAPI diagnosis service to help developers locate quickly and provide solutions for developers through RequestID or error message.

Online Demo

Alibaba Cloud OpenAPI Developer Portal provides the ability to call the cloud product OpenAPI online, generates SDK Example code dynamically and retrieves interface quickly, which can lessen the difficultly of using the Alibaba Cloud API significantly.

Requirements

  • The Alibaba Cloud SDK for .NET requires:
    • .NET Framework 4.5 and above
    • .NET Standard 2.0 and above
    • C# 4.0 and above

Installation

You should install ECS Nuget Package when you are using ECS Product. If you want to install a specific version, please add --version or it will install the latest version of this package.

Use .NET CLI ( Recommand )

dotnet add package aliyun-net-sdk-ecs

Use Package Manager

Install-Package aliyun-net-sdk-ecs

Quick Examples

At the beginning, you need to sign up for an Alibaba Cloud account and retrieve your Credentials.

Note: To increase the security of your account, we recommend that you can use the AccessKey of the RAM user to access Alibaba Cloud services.

Initiate a call

The following code example show three main steps to use the Alibaba Cloud SDK for .NET:

  • Create and initialize a DefaultAcsClient instance.

  • Create a request and set parameters.

  • Initiate the request and handle the response.

using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Profile;
using Aliyun.Acs.Core.Exceptions;
using Aliyun.Acs.Ecs.Model.V20140526;

class Program
{
    static void Main(string[] args)
    {
        // Create a client used for initiating a request
        IClientProfile profile = DefaultProfile.GetProfile(
            "<your-region-id>",
            "<your-access-key-id>",
            "<your-access-key-secret>");
        DefaultAcsClient client = new DefaultAcsClient(profile);

        try
        {
            // Create the request
            DescribeInstancesRequest request = new DescribeInstancesRequest();
            request.PageSize = 10;

            // Initiate the request and get the response
            DescribeInstancesResponse response = client.GetAcsResponse(request);
            System.Console.WriteLine(response.TotalCount);
        }
        catch (ServerException ex)
        {
            System.Console.WriteLine(ex.ToString());
        }
        catch (ClientException ex)
        {
            System.Console.WriteLine(ex.ToString());
        }
    }
}

Use BearerToken to invoke CCC Product

You should install the CCC Product Nuget Package if you want to run the below demo in your local machine.

using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Profile;
using Aliyun.Acs.Core.Exceptions;
using Aliyun.Acs.CCC.Model.V20170705;

class Program
{
    static void Main(string[] args)
    {
        // Create a client used for initiating a request
        var profile = DefaultProfile.GetProfile("<your-region-id>");
        var bearerTokenCredentialProvider = new BearerTokenCredentialProvider("<your-bearertoken>");

        var client = new DefaultAcsClient(profile, bearerTokenCredentialProvider);

        try
        {
            // Create the request
            var request = new ListPhoneNumbersRequest();

            // Initiate the request and get the response
            var response = client.GetAcsResponse(request);
            
            // Do something as you want below
        }
        catch (ServerException ex)
        {
            System.Console.WriteLine(ex.ToString());
        }
        catch (ClientException ex)
        {
            System.Console.WriteLine(ex.ToString());
        }
    }
}

Documentation

Issues

Opening an Issue, Issues not conforming to the guidelines may be closed immediately.

Changelog

Detailed changes for each release are documented in the release notes.

API Reference

You can visit the API and its parameters in Product List.

License

Apache-2.0

FOSSA Status

最近版本更新:(数据更新于 2024-10-09 10:15:57)

2019-08-20 14:33:22 v1.5.2

主题(topics):

alibaba, alibabacloud, alibabacloud-sdk, client, csharp, dotnet, net, net-core, sdk

aliyun/aliyun-openapi-net-sdk同语言 C#最近更新仓库

2024-11-19 11:38:46 jellyfin/jellyfin

2024-11-15 10:33:01 DigitalRuby/IPBan

2024-11-13 04:41:56 dotnet/runtime

2024-11-07 00:43:03 huiyadanli/RevokeMsgPatcher

2024-11-06 13:04:33 Pik-4/HsMod

2024-11-05 02:46:31 microsoft/PowerToys