private Amazon.LocationService.Model.PutGeofenceResponse CallAWSServiceOperation(IAmazonLocationService client, Amazon.LocationService.Model.PutGeofenceRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Location Service", "PutGeofence");
     try
     {
         #if DESKTOP
         return(client.PutGeofence(request));
         #elif CORECLR
         return(client.PutGeofenceAsync(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.LocationService.Model.PutGeofenceRequest();

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

            // populate Geometry
            var requestGeometryIsNull = true;

            request.Geometry = new Amazon.LocationService.Model.GeofenceGeometry();
            List <List <List <System.Double> > > requestGeometry_geometry_Polygon = null;

            if (cmdletContext.Geometry_Polygon != null)
            {
                requestGeometry_geometry_Polygon = cmdletContext.Geometry_Polygon;
            }
            if (requestGeometry_geometry_Polygon != null)
            {
                request.Geometry.Polygon = requestGeometry_geometry_Polygon;
                requestGeometryIsNull    = false;
            }
            // determine if request.Geometry should be set to null
            if (requestGeometryIsNull)
            {
                request.Geometry = 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);
        }