private Amazon.DataSync.Model.CreateLocationHdfsResponse CallAWSServiceOperation(IAmazonDataSync client, Amazon.DataSync.Model.CreateLocationHdfsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS DataSync", "CreateLocationHdfs"); try { #if DESKTOP return(client.CreateLocationHdfs(request)); #elif CORECLR return(client.CreateLocationHdfsAsync(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) { System.IO.MemoryStream _KerberosKeytabStream = null; System.IO.MemoryStream _KerberosKrb5ConfStream = null; try { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.DataSync.Model.CreateLocationHdfsRequest(); if (cmdletContext.AgentArn != null) { request.AgentArns = cmdletContext.AgentArn; } if (cmdletContext.AuthenticationType != null) { request.AuthenticationType = cmdletContext.AuthenticationType; } if (cmdletContext.BlockSize != null) { request.BlockSize = cmdletContext.BlockSize.Value; } if (cmdletContext.KerberosKeytab != null) { _KerberosKeytabStream = new System.IO.MemoryStream(cmdletContext.KerberosKeytab); request.KerberosKeytab = _KerberosKeytabStream; } if (cmdletContext.KerberosKrb5Conf != null) { _KerberosKrb5ConfStream = new System.IO.MemoryStream(cmdletContext.KerberosKrb5Conf); request.KerberosKrb5Conf = _KerberosKrb5ConfStream; } if (cmdletContext.KerberosPrincipal != null) { request.KerberosPrincipal = cmdletContext.KerberosPrincipal; } if (cmdletContext.KmsKeyProviderUri != null) { request.KmsKeyProviderUri = cmdletContext.KmsKeyProviderUri; } if (cmdletContext.NameNode != null) { request.NameNodes = cmdletContext.NameNode; } // populate QopConfiguration var requestQopConfigurationIsNull = true; request.QopConfiguration = new Amazon.DataSync.Model.QopConfiguration(); Amazon.DataSync.HdfsDataTransferProtection requestQopConfiguration_qopConfiguration_DataTransferProtection = null; if (cmdletContext.QopConfiguration_DataTransferProtection != null) { requestQopConfiguration_qopConfiguration_DataTransferProtection = cmdletContext.QopConfiguration_DataTransferProtection; } if (requestQopConfiguration_qopConfiguration_DataTransferProtection != null) { request.QopConfiguration.DataTransferProtection = requestQopConfiguration_qopConfiguration_DataTransferProtection; requestQopConfigurationIsNull = false; } Amazon.DataSync.HdfsRpcProtection requestQopConfiguration_qopConfiguration_RpcProtection = null; if (cmdletContext.QopConfiguration_RpcProtection != null) { requestQopConfiguration_qopConfiguration_RpcProtection = cmdletContext.QopConfiguration_RpcProtection; } if (requestQopConfiguration_qopConfiguration_RpcProtection != null) { request.QopConfiguration.RpcProtection = requestQopConfiguration_qopConfiguration_RpcProtection; requestQopConfigurationIsNull = false; } // determine if request.QopConfiguration should be set to null if (requestQopConfigurationIsNull) { request.QopConfiguration = null; } if (cmdletContext.ReplicationFactor != null) { request.ReplicationFactor = cmdletContext.ReplicationFactor.Value; } if (cmdletContext.SimpleUser != null) { request.SimpleUser = cmdletContext.SimpleUser; } if (cmdletContext.Subdirectory != null) { request.Subdirectory = cmdletContext.Subdirectory; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } 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); } finally { if (_KerberosKeytabStream != null) { _KerberosKeytabStream.Dispose(); } if (_KerberosKrb5ConfStream != null) { _KerberosKrb5ConfStream.Dispose(); } } }