private Amazon.CloudFront.Model.UpdateKeyGroupResponse CallAWSServiceOperation(IAmazonCloudFront client, Amazon.CloudFront.Model.UpdateKeyGroupRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudFront", "UpdateKeyGroup"); try { #if DESKTOP return(client.UpdateKeyGroup(request)); #elif CORECLR return(client.UpdateKeyGroupAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.CloudFront.Model.UpdateKeyGroupRequest(); if (cmdletContext.Id != null) { request.Id = cmdletContext.Id; } if (cmdletContext.IfMatch != null) { request.IfMatch = cmdletContext.IfMatch; } // populate KeyGroupConfig var requestKeyGroupConfigIsNull = true; request.KeyGroupConfig = new Amazon.CloudFront.Model.KeyGroupConfig(); System.String requestKeyGroupConfig_keyGroupConfig_Comment = null; if (cmdletContext.KeyGroupConfig_Comment != null) { requestKeyGroupConfig_keyGroupConfig_Comment = cmdletContext.KeyGroupConfig_Comment; } if (requestKeyGroupConfig_keyGroupConfig_Comment != null) { request.KeyGroupConfig.Comment = requestKeyGroupConfig_keyGroupConfig_Comment; requestKeyGroupConfigIsNull = false; } List <System.String> requestKeyGroupConfig_keyGroupConfig_Item = null; if (cmdletContext.KeyGroupConfig_Item != null) { requestKeyGroupConfig_keyGroupConfig_Item = cmdletContext.KeyGroupConfig_Item; } if (requestKeyGroupConfig_keyGroupConfig_Item != null) { request.KeyGroupConfig.Items = requestKeyGroupConfig_keyGroupConfig_Item; requestKeyGroupConfigIsNull = false; } System.String requestKeyGroupConfig_keyGroupConfig_Name = null; if (cmdletContext.KeyGroupConfig_Name != null) { requestKeyGroupConfig_keyGroupConfig_Name = cmdletContext.KeyGroupConfig_Name; } if (requestKeyGroupConfig_keyGroupConfig_Name != null) { request.KeyGroupConfig.Name = requestKeyGroupConfig_keyGroupConfig_Name; requestKeyGroupConfigIsNull = false; } // determine if request.KeyGroupConfig should be set to null if (requestKeyGroupConfigIsNull) { request.KeyGroupConfig = null; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }