Ejemplo n.º 1
0
 private Amazon.CloudDirectory.Model.DetachFromIndexResponse CallAWSServiceOperation(IAmazonCloudDirectory client, Amazon.CloudDirectory.Model.DetachFromIndexRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Cloud Directory", "DetachFromIndex");
     try
     {
         #if DESKTOP
         return(client.DetachFromIndex(request));
         #elif CORECLR
         return(client.DetachFromIndexAsync(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;
     }
 }
Ejemplo n.º 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.CloudDirectory.Model.DetachFromIndexRequest();

            if (cmdletContext.DirectoryArn != null)
            {
                request.DirectoryArn = cmdletContext.DirectoryArn;
            }

            // populate IndexReference
            var requestIndexReferenceIsNull = true;

            request.IndexReference = new Amazon.CloudDirectory.Model.ObjectReference();
            System.String requestIndexReference_indexReference_Selector = null;
            if (cmdletContext.IndexReference_Selector != null)
            {
                requestIndexReference_indexReference_Selector = cmdletContext.IndexReference_Selector;
            }
            if (requestIndexReference_indexReference_Selector != null)
            {
                request.IndexReference.Selector = requestIndexReference_indexReference_Selector;
                requestIndexReferenceIsNull     = false;
            }
            // determine if request.IndexReference should be set to null
            if (requestIndexReferenceIsNull)
            {
                request.IndexReference = null;
            }

            // populate TargetReference
            var requestTargetReferenceIsNull = true;

            request.TargetReference = new Amazon.CloudDirectory.Model.ObjectReference();
            System.String requestTargetReference_targetReference_Selector = null;
            if (cmdletContext.TargetReference_Selector != null)
            {
                requestTargetReference_targetReference_Selector = cmdletContext.TargetReference_Selector;
            }
            if (requestTargetReference_targetReference_Selector != null)
            {
                request.TargetReference.Selector = requestTargetReference_targetReference_Selector;
                requestTargetReferenceIsNull     = false;
            }
            // determine if request.TargetReference should be set to null
            if (requestTargetReferenceIsNull)
            {
                request.TargetReference = 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);
        }