全部产品
访问控制

示例

更新时间:2017-06-07 13:26:11   分享:   

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)
        {
            // 构建一个 Aliyun Client, 用于发起请求
            // 构建Aliyun Client时需要设置AccessKeyId和AccessKeySevcret
            // RAM是Global Service, API入口位于华东 1 (杭州) , 这里Region填写"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();
        }

    }
}
本文导读目录
本文导读目录
以上内容是否对您有帮助?