private Amazon.CloudFront.Model.CreateKeyGroupResponse CallAWSServiceOperation(IAmazonCloudFront client, Amazon.CloudFront.Model.CreateKeyGroupRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudFront", "CreateKeyGroup"); try { #if DESKTOP return(client.CreateKeyGroup(request)); #elif CORECLR return(client.CreateKeyGroupAsync(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.CreateKeyGroupRequest(); // 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); }