{-# 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.CloudFront.Types.ResponseHeadersPolicyContentTypeOptions
-- 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.CloudFront.Types.ResponseHeadersPolicyContentTypeOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Determines whether CloudFront includes the @X-Content-Type-Options@ HTTP
-- response header with its value set to @nosniff@.
--
-- For more information about the @X-Content-Type-Options@ HTTP response
-- header, see
-- <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options X-Content-Type-Options>
-- in the MDN Web Docs.
--
-- /See:/ 'newResponseHeadersPolicyContentTypeOptions' smart constructor.
data ResponseHeadersPolicyContentTypeOptions = ResponseHeadersPolicyContentTypeOptions'
  { -- | A Boolean that determines whether CloudFront overrides the
    -- @X-Content-Type-Options@ HTTP response header received from the origin
    -- with the one specified in this response headers policy.
    ResponseHeadersPolicyContentTypeOptions -> Bool
override :: Prelude.Bool
  }
  deriving (ResponseHeadersPolicyContentTypeOptions
-> ResponseHeadersPolicyContentTypeOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResponseHeadersPolicyContentTypeOptions
-> ResponseHeadersPolicyContentTypeOptions -> Bool
$c/= :: ResponseHeadersPolicyContentTypeOptions
-> ResponseHeadersPolicyContentTypeOptions -> Bool
== :: ResponseHeadersPolicyContentTypeOptions
-> ResponseHeadersPolicyContentTypeOptions -> Bool
$c== :: ResponseHeadersPolicyContentTypeOptions
-> ResponseHeadersPolicyContentTypeOptions -> Bool
Prelude.Eq, ReadPrec [ResponseHeadersPolicyContentTypeOptions]
ReadPrec ResponseHeadersPolicyContentTypeOptions
Int -> ReadS ResponseHeadersPolicyContentTypeOptions
ReadS [ResponseHeadersPolicyContentTypeOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResponseHeadersPolicyContentTypeOptions]
$creadListPrec :: ReadPrec [ResponseHeadersPolicyContentTypeOptions]
readPrec :: ReadPrec ResponseHeadersPolicyContentTypeOptions
$creadPrec :: ReadPrec ResponseHeadersPolicyContentTypeOptions
readList :: ReadS [ResponseHeadersPolicyContentTypeOptions]
$creadList :: ReadS [ResponseHeadersPolicyContentTypeOptions]
readsPrec :: Int -> ReadS ResponseHeadersPolicyContentTypeOptions
$creadsPrec :: Int -> ReadS ResponseHeadersPolicyContentTypeOptions
Prelude.Read, Int -> ResponseHeadersPolicyContentTypeOptions -> ShowS
[ResponseHeadersPolicyContentTypeOptions] -> ShowS
ResponseHeadersPolicyContentTypeOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResponseHeadersPolicyContentTypeOptions] -> ShowS
$cshowList :: [ResponseHeadersPolicyContentTypeOptions] -> ShowS
show :: ResponseHeadersPolicyContentTypeOptions -> String
$cshow :: ResponseHeadersPolicyContentTypeOptions -> String
showsPrec :: Int -> ResponseHeadersPolicyContentTypeOptions -> ShowS
$cshowsPrec :: Int -> ResponseHeadersPolicyContentTypeOptions -> ShowS
Prelude.Show, forall x.
Rep ResponseHeadersPolicyContentTypeOptions x
-> ResponseHeadersPolicyContentTypeOptions
forall x.
ResponseHeadersPolicyContentTypeOptions
-> Rep ResponseHeadersPolicyContentTypeOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResponseHeadersPolicyContentTypeOptions x
-> ResponseHeadersPolicyContentTypeOptions
$cfrom :: forall x.
ResponseHeadersPolicyContentTypeOptions
-> Rep ResponseHeadersPolicyContentTypeOptions x
Prelude.Generic)

-- |
-- Create a value of 'ResponseHeadersPolicyContentTypeOptions' 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:
--
-- 'override', 'responseHeadersPolicyContentTypeOptions_override' - A Boolean that determines whether CloudFront overrides the
-- @X-Content-Type-Options@ HTTP response header received from the origin
-- with the one specified in this response headers policy.
newResponseHeadersPolicyContentTypeOptions ::
  -- | 'override'
  Prelude.Bool ->
  ResponseHeadersPolicyContentTypeOptions
newResponseHeadersPolicyContentTypeOptions :: Bool -> ResponseHeadersPolicyContentTypeOptions
newResponseHeadersPolicyContentTypeOptions Bool
pOverride_ =
  ResponseHeadersPolicyContentTypeOptions'
    { $sel:override:ResponseHeadersPolicyContentTypeOptions' :: Bool
override =
        Bool
pOverride_
    }

-- | A Boolean that determines whether CloudFront overrides the
-- @X-Content-Type-Options@ HTTP response header received from the origin
-- with the one specified in this response headers policy.
responseHeadersPolicyContentTypeOptions_override :: Lens.Lens' ResponseHeadersPolicyContentTypeOptions Prelude.Bool
responseHeadersPolicyContentTypeOptions_override :: Lens' ResponseHeadersPolicyContentTypeOptions Bool
responseHeadersPolicyContentTypeOptions_override = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseHeadersPolicyContentTypeOptions' {Bool
override :: Bool
$sel:override:ResponseHeadersPolicyContentTypeOptions' :: ResponseHeadersPolicyContentTypeOptions -> Bool
override} -> Bool
override) (\s :: ResponseHeadersPolicyContentTypeOptions
s@ResponseHeadersPolicyContentTypeOptions' {} Bool
a -> ResponseHeadersPolicyContentTypeOptions
s {$sel:override:ResponseHeadersPolicyContentTypeOptions' :: Bool
override = Bool
a} :: ResponseHeadersPolicyContentTypeOptions)

instance
  Data.FromXML
    ResponseHeadersPolicyContentTypeOptions
  where
  parseXML :: [Node] -> Either String ResponseHeadersPolicyContentTypeOptions
parseXML [Node]
x =
    Bool -> ResponseHeadersPolicyContentTypeOptions
ResponseHeadersPolicyContentTypeOptions'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Override")

instance
  Prelude.Hashable
    ResponseHeadersPolicyContentTypeOptions
  where
  hashWithSalt :: Int -> ResponseHeadersPolicyContentTypeOptions -> Int
hashWithSalt
    Int
_salt
    ResponseHeadersPolicyContentTypeOptions' {Bool
override :: Bool
$sel:override:ResponseHeadersPolicyContentTypeOptions' :: ResponseHeadersPolicyContentTypeOptions -> Bool
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
override

instance
  Prelude.NFData
    ResponseHeadersPolicyContentTypeOptions
  where
  rnf :: ResponseHeadersPolicyContentTypeOptions -> ()
rnf ResponseHeadersPolicyContentTypeOptions' {Bool
override :: Bool
$sel:override:ResponseHeadersPolicyContentTypeOptions' :: ResponseHeadersPolicyContentTypeOptions -> Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Bool
override

instance
  Data.ToXML
    ResponseHeadersPolicyContentTypeOptions
  where
  toXML :: ResponseHeadersPolicyContentTypeOptions -> XML
toXML ResponseHeadersPolicyContentTypeOptions' {Bool
override :: Bool
$sel:override:ResponseHeadersPolicyContentTypeOptions' :: ResponseHeadersPolicyContentTypeOptions -> Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [Name
"Override" forall a. ToXML a => Name -> a -> XML
Data.@= Bool
override]