Пример #1
0
        public RestRequest GenHttpRequest(FCConfig cfg)
        {
            this.Config  = cfg;
            this.Headers = this.BuildCommonHeaders("GET", this.GetPath(), this.Headers);
            var request = new RestRequest(this.GetPath(), Method.GET);

            foreach (var item in this.Headers)
            {
                request.AddHeader(item.Key, item.Value);
            }

            request.AddQueryParameter("stdin", this.Stdin ? "true" : "false");
            request.AddQueryParameter("stdout", this.Stdout ? "true" : "false");
            request.AddQueryParameter("stderr", this.Stderr ? "true" : "false");
            request.AddQueryParameter("tty", this.Tty ? "true" : "false");
            request.AddQueryParameter("idleTimeout", this.IdleTimeout.ToString());
            if (this.Command != null && this.Command.Length > 0)
            {
                foreach (var cmd in this.Command)
                {
                    request.AddQueryParameter("command", cmd);
                }
            }



            return(request);
        }
        public RestRequest GenHttpRequest(FCConfig cfg)
        {
            this.Config  = cfg;
            this.Headers = this.BuildCommonHeaders("GET", this.GetPath(), this.Headers);
            var request = new RestRequest(this.GetPath(), Method.GET);

            foreach (var item in this.Headers)
            {
                request.AddHeader(item.Key, item.Value);
            }

            if (this.Limit > 0)
            {
                request.AddQueryParameter("limit", this.Limit.ToString());
            }
            if (!string.IsNullOrEmpty(this.Prefix))
            {
                request.AddQueryParameter("prefix", this.Prefix);
            }
            if (!string.IsNullOrEmpty(this.StartKey))
            {
                request.AddQueryParameter("startKey", this.StartKey);
            }
            if (!string.IsNullOrEmpty(this.NextToken))
            {
                request.AddQueryParameter("nextToken", this.NextToken);
            }

            return(request);
        }
        public RestRequest GenHttpRequest(FCConfig cfg)
        {
            this.Config  = cfg;
            this.Headers = this.BuildCommonHeaders("GET", this.GetPath(), this.Headers);
            var request = new RestRequest(this.GetPath(), Method.GET);

            foreach (var item in this.Headers)
            {
                request.AddHeader(item.Key, item.Value);
            }
            return(request);
        }
        public RestRequest GenHttpRequest(FCConfig cfg)
        {
            this.Config  = cfg;
            this.Headers = this.BuildCommonHeaders("DELETE", this.GetPath(), this.Headers);
            var request = new RestRequest(this.GetPath(), Method.DELETE);

            foreach (var item in this.Headers)
            {
                request.AddHeader(item.Key, item.Value);
            }

            request.AddJsonBody(JsonConvert.SerializeObject(this.UnTagInput));

            return(request);
        }
Пример #5
0
        public RestRequest GenHttpRequest(FCConfig cfg)
        {
            this.Config  = cfg;
            this.Headers = this.BuildCommonHeaders("PUT", this.GetPath(), this.Headers);
            var request = new RestRequest(this.GetPath(), Method.PUT);

            foreach (var item in this.Headers)
            {
                request.AddHeader(item.Key, item.Value);
            }

            request.AddJsonBody(JsonConvert.SerializeObject(this.UpdateCustomDomainMeta));

            return(request);
        }
        public RestRequest GenHttpRequest(FCConfig cfg)
        {
            this.Config  = cfg;
            this.Headers = this.BuildCommonHeaders("POST", this.GetPath(), this.Headers);
            var request = new RestRequest(this.GetPath(), Method.POST);

            foreach (var item in this.Headers)
            {
                request.AddHeader(item.Key, item.Value);
            }

            request.AddParameter("application/octet-stream", this.Payload, ParameterType.RequestBody);

            return(request);
        }
        public RestRequest GenHttpRequest(FCConfig cfg)
        {
            this.Config  = cfg;
            this.Headers = this.BuildCommonHeaders("POST", this.GetPath(), this.Headers);
            var request = new RestRequest(this.GetPath(), Method.POST);

            foreach (var item in this.Headers)
            {
                request.AddHeader(item.Key, item.Value);
            }


            var payLoad = new Dictionary <string, string> {
                { "description", this.Description }
            };

            request.AddJsonBody(payLoad);

            return(request);
        }
Пример #8
0
        public RestRequest GenHttpRequest(FCConfig cfg)
        {
            this.Config  = cfg;
            this.Headers = this.BuildCommonHeaders("GET", this.GetPath(), this.Headers);
            var request = new RestRequest(this.GetPath(), Method.GET);

            foreach (var item in this.Headers)
            {
                request.AddHeader(item.Key, item.Value);
            }

            if (this.Limit > 0)
            {
                request.AddQueryParameter("limit", this.Limit.ToString());
            }
            if (this.InstanceIds != null && this.InstanceIds.Length > 0)
            {
                request.AddQueryParameter("instanceIds", JsonConvert.SerializeObject(this.InstanceIds));
            }

            return(request);
        }
Пример #9
0
 public Authentication(FCConfig cfg)
 {
     this.Config = cfg;
 }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Aliyun.FunctionCompute.SDK.Client.FCClient"/> class.
 /// </summary>
 /// <param name="region">Region.</param>
 /// <param name="uid">Uid.</param>
 /// <param name="accessKeyId">Access key identifier.</param>
 /// <param name="accessKeySecret">Access key secret.</param>
 /// <param name="securityToken">Security token.</param>
 public FCClient(string region, string uid, string accessKeyId, string accessKeySecret, string securityToken = "")
 {
     Config         = new FCConfig(region, uid, accessKeyId, accessKeySecret, securityToken, false);
     RestHttpClient = new RestClient(Config.Endpoint);
 }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Aliyun.FunctionCompute.SDK.Client.FCClient"/> class.
 /// </summary>
 /// <param name="region">Region.</param>
 /// <param name="uid">Uid.</param>
 /// <param name="accessKeyId">Access key identifier.</param>
 /// <param name="accessKeySecret">Access key secret.</param>
 /// <param name="securityToken">Security token.</param>
 public FCClient(string region, string uid, string accessKeyId, string accessKeySecret, string securityToken = "")
 {
     Config                 = new FCConfig(region, uid, accessKeyId, accessKeySecret, securityToken, false);
     RestHttpClient         = new RestClient(Config.Endpoint);
     RestHttpClient.Timeout = 1800000; // 30min (unit: ms)
 }