예제 #1
0
 private Amazon.IoTWireless.Model.CreateDeviceProfileResponse CallAWSServiceOperation(IAmazonIoTWireless client, Amazon.IoTWireless.Model.CreateDeviceProfileRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS IoT Wireless", "CreateDeviceProfile");
     try
     {
         #if DESKTOP
         return(client.CreateDeviceProfile(request));
         #elif CORECLR
         return(client.CreateDeviceProfileAsync(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;
     }
 }
예제 #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.IoTWireless.Model.CreateDeviceProfileRequest();

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

            // populate LoRaWAN
            var requestLoRaWANIsNull = true;

            request.LoRaWAN = new Amazon.IoTWireless.Model.LoRaWANDeviceProfile();
            System.Int32?requestLoRaWAN_loRaWAN_ClassBTimeout = null;
            if (cmdletContext.LoRaWAN_ClassBTimeout != null)
            {
                requestLoRaWAN_loRaWAN_ClassBTimeout = cmdletContext.LoRaWAN_ClassBTimeout.Value;
            }
            if (requestLoRaWAN_loRaWAN_ClassBTimeout != null)
            {
                request.LoRaWAN.ClassBTimeout = requestLoRaWAN_loRaWAN_ClassBTimeout.Value;
                requestLoRaWANIsNull          = false;
            }
            System.Int32?requestLoRaWAN_loRaWAN_ClassCTimeout = null;
            if (cmdletContext.LoRaWAN_ClassCTimeout != null)
            {
                requestLoRaWAN_loRaWAN_ClassCTimeout = cmdletContext.LoRaWAN_ClassCTimeout.Value;
            }
            if (requestLoRaWAN_loRaWAN_ClassCTimeout != null)
            {
                request.LoRaWAN.ClassCTimeout = requestLoRaWAN_loRaWAN_ClassCTimeout.Value;
                requestLoRaWANIsNull          = false;
            }
            List <System.Int32> requestLoRaWAN_loRaWAN_FactoryPresetFreqsList = null;

            if (cmdletContext.LoRaWAN_FactoryPresetFreqsList != null)
            {
                requestLoRaWAN_loRaWAN_FactoryPresetFreqsList = cmdletContext.LoRaWAN_FactoryPresetFreqsList;
            }
            if (requestLoRaWAN_loRaWAN_FactoryPresetFreqsList != null)
            {
                request.LoRaWAN.FactoryPresetFreqsList = requestLoRaWAN_loRaWAN_FactoryPresetFreqsList;
                requestLoRaWANIsNull = false;
            }
            System.String requestLoRaWAN_loRaWAN_MacVersion = null;
            if (cmdletContext.LoRaWAN_MacVersion != null)
            {
                requestLoRaWAN_loRaWAN_MacVersion = cmdletContext.LoRaWAN_MacVersion;
            }
            if (requestLoRaWAN_loRaWAN_MacVersion != null)
            {
                request.LoRaWAN.MacVersion = requestLoRaWAN_loRaWAN_MacVersion;
                requestLoRaWANIsNull       = false;
            }
            System.Int32?requestLoRaWAN_loRaWAN_MaxDutyCycle = null;
            if (cmdletContext.LoRaWAN_MaxDutyCycle != null)
            {
                requestLoRaWAN_loRaWAN_MaxDutyCycle = cmdletContext.LoRaWAN_MaxDutyCycle.Value;
            }
            if (requestLoRaWAN_loRaWAN_MaxDutyCycle != null)
            {
                request.LoRaWAN.MaxDutyCycle = requestLoRaWAN_loRaWAN_MaxDutyCycle.Value;
                requestLoRaWANIsNull         = false;
            }
            System.Int32?requestLoRaWAN_loRaWAN_MaxEirp = null;
            if (cmdletContext.LoRaWAN_MaxEirp != null)
            {
                requestLoRaWAN_loRaWAN_MaxEirp = cmdletContext.LoRaWAN_MaxEirp.Value;
            }
            if (requestLoRaWAN_loRaWAN_MaxEirp != null)
            {
                request.LoRaWAN.MaxEirp = requestLoRaWAN_loRaWAN_MaxEirp.Value;
                requestLoRaWANIsNull    = false;
            }
            System.Int32?requestLoRaWAN_loRaWAN_PingSlotDr = null;
            if (cmdletContext.LoRaWAN_PingSlotDr != null)
            {
                requestLoRaWAN_loRaWAN_PingSlotDr = cmdletContext.LoRaWAN_PingSlotDr.Value;
            }
            if (requestLoRaWAN_loRaWAN_PingSlotDr != null)
            {
                request.LoRaWAN.PingSlotDr = requestLoRaWAN_loRaWAN_PingSlotDr.Value;
                requestLoRaWANIsNull       = false;
            }
            System.Int32?requestLoRaWAN_loRaWAN_PingSlotFreq = null;
            if (cmdletContext.LoRaWAN_PingSlotFreq != null)
            {
                requestLoRaWAN_loRaWAN_PingSlotFreq = cmdletContext.LoRaWAN_PingSlotFreq.Value;
            }
            if (requestLoRaWAN_loRaWAN_PingSlotFreq != null)
            {
                request.LoRaWAN.PingSlotFreq = requestLoRaWAN_loRaWAN_PingSlotFreq.Value;
                requestLoRaWANIsNull         = false;
            }
            System.Int32?requestLoRaWAN_loRaWAN_PingSlotPeriod = null;
            if (cmdletContext.LoRaWAN_PingSlotPeriod != null)
            {
                requestLoRaWAN_loRaWAN_PingSlotPeriod = cmdletContext.LoRaWAN_PingSlotPeriod.Value;
            }
            if (requestLoRaWAN_loRaWAN_PingSlotPeriod != null)
            {
                request.LoRaWAN.PingSlotPeriod = requestLoRaWAN_loRaWAN_PingSlotPeriod.Value;
                requestLoRaWANIsNull           = false;
            }
            System.String requestLoRaWAN_loRaWAN_RegParamsRevision = null;
            if (cmdletContext.LoRaWAN_RegParamsRevision != null)
            {
                requestLoRaWAN_loRaWAN_RegParamsRevision = cmdletContext.LoRaWAN_RegParamsRevision;
            }
            if (requestLoRaWAN_loRaWAN_RegParamsRevision != null)
            {
                request.LoRaWAN.RegParamsRevision = requestLoRaWAN_loRaWAN_RegParamsRevision;
                requestLoRaWANIsNull = false;
            }
            System.String requestLoRaWAN_loRaWAN_RfRegion = null;
            if (cmdletContext.LoRaWAN_RfRegion != null)
            {
                requestLoRaWAN_loRaWAN_RfRegion = cmdletContext.LoRaWAN_RfRegion;
            }
            if (requestLoRaWAN_loRaWAN_RfRegion != null)
            {
                request.LoRaWAN.RfRegion = requestLoRaWAN_loRaWAN_RfRegion;
                requestLoRaWANIsNull     = false;
            }
            System.Int32?requestLoRaWAN_loRaWAN_RxDataRate2 = null;
            if (cmdletContext.LoRaWAN_RxDataRate2 != null)
            {
                requestLoRaWAN_loRaWAN_RxDataRate2 = cmdletContext.LoRaWAN_RxDataRate2.Value;
            }
            if (requestLoRaWAN_loRaWAN_RxDataRate2 != null)
            {
                request.LoRaWAN.RxDataRate2 = requestLoRaWAN_loRaWAN_RxDataRate2.Value;
                requestLoRaWANIsNull        = false;
            }
            System.Int32?requestLoRaWAN_loRaWAN_RxDelay1 = null;
            if (cmdletContext.LoRaWAN_RxDelay1 != null)
            {
                requestLoRaWAN_loRaWAN_RxDelay1 = cmdletContext.LoRaWAN_RxDelay1.Value;
            }
            if (requestLoRaWAN_loRaWAN_RxDelay1 != null)
            {
                request.LoRaWAN.RxDelay1 = requestLoRaWAN_loRaWAN_RxDelay1.Value;
                requestLoRaWANIsNull     = false;
            }
            System.Int32?requestLoRaWAN_loRaWAN_RxDrOffset1 = null;
            if (cmdletContext.LoRaWAN_RxDrOffset1 != null)
            {
                requestLoRaWAN_loRaWAN_RxDrOffset1 = cmdletContext.LoRaWAN_RxDrOffset1.Value;
            }
            if (requestLoRaWAN_loRaWAN_RxDrOffset1 != null)
            {
                request.LoRaWAN.RxDrOffset1 = requestLoRaWAN_loRaWAN_RxDrOffset1.Value;
                requestLoRaWANIsNull        = false;
            }
            System.Int32?requestLoRaWAN_loRaWAN_RxFreq2 = null;
            if (cmdletContext.LoRaWAN_RxFreq2 != null)
            {
                requestLoRaWAN_loRaWAN_RxFreq2 = cmdletContext.LoRaWAN_RxFreq2.Value;
            }
            if (requestLoRaWAN_loRaWAN_RxFreq2 != null)
            {
                request.LoRaWAN.RxFreq2 = requestLoRaWAN_loRaWAN_RxFreq2.Value;
                requestLoRaWANIsNull    = false;
            }
            System.Boolean?requestLoRaWAN_loRaWAN_Supports32BitFCnt = null;
            if (cmdletContext.LoRaWAN_Supports32BitFCnt != null)
            {
                requestLoRaWAN_loRaWAN_Supports32BitFCnt = cmdletContext.LoRaWAN_Supports32BitFCnt.Value;
            }
            if (requestLoRaWAN_loRaWAN_Supports32BitFCnt != null)
            {
                request.LoRaWAN.Supports32BitFCnt = requestLoRaWAN_loRaWAN_Supports32BitFCnt.Value;
                requestLoRaWANIsNull = false;
            }
            System.Boolean?requestLoRaWAN_loRaWAN_SupportsClassB = null;
            if (cmdletContext.LoRaWAN_SupportsClassB != null)
            {
                requestLoRaWAN_loRaWAN_SupportsClassB = cmdletContext.LoRaWAN_SupportsClassB.Value;
            }
            if (requestLoRaWAN_loRaWAN_SupportsClassB != null)
            {
                request.LoRaWAN.SupportsClassB = requestLoRaWAN_loRaWAN_SupportsClassB.Value;
                requestLoRaWANIsNull           = false;
            }
            System.Boolean?requestLoRaWAN_loRaWAN_SupportsClassC = null;
            if (cmdletContext.LoRaWAN_SupportsClassC != null)
            {
                requestLoRaWAN_loRaWAN_SupportsClassC = cmdletContext.LoRaWAN_SupportsClassC.Value;
            }
            if (requestLoRaWAN_loRaWAN_SupportsClassC != null)
            {
                request.LoRaWAN.SupportsClassC = requestLoRaWAN_loRaWAN_SupportsClassC.Value;
                requestLoRaWANIsNull           = false;
            }
            System.Boolean?requestLoRaWAN_loRaWAN_SupportsJoin = null;
            if (cmdletContext.LoRaWAN_SupportsJoin != null)
            {
                requestLoRaWAN_loRaWAN_SupportsJoin = cmdletContext.LoRaWAN_SupportsJoin.Value;
            }
            if (requestLoRaWAN_loRaWAN_SupportsJoin != null)
            {
                request.LoRaWAN.SupportsJoin = requestLoRaWAN_loRaWAN_SupportsJoin.Value;
                requestLoRaWANIsNull         = false;
            }
            // determine if request.LoRaWAN should be set to null
            if (requestLoRaWANIsNull)
            {
                request.LoRaWAN = null;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            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);
        }