{-# 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-2021 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com> -- Stability : auto-generated -- Portability : non-portable (GHC extensions) module Amazonka.DeviceFarm.Types.DeviceFilter where import qualified Amazonka.Core as Core import Amazonka.DeviceFarm.Types.DeviceFilterAttribute import Amazonka.DeviceFarm.Types.RuleOperator import qualified Amazonka.Lens as Lens 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 (DeviceFilter -> DeviceFilter -> Bool) -> (DeviceFilter -> DeviceFilter -> Bool) -> Eq DeviceFilter 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] (Int -> ReadS DeviceFilter) -> ReadS [DeviceFilter] -> ReadPrec DeviceFilter -> ReadPrec [DeviceFilter] -> Read 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 (Int -> DeviceFilter -> ShowS) -> (DeviceFilter -> String) -> ([DeviceFilter] -> ShowS) -> Show DeviceFilter 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. DeviceFilter -> Rep DeviceFilter x) -> (forall x. Rep DeviceFilter x -> DeviceFilter) -> Generic DeviceFilter 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' :: DeviceFilterAttribute -> RuleOperator -> [Text] -> DeviceFilter DeviceFilter' { $sel:attribute:DeviceFilter' :: DeviceFilterAttribute attribute = DeviceFilterAttribute pAttribute_, $sel:operator:DeviceFilter' :: RuleOperator operator = RuleOperator pOperator_, $sel:values:DeviceFilter' :: [Text] values = [Text] 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 :: (DeviceFilterAttribute -> f DeviceFilterAttribute) -> DeviceFilter -> f DeviceFilter deviceFilter_attribute = (DeviceFilter -> DeviceFilterAttribute) -> (DeviceFilter -> DeviceFilterAttribute -> DeviceFilter) -> Lens DeviceFilter DeviceFilter DeviceFilterAttribute DeviceFilterAttribute 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 :: (RuleOperator -> f RuleOperator) -> DeviceFilter -> f DeviceFilter deviceFilter_operator = (DeviceFilter -> RuleOperator) -> (DeviceFilter -> RuleOperator -> DeviceFilter) -> Lens DeviceFilter DeviceFilter RuleOperator RuleOperator 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 :: ([Text] -> f [Text]) -> DeviceFilter -> f DeviceFilter deviceFilter_values = (DeviceFilter -> [Text]) -> (DeviceFilter -> [Text] -> DeviceFilter) -> Lens DeviceFilter DeviceFilter [Text] [Text] 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) (([Text] -> f [Text]) -> DeviceFilter -> f DeviceFilter) -> (([Text] -> f [Text]) -> [Text] -> f [Text]) -> ([Text] -> f [Text]) -> DeviceFilter -> f DeviceFilter forall b c a. (b -> c) -> (a -> b) -> a -> c Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text] forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b Lens.coerced instance Core.FromJSON DeviceFilter where parseJSON :: Value -> Parser DeviceFilter parseJSON = String -> (Object -> Parser DeviceFilter) -> Value -> Parser DeviceFilter forall a. String -> (Object -> Parser a) -> Value -> Parser a Core.withObject String "DeviceFilter" ( \Object x -> DeviceFilterAttribute -> RuleOperator -> [Text] -> DeviceFilter DeviceFilter' (DeviceFilterAttribute -> RuleOperator -> [Text] -> DeviceFilter) -> Parser DeviceFilterAttribute -> Parser (RuleOperator -> [Text] -> DeviceFilter) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b Prelude.<$> (Object x Object -> Text -> Parser DeviceFilterAttribute forall a. FromJSON a => Object -> Text -> Parser a Core..: Text "attribute") Parser (RuleOperator -> [Text] -> DeviceFilter) -> Parser RuleOperator -> Parser ([Text] -> DeviceFilter) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b Prelude.<*> (Object x Object -> Text -> Parser RuleOperator forall a. FromJSON a => Object -> Text -> Parser a Core..: Text "operator") Parser ([Text] -> DeviceFilter) -> Parser [Text] -> Parser DeviceFilter forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b Prelude.<*> (Object x Object -> Text -> Parser (Maybe [Text]) forall a. FromJSON a => Object -> Text -> Parser (Maybe a) Core..:? Text "values" Parser (Maybe [Text]) -> [Text] -> Parser [Text] forall a. Parser (Maybe a) -> a -> Parser a Core..!= [Text] forall a. Monoid a => a Prelude.mempty) ) instance Prelude.Hashable DeviceFilter instance Prelude.NFData DeviceFilter instance Core.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 Core.object ( [Maybe Pair] -> [Pair] forall a. [Maybe a] -> [a] Prelude.catMaybes [ Pair -> Maybe Pair forall a. a -> Maybe a Prelude.Just (Text "attribute" Text -> DeviceFilterAttribute -> Pair forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv Core..= DeviceFilterAttribute attribute), Pair -> Maybe Pair forall a. a -> Maybe a Prelude.Just (Text "operator" Text -> RuleOperator -> Pair forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv Core..= RuleOperator operator), Pair -> Maybe Pair forall a. a -> Maybe a Prelude.Just (Text "values" Text -> [Text] -> Pair forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv Core..= [Text] values) ] )