Exemple #1
0
 private Amazon.EC2.Model.DeregisterInstanceEventNotificationAttributesResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.DeregisterInstanceEventNotificationAttributesRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "DeregisterInstanceEventNotificationAttributes");
     try
     {
         #if DESKTOP
         return(client.DeregisterInstanceEventNotificationAttributes(request));
         #elif CORECLR
         return(client.DeregisterInstanceEventNotificationAttributesAsync(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.EC2.Model.DeregisterInstanceEventNotificationAttributesRequest();


            // populate InstanceTagAttribute
            var requestInstanceTagAttributeIsNull = true;

            request.InstanceTagAttribute = new Amazon.EC2.Model.DeregisterInstanceTagAttributeRequest();
            System.Boolean?requestInstanceTagAttribute_instanceTagAttribute_IncludeAllTagsOfInstance = null;
            if (cmdletContext.InstanceTagAttribute_IncludeAllTagsOfInstance != null)
            {
                requestInstanceTagAttribute_instanceTagAttribute_IncludeAllTagsOfInstance = cmdletContext.InstanceTagAttribute_IncludeAllTagsOfInstance.Value;
            }
            if (requestInstanceTagAttribute_instanceTagAttribute_IncludeAllTagsOfInstance != null)
            {
                request.InstanceTagAttribute.IncludeAllTagsOfInstance = requestInstanceTagAttribute_instanceTagAttribute_IncludeAllTagsOfInstance.Value;
                requestInstanceTagAttributeIsNull = false;
            }
            List <System.String> requestInstanceTagAttribute_instanceTagAttribute_InstanceTagKey = null;

            if (cmdletContext.InstanceTagAttribute_InstanceTagKey != null)
            {
                requestInstanceTagAttribute_instanceTagAttribute_InstanceTagKey = cmdletContext.InstanceTagAttribute_InstanceTagKey;
            }
            if (requestInstanceTagAttribute_instanceTagAttribute_InstanceTagKey != null)
            {
                request.InstanceTagAttribute.InstanceTagKeys = requestInstanceTagAttribute_instanceTagAttribute_InstanceTagKey;
                requestInstanceTagAttributeIsNull            = false;
            }
            // determine if request.InstanceTagAttribute should be set to null
            if (requestInstanceTagAttributeIsNull)
            {
                request.InstanceTagAttribute = 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);
        }