本文简要介绍了.NET SDK的安装包下载地址,并提供了操作示例。

.NET SDK安装包下载地址

安装包下载地址 :.NET SDK

说明 RAM已经接入NuGet,详情请参见RAM NuGet

.NET SDK示例

以下示例以.NET SDK为例,说明如何创建RAM用户。

using System;
using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Profile;
using Aliyun.Acs.Ram.Model.V20150501;

namespace ram_net_sdk_sample
{
    class Program
    {
        static void Main(string[] args)
        {
//构建一个阿里云client,用于发起请求
            //构建阿里云client时需要设置AccessKey ID和AccessKey Secret
            //RAM是Global Service, API入口位于华东 1(杭州),这里地域填写:cn-hangzhou
            IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou", "<access-key-id>", "<access-key-secret>");
            DefaultAcsClient client = new DefaultAcsClient(profile);


            //构建CreateUser请求
            CreateUserRequest request = new CreateUserRequest();

            //设置参数: UserName
            request.UserName = "alice";

            //发起请求,并得到response
            try
            {
                CreateUserResponse response = client.GetAcsResponse(request);

                Console.WriteLine("UserName: " + response.User.UserName);
                Console.WriteLine("CreateTime: " + response.User.CreateDate);
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
            Console.ReadLine();
        }

    }
}