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

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

            // populate SourceObjectReference
            var requestSourceObjectReferenceIsNull = true;

            request.SourceObjectReference = new Amazon.CloudDirectory.Model.ObjectReference();
            System.String requestSourceObjectReference_sourceObjectReference_Selector = null;
            if (cmdletContext.SourceObjectReference_Selector != null)
            {
                requestSourceObjectReference_sourceObjectReference_Selector = cmdletContext.SourceObjectReference_Selector;
            }
            if (requestSourceObjectReference_sourceObjectReference_Selector != null)
            {
                request.SourceObjectReference.Selector = requestSourceObjectReference_sourceObjectReference_Selector;
                requestSourceObjectReferenceIsNull     = false;
            }
            // determine if request.SourceObjectReference should be set to null
            if (requestSourceObjectReferenceIsNull)
            {
                request.SourceObjectReference = null;
            }

            // populate TargetObjectReference
            var requestTargetObjectReferenceIsNull = true;

            request.TargetObjectReference = new Amazon.CloudDirectory.Model.ObjectReference();
            System.String requestTargetObjectReference_targetObjectReference_Selector = null;
            if (cmdletContext.TargetObjectReference_Selector != null)
            {
                requestTargetObjectReference_targetObjectReference_Selector = cmdletContext.TargetObjectReference_Selector;
            }
            if (requestTargetObjectReference_targetObjectReference_Selector != null)
            {
                request.TargetObjectReference.Selector = requestTargetObjectReference_targetObjectReference_Selector;
                requestTargetObjectReferenceIsNull     = false;
            }
            // determine if request.TargetObjectReference should be set to null
            if (requestTargetObjectReferenceIsNull)
            {
                request.TargetObjectReference = null;
            }

            // populate TypedLinkFacet
            var requestTypedLinkFacetIsNull = true;

            request.TypedLinkFacet = new Amazon.CloudDirectory.Model.TypedLinkSchemaAndFacetName();
            System.String requestTypedLinkFacet_typedLinkFacet_SchemaArn = null;
            if (cmdletContext.TypedLinkFacet_SchemaArn != null)
            {
                requestTypedLinkFacet_typedLinkFacet_SchemaArn = cmdletContext.TypedLinkFacet_SchemaArn;
            }
            if (requestTypedLinkFacet_typedLinkFacet_SchemaArn != null)
            {
                request.TypedLinkFacet.SchemaArn = requestTypedLinkFacet_typedLinkFacet_SchemaArn;
                requestTypedLinkFacetIsNull      = false;
            }
            System.String requestTypedLinkFacet_typedLinkFacet_TypedLinkName = null;
            if (cmdletContext.TypedLinkFacet_TypedLinkName != null)
            {
                requestTypedLinkFacet_typedLinkFacet_TypedLinkName = cmdletContext.TypedLinkFacet_TypedLinkName;
            }
            if (requestTypedLinkFacet_typedLinkFacet_TypedLinkName != null)
            {
                request.TypedLinkFacet.TypedLinkName = requestTypedLinkFacet_typedLinkFacet_TypedLinkName;
                requestTypedLinkFacetIsNull          = false;
            }
            // determine if request.TypedLinkFacet should be set to null
            if (requestTypedLinkFacetIsNull)
            {
                request.TypedLinkFacet = 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);
        }