/// <summary> /// 修改函数版本别名信息。 /// </summary> public async Task <UpdateVersionAliasResponse> UpdateVersionAliasAsync(UpdateVersionAliasRequest updateVersionAliasRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("function_urn", updateVersionAliasRequest.FunctionUrn.ToString()); urlParam.Add("alias_name", updateVersionAliasRequest.AliasName.ToString()); string urlPath = HttpUtils.AddUrlPath("/v2/{project_id}/fgs/functions/{function_urn}/aliases/{alias_name}", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json", updateVersionAliasRequest); HttpResponseMessage response = await DoHttpRequestAsync("PUT", request); return(JsonUtils.DeSerialize <UpdateVersionAliasResponse>(response)); }
/// <summary> /// 修改函数版本别名信息 /// </summary> public static void UpdateVersionAlias(FunctionGraphClient client) { Dictionary <string, int?> addtionalVersionWeights = new Dictionary <string, int?>(); addtionalVersionWeights.Add("v1", 20); UpdateVersionAliasRequest req = new UpdateVersionAliasRequest { FunctionUrn = "urn:fss:cn-north-7:46b6f338fc3445b8846c71dfb1fbd9e8:function:CsharpSdkTest:csharpSdkTest:latest", Name = "a1", Body = new UpdateVersionAliasRequestBody { Version = "latest", Description = "修改函数版本别名a1", AdditionalVersionWeights = addtionalVersionWeights } }; try { UpdateVersionAliasResponse resp = client.UpdateVersionAlias(req); Console.WriteLine("UpdateVersionAlias Body=" + JsonConvert.SerializeObject(resp)); Console.WriteLine("name=" + resp.Name); Console.WriteLine("version=" + resp.Version); Console.WriteLine("UpdateVersionAlias 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; } }