private Amazon.MediaPackage.Model.CreateOriginEndpointResponse CallAWSServiceOperation(IAmazonMediaPackage client, Amazon.MediaPackage.Model.CreateOriginEndpointRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Elemental MediaPackage", "CreateOriginEndpoint"); try { #if DESKTOP return(client.CreateOriginEndpoint(request)); #elif CORECLR return(client.CreateOriginEndpointAsync(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.MediaPackage.Model.CreateOriginEndpointRequest(); if (cmdletContext.ChannelId != null) { request.ChannelId = cmdletContext.ChannelId; } // populate CmafPackage var requestCmafPackageIsNull = true; request.CmafPackage = new Amazon.MediaPackage.Model.CmafPackageCreateOrUpdateParameters(); List <Amazon.MediaPackage.Model.HlsManifestCreateOrUpdateParameters> requestCmafPackage_cmafPackage_HlsManifest = null; if (cmdletContext.CmafPackage_HlsManifest != null) { requestCmafPackage_cmafPackage_HlsManifest = cmdletContext.CmafPackage_HlsManifest; } if (requestCmafPackage_cmafPackage_HlsManifest != null) { request.CmafPackage.HlsManifests = requestCmafPackage_cmafPackage_HlsManifest; requestCmafPackageIsNull = false; } System.Int32?requestCmafPackage_cmafPackage_SegmentDurationSecond = null; if (cmdletContext.CmafPackage_SegmentDurationSecond != null) { requestCmafPackage_cmafPackage_SegmentDurationSecond = cmdletContext.CmafPackage_SegmentDurationSecond.Value; } if (requestCmafPackage_cmafPackage_SegmentDurationSecond != null) { request.CmafPackage.SegmentDurationSeconds = requestCmafPackage_cmafPackage_SegmentDurationSecond.Value; requestCmafPackageIsNull = false; } System.String requestCmafPackage_cmafPackage_SegmentPrefix = null; if (cmdletContext.CmafPackage_SegmentPrefix != null) { requestCmafPackage_cmafPackage_SegmentPrefix = cmdletContext.CmafPackage_SegmentPrefix; } if (requestCmafPackage_cmafPackage_SegmentPrefix != null) { request.CmafPackage.SegmentPrefix = requestCmafPackage_cmafPackage_SegmentPrefix; requestCmafPackageIsNull = false; } Amazon.MediaPackage.Model.CmafEncryption requestCmafPackage_cmafPackage_Encryption = null; // populate Encryption var requestCmafPackage_cmafPackage_EncryptionIsNull = true; requestCmafPackage_cmafPackage_Encryption = new Amazon.MediaPackage.Model.CmafEncryption(); System.Int32?requestCmafPackage_cmafPackage_Encryption_encryption_KeyRotationIntervalSecond = null; if (cmdletContext.Encryption_KeyRotationIntervalSecond != null) { requestCmafPackage_cmafPackage_Encryption_encryption_KeyRotationIntervalSecond = cmdletContext.Encryption_KeyRotationIntervalSecond.Value; } if (requestCmafPackage_cmafPackage_Encryption_encryption_KeyRotationIntervalSecond != null) { requestCmafPackage_cmafPackage_Encryption.KeyRotationIntervalSeconds = requestCmafPackage_cmafPackage_Encryption_encryption_KeyRotationIntervalSecond.Value; requestCmafPackage_cmafPackage_EncryptionIsNull = false; } Amazon.MediaPackage.Model.SpekeKeyProvider requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider = null; // populate SpekeKeyProvider var requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProviderIsNull = true; requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider = new Amazon.MediaPackage.Model.SpekeKeyProvider(); System.String requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_CertificateArn = null; if (cmdletContext.SpekeKeyProvider_CertificateArn != null) { requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_CertificateArn = cmdletContext.SpekeKeyProvider_CertificateArn; } if (requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_CertificateArn != null) { requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider.CertificateArn = requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_CertificateArn; requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProviderIsNull = false; } System.String requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_ResourceId = null; if (cmdletContext.SpekeKeyProvider_ResourceId != null) { requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_ResourceId = cmdletContext.SpekeKeyProvider_ResourceId; } if (requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_ResourceId != null) { requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider.ResourceId = requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_ResourceId; requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProviderIsNull = false; } System.String requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_RoleArn = null; if (cmdletContext.SpekeKeyProvider_RoleArn != null) { requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_RoleArn = cmdletContext.SpekeKeyProvider_RoleArn; } if (requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_RoleArn != null) { requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider.RoleArn = requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_RoleArn; requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProviderIsNull = false; } List <System.String> requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_SystemId = null; if (cmdletContext.SpekeKeyProvider_SystemId != null) { requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_SystemId = cmdletContext.SpekeKeyProvider_SystemId; } if (requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_SystemId != null) { requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider.SystemIds = requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_SystemId; requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProviderIsNull = false; } System.String requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_Url = null; if (cmdletContext.SpekeKeyProvider_Url != null) { requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_Url = cmdletContext.SpekeKeyProvider_Url; } if (requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_Url != null) { requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider.Url = requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider_spekeKeyProvider_Url; requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProviderIsNull = false; } // determine if requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider should be set to null if (requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProviderIsNull) { requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider = null; } if (requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider != null) { requestCmafPackage_cmafPackage_Encryption.SpekeKeyProvider = requestCmafPackage_cmafPackage_Encryption_cmafPackage_Encryption_SpekeKeyProvider; requestCmafPackage_cmafPackage_EncryptionIsNull = false; } // determine if requestCmafPackage_cmafPackage_Encryption should be set to null if (requestCmafPackage_cmafPackage_EncryptionIsNull) { requestCmafPackage_cmafPackage_Encryption = null; } if (requestCmafPackage_cmafPackage_Encryption != null) { request.CmafPackage.Encryption = requestCmafPackage_cmafPackage_Encryption; requestCmafPackageIsNull = false; } Amazon.MediaPackage.Model.StreamSelection requestCmafPackage_cmafPackage_StreamSelection = null; // populate StreamSelection var requestCmafPackage_cmafPackage_StreamSelectionIsNull = true; requestCmafPackage_cmafPackage_StreamSelection = new Amazon.MediaPackage.Model.StreamSelection(); System.Int32?requestCmafPackage_cmafPackage_StreamSelection_streamSelection_MaxVideoBitsPerSecond = null; if (cmdletContext.StreamSelection_MaxVideoBitsPerSecond != null) { requestCmafPackage_cmafPackage_StreamSelection_streamSelection_MaxVideoBitsPerSecond = cmdletContext.StreamSelection_MaxVideoBitsPerSecond.Value; } if (requestCmafPackage_cmafPackage_StreamSelection_streamSelection_MaxVideoBitsPerSecond != null) { requestCmafPackage_cmafPackage_StreamSelection.MaxVideoBitsPerSecond = requestCmafPackage_cmafPackage_StreamSelection_streamSelection_MaxVideoBitsPerSecond.Value; requestCmafPackage_cmafPackage_StreamSelectionIsNull = false; } System.Int32?requestCmafPackage_cmafPackage_StreamSelection_streamSelection_MinVideoBitsPerSecond = null; if (cmdletContext.StreamSelection_MinVideoBitsPerSecond != null) { requestCmafPackage_cmafPackage_StreamSelection_streamSelection_MinVideoBitsPerSecond = cmdletContext.StreamSelection_MinVideoBitsPerSecond.Value; } if (requestCmafPackage_cmafPackage_StreamSelection_streamSelection_MinVideoBitsPerSecond != null) { requestCmafPackage_cmafPackage_StreamSelection.MinVideoBitsPerSecond = requestCmafPackage_cmafPackage_StreamSelection_streamSelection_MinVideoBitsPerSecond.Value; requestCmafPackage_cmafPackage_StreamSelectionIsNull = false; } Amazon.MediaPackage.StreamOrder requestCmafPackage_cmafPackage_StreamSelection_streamSelection_StreamOrder = null; if (cmdletContext.StreamSelection_StreamOrder != null) { requestCmafPackage_cmafPackage_StreamSelection_streamSelection_StreamOrder = cmdletContext.StreamSelection_StreamOrder; } if (requestCmafPackage_cmafPackage_StreamSelection_streamSelection_StreamOrder != null) { requestCmafPackage_cmafPackage_StreamSelection.StreamOrder = requestCmafPackage_cmafPackage_StreamSelection_streamSelection_StreamOrder; requestCmafPackage_cmafPackage_StreamSelectionIsNull = false; } // determine if requestCmafPackage_cmafPackage_StreamSelection should be set to null if (requestCmafPackage_cmafPackage_StreamSelectionIsNull) { requestCmafPackage_cmafPackage_StreamSelection = null; } if (requestCmafPackage_cmafPackage_StreamSelection != null) { request.CmafPackage.StreamSelection = requestCmafPackage_cmafPackage_StreamSelection; requestCmafPackageIsNull = false; } // determine if request.CmafPackage should be set to null if (requestCmafPackageIsNull) { request.CmafPackage = null; } if (cmdletContext.DashPackage != null) { request.DashPackage = cmdletContext.DashPackage; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.HlsPackage != null) { request.HlsPackage = cmdletContext.HlsPackage; } if (cmdletContext.Id != null) { request.Id = cmdletContext.Id; } if (cmdletContext.ManifestName != null) { request.ManifestName = cmdletContext.ManifestName; } if (cmdletContext.MssPackage != null) { request.MssPackage = cmdletContext.MssPackage; } if (cmdletContext.Origination != null) { request.Origination = cmdletContext.Origination; } if (cmdletContext.StartoverWindowSecond != null) { request.StartoverWindowSeconds = cmdletContext.StartoverWindowSecond.Value; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.TimeDelaySecond != null) { request.TimeDelaySeconds = cmdletContext.TimeDelaySecond.Value; } if (cmdletContext.Whitelist != null) { request.Whitelist = cmdletContext.Whitelist; } 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); }