{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Amazonka.DeviceFarm.Types.DeviceFilter -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) module Amazonka.DeviceFarm.Types.DeviceFilter where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.DeviceFarm.Types.DeviceFilterAttribute import Amazonka.DeviceFarm.Types.RuleOperator import qualified Amazonka.Prelude as Prelude -- | Represents a device filter used to select a set of devices to be -- included in a test run. This data structure is passed in as the -- @deviceSelectionConfiguration@ parameter to @ScheduleRun@. For an -- example of the JSON request syntax, see ScheduleRun. -- -- It is also passed in as the @filters@ parameter to @ListDevices@. For an -- example of the JSON request syntax, see ListDevices. -- -- /See:/ 'newDeviceFilter' smart constructor. data DeviceFilter = DeviceFilter' { -- | The aspect of a device such as platform or model used as the selection -- criteria in a device filter. -- -- The supported operators for each attribute are provided in the following -- list. -- -- [ARN] -- The Amazon Resource Name (ARN) of the device (for example, -- @arn:aws:devicefarm:us-west-2::device:12345Example@). -- -- Supported operators: @EQUALS@, @IN@, @NOT_IN@ -- -- [PLATFORM] -- The device platform. Valid values are ANDROID or IOS. -- -- Supported operators: @EQUALS@ -- -- [OS_VERSION] -- The operating system version (for example, 10.3.2). -- -- Supported operators: @EQUALS@, @GREATER_THAN@, -- @GREATER_THAN_OR_EQUALS@, @IN@, @LESS_THAN@, @LESS_THAN_OR_EQUALS@, -- @NOT_IN@ -- -- [MODEL] -- The device model (for example, iPad 5th Gen). -- -- Supported operators: @CONTAINS@, @EQUALS@, @IN@, @NOT_IN@ -- -- [AVAILABILITY] -- The current availability of the device. Valid values are AVAILABLE, -- HIGHLY_AVAILABLE, BUSY, or TEMPORARY_NOT_AVAILABLE. -- -- Supported operators: @EQUALS@ -- -- [FORM_FACTOR] -- The device form factor. Valid values are PHONE or TABLET. -- -- Supported operators: @EQUALS@ -- -- [MANUFACTURER] -- The device manufacturer (for example, Apple). -- -- Supported operators: @EQUALS@, @IN@, @NOT_IN@ -- -- [REMOTE_ACCESS_ENABLED] -- Whether the device is enabled for remote access. Valid values are -- TRUE or FALSE. -- -- Supported operators: @EQUALS@ -- -- [REMOTE_DEBUG_ENABLED] -- Whether the device is enabled for remote debugging. Valid values are -- TRUE or FALSE. -- -- Supported operators: @EQUALS@ -- -- Because remote debugging is -- <https://docs.aws.amazon.com/devicefarm/latest/developerguide/history.html no longer supported>, -- this filter is ignored. -- -- [INSTANCE_ARN] -- The Amazon Resource Name (ARN) of the device instance. -- -- Supported operators: @EQUALS@, @IN@, @NOT_IN@ -- -- [INSTANCE_LABELS] -- The label of the device instance. -- -- Supported operators: @CONTAINS@ -- -- [FLEET_TYPE] -- The fleet type. Valid values are PUBLIC or PRIVATE. -- -- Supported operators: @EQUALS@ DeviceFilter -> DeviceFilterAttribute attribute :: DeviceFilterAttribute, -- | Specifies how Device Farm compares the filter\'s attribute to the value. -- See the attribute descriptions. DeviceFilter -> RuleOperator operator :: RuleOperator, -- | An array of one or more filter values used in a device filter. -- -- __Operator Values__ -- -- - The IN and NOT_IN operators can take a values array that has more -- than one element. -- -- - The other operators require an array with a single element. -- -- __Attribute Values__ -- -- - The PLATFORM attribute can be set to ANDROID or IOS. -- -- - The AVAILABILITY attribute can be set to AVAILABLE, -- HIGHLY_AVAILABLE, BUSY, or TEMPORARY_NOT_AVAILABLE. -- -- - The FORM_FACTOR attribute can be set to PHONE or TABLET. -- -- - The FLEET_TYPE attribute can be set to PUBLIC or PRIVATE. DeviceFilter -> [Text] values :: [Prelude.Text] } deriving (DeviceFilter -> DeviceFilter -> Bool forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: DeviceFilter -> DeviceFilter -> Bool $c/= :: DeviceFilter -> DeviceFilter -> Bool == :: DeviceFilter -> DeviceFilter -> Bool $c== :: DeviceFilter -> DeviceFilter -> Bool Prelude.Eq, ReadPrec [DeviceFilter] ReadPrec DeviceFilter Int -> ReadS DeviceFilter ReadS [DeviceFilter] forall a. (Int -> ReadS a) -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a readListPrec :: ReadPrec [DeviceFilter] $creadListPrec :: ReadPrec [DeviceFilter] readPrec :: ReadPrec DeviceFilter $creadPrec :: ReadPrec DeviceFilter readList :: ReadS [DeviceFilter] $creadList :: ReadS [DeviceFilter] readsPrec :: Int -> ReadS DeviceFilter $creadsPrec :: Int -> ReadS DeviceFilter Prelude.Read, Int -> DeviceFilter -> ShowS [DeviceFilter] -> ShowS DeviceFilter -> String forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [DeviceFilter] -> ShowS $cshowList :: [DeviceFilter] -> ShowS show :: DeviceFilter -> String $cshow :: DeviceFilter -> String showsPrec :: Int -> DeviceFilter -> ShowS $cshowsPrec :: Int -> DeviceFilter -> ShowS Prelude.Show, forall x. Rep DeviceFilter x -> DeviceFilter forall x. DeviceFilter -> Rep DeviceFilter x forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a $cto :: forall x. Rep DeviceFilter x -> DeviceFilter $cfrom :: forall x. DeviceFilter -> Rep DeviceFilter x Prelude.Generic) -- | -- Create a value of 'DeviceFilter' with all optional fields omitted. -- -- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'attribute', 'deviceFilter_attribute' - The aspect of a device such as platform or model used as the selection -- criteria in a device filter. -- -- The supported operators for each attribute are provided in the following -- list. -- -- [ARN] -- The Amazon Resource Name (ARN) of the device (for example, -- @arn:aws:devicefarm:us-west-2::device:12345Example@). -- -- Supported operators: @EQUALS@, @IN@, @NOT_IN@ -- -- [PLATFORM] -- The device platform. Valid values are ANDROID or IOS. -- -- Supported operators: @EQUALS@ -- -- [OS_VERSION] -- The operating system version (for example, 10.3.2). -- -- Supported operators: @EQUALS@, @GREATER_THAN@, -- @GREATER_THAN_OR_EQUALS@, @IN@, @LESS_THAN@, @LESS_THAN_OR_EQUALS@, -- @NOT_IN@ -- -- [MODEL] -- The device model (for example, iPad 5th Gen). -- -- Supported operators: @CONTAINS@, @EQUALS@, @IN@, @NOT_IN@ -- -- [AVAILABILITY] -- The current availability of the device. Valid values are AVAILABLE, -- HIGHLY_AVAILABLE, BUSY, or TEMPORARY_NOT_AVAILABLE. -- -- Supported operators: @EQUALS@ -- -- [FORM_FACTOR] -- The device form factor. Valid values are PHONE or TABLET. -- -- Supported operators: @EQUALS@ -- -- [MANUFACTURER] -- The device manufacturer (for example, Apple). -- -- Supported operators: @EQUALS@, @IN@, @NOT_IN@ -- -- [REMOTE_ACCESS_ENABLED] -- Whether the device is enabled for remote access. Valid values are -- TRUE or FALSE. -- -- Supported operators: @EQUALS@ -- -- [REMOTE_DEBUG_ENABLED] -- Whether the device is enabled for remote debugging. Valid values are -- TRUE or FALSE. -- -- Supported operators: @EQUALS@ -- -- Because remote debugging is -- <https://docs.aws.amazon.com/devicefarm/latest/developerguide/history.html no longer supported>, -- this filter is ignored. -- -- [INSTANCE_ARN] -- The Amazon Resource Name (ARN) of the device instance. -- -- Supported operators: @EQUALS@, @IN@, @NOT_IN@ -- -- [INSTANCE_LABELS] -- The label of the device instance. -- -- Supported operators: @CONTAINS@ -- -- [FLEET_TYPE] -- The fleet type. Valid values are PUBLIC or PRIVATE. -- -- Supported operators: @EQUALS@ -- -- 'operator', 'deviceFilter_operator' - Specifies how Device Farm compares the filter\'s attribute to the value. -- See the attribute descriptions. -- -- 'values', 'deviceFilter_values' - An array of one or more filter values used in a device filter. -- -- __Operator Values__ -- -- - The IN and NOT_IN operators can take a values array that has more -- than one element. -- -- - The other operators require an array with a single element. -- -- __Attribute Values__ -- -- - The PLATFORM attribute can be set to ANDROID or IOS. -- -- - The AVAILABILITY attribute can be set to AVAILABLE, -- HIGHLY_AVAILABLE, BUSY, or TEMPORARY_NOT_AVAILABLE. -- -- - The FORM_FACTOR attribute can be set to PHONE or TABLET. -- -- - The FLEET_TYPE attribute can be set to PUBLIC or PRIVATE. newDeviceFilter :: -- | 'attribute' DeviceFilterAttribute -> -- | 'operator' RuleOperator -> DeviceFilter newDeviceFilter :: DeviceFilterAttribute -> RuleOperator -> DeviceFilter newDeviceFilter DeviceFilterAttribute pAttribute_ RuleOperator pOperator_ = DeviceFilter' { $sel:attribute:DeviceFilter' :: DeviceFilterAttribute attribute = DeviceFilterAttribute pAttribute_, $sel:operator:DeviceFilter' :: RuleOperator operator = RuleOperator pOperator_, $sel:values:DeviceFilter' :: [Text] values = forall a. Monoid a => a Prelude.mempty } -- | The aspect of a device such as platform or model used as the selection -- criteria in a device filter. -- -- The supported operators for each attribute are provided in the following -- list. -- -- [ARN] -- The Amazon Resource Name (ARN) of the device (for example, -- @arn:aws:devicefarm:us-west-2::device:12345Example@). -- -- Supported operators: @EQUALS@, @IN@, @NOT_IN@ -- -- [PLATFORM] -- The device platform. Valid values are ANDROID or IOS. -- -- Supported operators: @EQUALS@ -- -- [OS_VERSION] -- The operating system version (for example, 10.3.2). -- -- Supported operators: @EQUALS@, @GREATER_THAN@, -- @GREATER_THAN_OR_EQUALS@, @IN@, @LESS_THAN@, @LESS_THAN_OR_EQUALS@, -- @NOT_IN@ -- -- [MODEL] -- The device model (for example, iPad 5th Gen). -- -- Supported operators: @CONTAINS@, @EQUALS@, @IN@, @NOT_IN@ -- -- [AVAILABILITY] -- The current availability of the device. Valid values are AVAILABLE, -- HIGHLY_AVAILABLE, BUSY, or TEMPORARY_NOT_AVAILABLE. -- -- Supported operators: @EQUALS@ -- -- [FORM_FACTOR] -- The device form factor. Valid values are PHONE or TABLET. -- -- Supported operators: @EQUALS@ -- -- [MANUFACTURER] -- The device manufacturer (for example, Apple). -- -- Supported operators: @EQUALS@, @IN@, @NOT_IN@ -- -- [REMOTE_ACCESS_ENABLED] -- Whether the device is enabled for remote access. Valid values are -- TRUE or FALSE. -- -- Supported operators: @EQUALS@ -- -- [REMOTE_DEBUG_ENABLED] -- Whether the device is enabled for remote debugging. Valid values are -- TRUE or FALSE. -- -- Supported operators: @EQUALS@ -- -- Because remote debugging is -- <https://docs.aws.amazon.com/devicefarm/latest/developerguide/history.html no longer supported>, -- this filter is ignored. -- -- [INSTANCE_ARN] -- The Amazon Resource Name (ARN) of the device instance. -- -- Supported operators: @EQUALS@, @IN@, @NOT_IN@ -- -- [INSTANCE_LABELS] -- The label of the device instance. -- -- Supported operators: @CONTAINS@ -- -- [FLEET_TYPE] -- The fleet type. Valid values are PUBLIC or PRIVATE. -- -- Supported operators: @EQUALS@ deviceFilter_attribute :: Lens.Lens' DeviceFilter DeviceFilterAttribute deviceFilter_attribute :: Lens' DeviceFilter DeviceFilterAttribute deviceFilter_attribute = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\DeviceFilter' {DeviceFilterAttribute attribute :: DeviceFilterAttribute $sel:attribute:DeviceFilter' :: DeviceFilter -> DeviceFilterAttribute attribute} -> DeviceFilterAttribute attribute) (\s :: DeviceFilter s@DeviceFilter' {} DeviceFilterAttribute a -> DeviceFilter s {$sel:attribute:DeviceFilter' :: DeviceFilterAttribute attribute = DeviceFilterAttribute a} :: DeviceFilter) -- | Specifies how Device Farm compares the filter\'s attribute to the value. -- See the attribute descriptions. deviceFilter_operator :: Lens.Lens' DeviceFilter RuleOperator deviceFilter_operator :: Lens' DeviceFilter RuleOperator deviceFilter_operator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\DeviceFilter' {RuleOperator operator :: RuleOperator $sel:operator:DeviceFilter' :: DeviceFilter -> RuleOperator operator} -> RuleOperator operator) (\s :: DeviceFilter s@DeviceFilter' {} RuleOperator a -> DeviceFilter s {$sel:operator:DeviceFilter' :: RuleOperator operator = RuleOperator a} :: DeviceFilter) -- | An array of one or more filter values used in a device filter. -- -- __Operator Values__ -- -- - The IN and NOT_IN operators can take a values array that has more -- than one element. -- -- - The other operators require an array with a single element. -- -- __Attribute Values__ -- -- - The PLATFORM attribute can be set to ANDROID or IOS. -- -- - The AVAILABILITY attribute can be set to AVAILABLE, -- HIGHLY_AVAILABLE, BUSY, or TEMPORARY_NOT_AVAILABLE. -- -- - The FORM_FACTOR attribute can be set to PHONE or TABLET. -- -- - The FLEET_TYPE attribute can be set to PUBLIC or PRIVATE. deviceFilter_values :: Lens.Lens' DeviceFilter [Prelude.Text] deviceFilter_values :: Lens' DeviceFilter [Text] deviceFilter_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\DeviceFilter' {[Text] values :: [Text] $sel:values:DeviceFilter' :: DeviceFilter -> [Text] values} -> [Text] values) (\s :: DeviceFilter s@DeviceFilter' {} [Text] a -> DeviceFilter s {$sel:values:DeviceFilter' :: [Text] values = [Text] a} :: DeviceFilter) forall b c a. (b -> c) -> (a -> b) -> a -> c Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b Lens.coerced instance Data.FromJSON DeviceFilter where parseJSON :: Value -> Parser DeviceFilter parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a Data.withObject String "DeviceFilter" ( \Object x -> DeviceFilterAttribute -> RuleOperator -> [Text] -> DeviceFilter DeviceFilter' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b Prelude.<$> (Object x forall a. FromJSON a => Object -> Key -> Parser a Data..: Key "attribute") forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b Prelude.<*> (Object x forall a. FromJSON a => Object -> Key -> Parser a Data..: Key "operator") forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b Prelude.<*> (Object x forall a. FromJSON a => Object -> Key -> Parser (Maybe a) Data..:? Key "values" forall a. Parser (Maybe a) -> a -> Parser a Data..!= forall a. Monoid a => a Prelude.mempty) ) instance Prelude.Hashable DeviceFilter where hashWithSalt :: Int -> DeviceFilter -> Int hashWithSalt Int _salt DeviceFilter' {[Text] DeviceFilterAttribute RuleOperator values :: [Text] operator :: RuleOperator attribute :: DeviceFilterAttribute $sel:values:DeviceFilter' :: DeviceFilter -> [Text] $sel:operator:DeviceFilter' :: DeviceFilter -> RuleOperator $sel:attribute:DeviceFilter' :: DeviceFilter -> DeviceFilterAttribute ..} = Int _salt forall a. Hashable a => Int -> a -> Int `Prelude.hashWithSalt` DeviceFilterAttribute attribute forall a. Hashable a => Int -> a -> Int `Prelude.hashWithSalt` RuleOperator operator forall a. Hashable a => Int -> a -> Int `Prelude.hashWithSalt` [Text] values instance Prelude.NFData DeviceFilter where rnf :: DeviceFilter -> () rnf DeviceFilter' {[Text] DeviceFilterAttribute RuleOperator values :: [Text] operator :: RuleOperator attribute :: DeviceFilterAttribute $sel:values:DeviceFilter' :: DeviceFilter -> [Text] $sel:operator:DeviceFilter' :: DeviceFilter -> RuleOperator $sel:attribute:DeviceFilter' :: DeviceFilter -> DeviceFilterAttribute ..} = forall a. NFData a => a -> () Prelude.rnf DeviceFilterAttribute attribute seq :: forall a b. a -> b -> b `Prelude.seq` forall a. NFData a => a -> () Prelude.rnf RuleOperator operator seq :: forall a b. a -> b -> b `Prelude.seq` forall a. NFData a => a -> () Prelude.rnf [Text] values instance Data.ToJSON DeviceFilter where toJSON :: DeviceFilter -> Value toJSON DeviceFilter' {[Text] DeviceFilterAttribute RuleOperator values :: [Text] operator :: RuleOperator attribute :: DeviceFilterAttribute $sel:values:DeviceFilter' :: DeviceFilter -> [Text] $sel:operator:DeviceFilter' :: DeviceFilter -> RuleOperator $sel:attribute:DeviceFilter' :: DeviceFilter -> DeviceFilterAttribute ..} = [Pair] -> Value Data.object ( forall a. [Maybe a] -> [a] Prelude.catMaybes [ forall a. a -> Maybe a Prelude.Just (Key "attribute" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv Data..= DeviceFilterAttribute attribute), forall a. a -> Maybe a Prelude.Just (Key "operator" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv Data..= RuleOperator operator), forall a. a -> Maybe a Prelude.Just (Key "values" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv Data..= [Text] values) ] )