日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

快速入門

更新時(shí)間:

本節(jié)介紹如何快速使用OOS C# SDK完成常見操作,如創(chuàng)建模板、啟動(dòng)執(zhí)行、查詢執(zhí)行等。

創(chuàng)建模板

以下代碼用于創(chuàng)建模板:

using System;
using System.Collections.Generic;
using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Exceptions;
using Aliyun.Acs.Core.Profile;
using Aliyun.Acs.Core.Auth;
using Aliyun.Acs.oos.Model.V20190601;

namespace AlibabaCloud.SDK.Sample
{
    class Program
    {
        static void Main(string[] args)
        {		
          	/*
            阿里云賬號(hào)AccessKey擁有所有API的訪問(wèn)權(quán)限,建議您使用RAM用戶進(jìn)行API訪問(wèn)或日常運(yùn)維。
            強(qiáng)烈建議不要把AccessKey ID和AccessKey Secret保存到工程代碼里,否則可能導(dǎo)致AccessKey泄露,威脅您賬號(hào)下所有資源的安全。
            本示例使用了阿里云Credentials工具托管AccessKey,來(lái)實(shí)現(xiàn)API訪問(wèn)的身份驗(yàn)證。
            具體配置操作(或者配置環(huán)境變量),請(qǐng)參見http://bestwisewords.com/document_detail/378661.html。
            */
            // Please ensure that the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set.
        AlibabaCloudCredentialsProvider provider = new AccessKeyCredentialProvider(
            Environment.GetEnvironmentVariable("ALIBABA_CLOUD_ACCESS_KEY_ID"), 
            Environment.GetEnvironmentVariable("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
            /* use STS Token
            AlibabaCloudCredentialsProvider provider = new StsCredentialProvider(
                Environment.GetEnvironmentVariable("ALIBABA_CLOUD_ACCESS_KEY_ID"), 
                Environment.GetEnvironmentVariable("ALIBABA_CLOUD_ACCESS_KEY_SECRET"), 
                Environment.GetEnvironmentVariable("ALIBABA_CLOUD_SECURITY_TOKEN"));
            */
            IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou");
            DefaultAcsClient client = new DefaultAcsClient(profile, provider);

            
            var request = new CreateTemplateRequest();
            request.TemplateName = "MyTemplate";
            request.Content = "{\n  \\\"FormatVersion\\\": \\\"OOS-2019-06-01\\\",\n  \\\"Description\\\": \\\"Describe instances of given status\\\",\n  \\\"Parameters\\\": {\n    \\\"Status\\\": {\n      \\\"Type\\\": \\\"String\\\",\n      \\\"Description\\\": \\\"(Required) The status of the Ecs instance.\\\"\n    }\n  },\n  \\\"Tasks\\\": [\n    {\n      \\\"Properties\\\": {\n        \\\"Parameters\\\": { \\\"Status\\\": \\\"{{ Status }}\\\" },\n        \\\"API\\\": \\\"DescribeInstances\\\",\n        \\\"Service\\\": \\\"ECS\\\"\n      },\n      \\\"Name\\\": \\\"describeInstances\\\",\n      \\\"Action\\\": \\\"ACS::ExecuteAPI\\\"\n    }\n  ]\n}";

            try {
                var response = client.GetAcsResponse(request);
                Console.WriteLine(System.Text.Encoding.Default.GetString(response.HttpResponse.Content));
            }
            catch (ServerException e)
            {
                Console.WriteLine(e);
            }
            catch (ClientException e)
            {
                Console.WriteLine(e);
            }
        }
    }
}

啟動(dòng)執(zhí)行

以下代碼用于啟動(dòng)執(zhí)行:

using System;
using System.Collections.Generic;
using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Exceptions;
using Aliyun.Acs.Core.Profile;
using Aliyun.Acs.Core.Auth;
using Aliyun.Acs.oos.Model.V20190601;

namespace AlibabaCloud.SDK.Sample
{
    class Program
    {
        static void Main(string[] args)
        {
          	/*
            阿里云賬號(hào)AccessKey擁有所有API的訪問(wèn)權(quán)限,建議您使用RAM用戶進(jìn)行API訪問(wèn)或日常運(yùn)維。
            強(qiáng)烈建議不要把AccessKey ID和AccessKey Secret保存到工程代碼里,否則可能導(dǎo)致AccessKey泄露,威脅您賬號(hào)下所有資源的安全。
            本示例使用了阿里云Credentials工具托管AccessKey,來(lái)實(shí)現(xiàn)API訪問(wèn)的身份驗(yàn)證。
            具體配置操作(或者配置環(huán)境變量),請(qǐng)參見http://bestwisewords.com/document_detail/378661.html。
            */
            // Please ensure that the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set.
        AlibabaCloudCredentialsProvider provider = new AccessKeyCredentialProvider(
            Environment.GetEnvironmentVariable("ALIBABA_CLOUD_ACCESS_KEY_ID"), 
            Environment.GetEnvironmentVariable("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
            /* use STS Token
            AlibabaCloudCredentialsProvider provider = new StsCredentialProvider(
                Environment.GetEnvironmentVariable("ALIBABA_CLOUD_ACCESS_KEY_ID"), 
                Environment.GetEnvironmentVariable("ALIBABA_CLOUD_ACCESS_KEY_SECRET"), 
                Environment.GetEnvironmentVariable("ALIBABA_CLOUD_SECURITY_TOKEN"));
            */
            IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou");
            DefaultAcsClient client = new DefaultAcsClient(profile, provider);

            
            var request = new StartExecutionRequest();
            request.TemplateName = "MyTemplate";

            try {
                var response = client.GetAcsResponse(request);
                Console.WriteLine(System.Text.Encoding.Default.GetString(response.HttpResponse.Content));
            }
            catch (ServerException e)
            {
                Console.WriteLine(e);
            }
            catch (ClientException e)
            {
                Console.WriteLine(e);
            }
        }
    }
}

查詢執(zhí)行

以下代碼用于查詢執(zhí)行:

using System;
using System.Collections.Generic;
using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Exceptions;
using Aliyun.Acs.Core.Profile;
using Aliyun.Acs.Core.Auth;
using Aliyun.Acs.oos.Model.V20190601;

namespace AlibabaCloud.SDK.Sample
{
    class Program
    {
        static void Main(string[] args)
        {	
          	/*
            阿里云賬號(hào)AccessKey擁有所有API的訪問(wèn)權(quán)限,建議您使用RAM用戶進(jìn)行API訪問(wèn)或日常運(yùn)維。
            強(qiáng)烈建議不要把AccessKey ID和AccessKey Secret保存到工程代碼里,否則可能導(dǎo)致AccessKey泄露,威脅您賬號(hào)下所有資源的安全。
            本示例使用了阿里云Credentials工具托管AccessKey,來(lái)實(shí)現(xiàn)API訪問(wèn)的身份驗(yàn)證。
            具體配置操作(或者配置環(huán)境變量),請(qǐng)參見http://bestwisewords.com/document_detail/378661.html。
            */
            // Please ensure that the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set.
        AlibabaCloudCredentialsProvider provider = new AccessKeyCredentialProvider(
            Environment.GetEnvironmentVariable("ALIBABA_CLOUD_ACCESS_KEY_ID"), 
            Environment.GetEnvironmentVariable("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
            /* use STS Token
            AlibabaCloudCredentialsProvider provider = new StsCredentialProvider(
                Environment.GetEnvironmentVariable("ALIBABA_CLOUD_ACCESS_KEY_ID"), 
                Environment.GetEnvironmentVariable("ALIBABA_CLOUD_ACCESS_KEY_SECRET"), 
                Environment.GetEnvironmentVariable("ALIBABA_CLOUD_SECURITY_TOKEN"));
            */
            IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou");
            DefaultAcsClient client = new DefaultAcsClient(profile, provider);

            
            var request = new ListExecutionsRequest();
            request.ExecutionId = "<ExecutionId>";

            try {
                var response = client.GetAcsResponse(request);
                Console.WriteLine(System.Text.Encoding.Default.GetString(response.HttpResponse.Content));
            }
            catch (ServerException e)
            {
                Console.WriteLine(e);
            }
            catch (ClientException e)
            {
                Console.WriteLine(e);
            }
        }
    }
}