/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DeleteParametersResponse response = new DeleteParametersResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("DeletedParameters", targetDepth)) { var unmarshaller = new ListUnmarshaller <string, StringUnmarshaller>(StringUnmarshaller.Instance); response.DeletedParameters = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("InvalidParameters", targetDepth)) { var unmarshaller = new ListUnmarshaller <string, StringUnmarshaller>(StringUnmarshaller.Instance); response.InvalidParameters = unmarshaller.Unmarshall(context); continue; } } return(response); }
/// <summary> /// Deletes the specified parameters. /// </summary> /// <param name="names">The names of the parameters to delete.</param> /// <param name="credentials">AWS credentials.</param> /// <returns>A task that represents the asynchronous deletion operation.</returns> /// <exception cref="ParameterOperationException">One or more parameters could not be deleted.</exception> public static async Task DeleteParameters(ICollection <string> names, Credentials credentials) { Console.WriteLine("Deleting SSM parameters..."); if (!names.Any()) { return; } DeleteParametersResponse result = await GetClient(credentials).DeleteParametersAsync(new DeleteParametersRequest { Names = names.ToList() }); foreach (string parameter in result.DeletedParameters) { Console.WriteLine($"{parameter}"); } if (result.InvalidParameters.Any()) { throw new ParameterOperationException("Unable to delete invalid SSM parameters: " + string.Join(", ", result.InvalidParameters)); } }