private Amazon.SSMIncidents.Model.UpdateRelatedItemsResponse CallAWSServiceOperation(IAmazonSSMIncidents client, Amazon.SSMIncidents.Model.UpdateRelatedItemsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Systems Manager Incident Manager", "UpdateRelatedItems");
     try
     {
         #if DESKTOP
         return(client.UpdateRelatedItems(request));
         #elif CORECLR
         return(client.UpdateRelatedItemsAsync(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.SSMIncidents.Model.UpdateRelatedItemsRequest();

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

            // populate RelatedItemsUpdate
            var requestRelatedItemsUpdateIsNull = true;

            request.RelatedItemsUpdate = new Amazon.SSMIncidents.Model.RelatedItemsUpdate();
            Amazon.SSMIncidents.Model.RelatedItem requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd = null;

            // populate ItemToAdd
            var requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAddIsNull = true;

            requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd = new Amazon.SSMIncidents.Model.RelatedItem();
            System.String requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_itemToAdd_Title = null;
            if (cmdletContext.ItemToAdd_Title != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_itemToAdd_Title = cmdletContext.ItemToAdd_Title;
            }
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_itemToAdd_Title != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd.Title = requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_itemToAdd_Title;
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAddIsNull = false;
            }
            Amazon.SSMIncidents.Model.ItemIdentifier requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier = null;

            // populate Identifier
            var requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_IdentifierIsNull = true;

            requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier = new Amazon.SSMIncidents.Model.ItemIdentifier();
            Amazon.SSMIncidents.ItemType requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_identifier_Type = null;
            if (cmdletContext.Identifier_Type != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_identifier_Type = cmdletContext.Identifier_Type;
            }
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_identifier_Type != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier.Type  = requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_identifier_Type;
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_IdentifierIsNull = false;
            }
            Amazon.SSMIncidents.Model.ItemValue requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value = null;

            // populate Value
            var requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_ValueIsNull = true;

            requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value = new Amazon.SSMIncidents.Model.ItemValue();
            System.String requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value_relatedItemsUpdate_ItemToAdd_Identifier_Value_Arn = null;
            if (cmdletContext.RelatedItemsUpdate_ItemToAdd_Identifier_Value_Arn != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value_relatedItemsUpdate_ItemToAdd_Identifier_Value_Arn = cmdletContext.RelatedItemsUpdate_ItemToAdd_Identifier_Value_Arn;
            }
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value_relatedItemsUpdate_ItemToAdd_Identifier_Value_Arn != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value.Arn   = requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value_relatedItemsUpdate_ItemToAdd_Identifier_Value_Arn;
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_ValueIsNull = false;
            }
            System.String requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value_relatedItemsUpdate_ItemToAdd_Identifier_Value_MetricDefinition = null;
            if (cmdletContext.RelatedItemsUpdate_ItemToAdd_Identifier_Value_MetricDefinition != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value_relatedItemsUpdate_ItemToAdd_Identifier_Value_MetricDefinition = cmdletContext.RelatedItemsUpdate_ItemToAdd_Identifier_Value_MetricDefinition;
            }
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value_relatedItemsUpdate_ItemToAdd_Identifier_Value_MetricDefinition != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value.MetricDefinition = requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value_relatedItemsUpdate_ItemToAdd_Identifier_Value_MetricDefinition;
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_ValueIsNull            = false;
            }
            System.String requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value_relatedItemsUpdate_ItemToAdd_Identifier_Value_Url = null;
            if (cmdletContext.RelatedItemsUpdate_ItemToAdd_Identifier_Value_Url != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value_relatedItemsUpdate_ItemToAdd_Identifier_Value_Url = cmdletContext.RelatedItemsUpdate_ItemToAdd_Identifier_Value_Url;
            }
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value_relatedItemsUpdate_ItemToAdd_Identifier_Value_Url != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value.Url   = requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value_relatedItemsUpdate_ItemToAdd_Identifier_Value_Url;
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_ValueIsNull = false;
            }
            // determine if requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value should be set to null
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_ValueIsNull)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value = null;
            }
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier.Value = requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier_relatedItemsUpdate_ItemToAdd_Identifier_Value;
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_IdentifierIsNull = false;
            }
            // determine if requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier should be set to null
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_IdentifierIsNull)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier = null;
            }
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd.Identifier = requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd_relatedItemsUpdate_ItemToAdd_Identifier;
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAddIsNull      = false;
            }
            // determine if requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd should be set to null
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAddIsNull)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd = null;
            }
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd != null)
            {
                request.RelatedItemsUpdate.ItemToAdd = requestRelatedItemsUpdate_relatedItemsUpdate_ItemToAdd;
                requestRelatedItemsUpdateIsNull      = false;
            }
            Amazon.SSMIncidents.Model.ItemIdentifier requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove = null;

            // populate ItemToRemove
            var requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemoveIsNull = true;

            requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove = new Amazon.SSMIncidents.Model.ItemIdentifier();
            Amazon.SSMIncidents.ItemType requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_itemToRemove_Type = null;
            if (cmdletContext.ItemToRemove_Type != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_itemToRemove_Type = cmdletContext.ItemToRemove_Type;
            }
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_itemToRemove_Type != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove.Type  = requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_itemToRemove_Type;
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemoveIsNull = false;
            }
            Amazon.SSMIncidents.Model.ItemValue requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value = null;

            // populate Value
            var requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_ValueIsNull = true;

            requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value = new Amazon.SSMIncidents.Model.ItemValue();
            System.String requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value_relatedItemsUpdate_ItemToRemove_Value_Arn = null;
            if (cmdletContext.RelatedItemsUpdate_ItemToRemove_Value_Arn != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value_relatedItemsUpdate_ItemToRemove_Value_Arn = cmdletContext.RelatedItemsUpdate_ItemToRemove_Value_Arn;
            }
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value_relatedItemsUpdate_ItemToRemove_Value_Arn != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value.Arn   = requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value_relatedItemsUpdate_ItemToRemove_Value_Arn;
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_ValueIsNull = false;
            }
            System.String requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value_relatedItemsUpdate_ItemToRemove_Value_MetricDefinition = null;
            if (cmdletContext.RelatedItemsUpdate_ItemToRemove_Value_MetricDefinition != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value_relatedItemsUpdate_ItemToRemove_Value_MetricDefinition = cmdletContext.RelatedItemsUpdate_ItemToRemove_Value_MetricDefinition;
            }
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value_relatedItemsUpdate_ItemToRemove_Value_MetricDefinition != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value.MetricDefinition = requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value_relatedItemsUpdate_ItemToRemove_Value_MetricDefinition;
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_ValueIsNull            = false;
            }
            System.String requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value_relatedItemsUpdate_ItemToRemove_Value_Url = null;
            if (cmdletContext.RelatedItemsUpdate_ItemToRemove_Value_Url != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value_relatedItemsUpdate_ItemToRemove_Value_Url = cmdletContext.RelatedItemsUpdate_ItemToRemove_Value_Url;
            }
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value_relatedItemsUpdate_ItemToRemove_Value_Url != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value.Url   = requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value_relatedItemsUpdate_ItemToRemove_Value_Url;
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_ValueIsNull = false;
            }
            // determine if requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value should be set to null
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_ValueIsNull)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value = null;
            }
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value != null)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove.Value = requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove_relatedItemsUpdate_ItemToRemove_Value;
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemoveIsNull = false;
            }
            // determine if requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove should be set to null
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemoveIsNull)
            {
                requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove = null;
            }
            if (requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove != null)
            {
                request.RelatedItemsUpdate.ItemToRemove = requestRelatedItemsUpdate_relatedItemsUpdate_ItemToRemove;
                requestRelatedItemsUpdateIsNull         = false;
            }
            // determine if request.RelatedItemsUpdate should be set to null
            if (requestRelatedItemsUpdateIsNull)
            {
                request.RelatedItemsUpdate = 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);
        }