/// <summary>
        /// 删除函数版本别名
        /// </summary>
        public static void DeleteVersionAlias(FunctionGraphClient client)
        {
            DeleteVersionAliasRequest req = new DeleteVersionAliasRequest
            {
                FunctionUrn = "urn:fss:cn-north-7:46b6f338fc3445b8846c71dfb1fbd9e8:function:CsharpSdkTest:csharpSdkTest:latest",
                Name        = "a1",
            };

            try
            {
                DeleteVersionAliasResponse resp = client.DeleteVersionAlias(req);
                Console.WriteLine("DeleteVersionAlias StatusCode=" + resp.HttpStatusCode);
            }
            catch (ClientRequestException e)
            {
                Console.WriteLine(e.HttpStatusCode);
                Console.WriteLine(e.ErrorCode);
                Console.WriteLine(e.ErrorMsg);
            }
            catch (ConnectionException e)
            {
                Console.WriteLine(e.ErrorMessage);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 删除函数版本别名。
        /// </summary>
        public async Task <DeleteVersionAliasResponse> DeleteVersionAliasAsync(DeleteVersionAliasRequest deleteVersionAliasRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("function_urn", deleteVersionAliasRequest.FunctionUrn.ToString());
            urlParam.Add("alias_name", deleteVersionAliasRequest.AliasName.ToString());
            string              urlPath  = HttpUtils.AddUrlPath("/v2/{project_id}/fgs/functions/{function_urn}/aliases/{alias_name}", urlParam);
            SdkRequest          request  = HttpUtils.InitSdkRequest(urlPath, "application/json", deleteVersionAliasRequest);
            HttpResponseMessage response = await DoHttpRequestAsync("DELETE", request);

            return(JsonUtils.DeSerializeNull <DeleteVersionAliasResponse>(response));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 删除函数版本别名。
        /// </summary>
        public DeleteVersionAliasResponse DeleteVersionAlias(DeleteVersionAliasRequest deleteVersionAliasRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("function_urn", deleteVersionAliasRequest.FunctionUrn.ToString());
            urlParam.Add("name", deleteVersionAliasRequest.Name.ToString());
            string      urlPath  = HttpUtils.AddUrlPath("/v2/{project_id}/fgs/functions/{function_urn}/aliases/{name}", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, deleteVersionAliasRequest);
            SdkResponse response = DoHttpRequest("DELETE", request);

            return(JsonUtils.DeSerializeNull <DeleteVersionAliasResponse>(response));
        }