{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}

-- |
-- Module      : Network.DO.Spaces.Actions.GetBucketLifecycle
-- Copyright   : (c) 2021 Rory Tyler Hayford
-- License     : BSD-3-Clause
-- Maintainer  : rory.hayford@protonmail.com
-- Stability   : experimental
-- Portability : GHC
--
module Network.DO.Spaces.Actions.DeleteBucketLifecycle
    ( DeleteBucketLifecycle(..)
    , DeleteBucketLifecycleResponse
    ) where

import           Control.Monad.Reader    ( MonadReader(ask) )

import           Data.ByteString         ( ByteString )

import           GHC.Generics            ( Generic )

import           Network.DO.Spaces.Types
import qualified Network.HTTP.Types      as H

newtype DeleteBucketLifecycle = DeleteBucketLifecycle { DeleteBucketLifecycle -> Bucket
bucket :: Bucket }
    deriving stock ( Int -> DeleteBucketLifecycle -> ShowS
[DeleteBucketLifecycle] -> ShowS
DeleteBucketLifecycle -> String
(Int -> DeleteBucketLifecycle -> ShowS)
-> (DeleteBucketLifecycle -> String)
-> ([DeleteBucketLifecycle] -> ShowS)
-> Show DeleteBucketLifecycle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBucketLifecycle] -> ShowS
$cshowList :: [DeleteBucketLifecycle] -> ShowS
show :: DeleteBucketLifecycle -> String
$cshow :: DeleteBucketLifecycle -> String
showsPrec :: Int -> DeleteBucketLifecycle -> ShowS
$cshowsPrec :: Int -> DeleteBucketLifecycle -> ShowS
Show, (forall x. DeleteBucketLifecycle -> Rep DeleteBucketLifecycle x)
-> (forall x. Rep DeleteBucketLifecycle x -> DeleteBucketLifecycle)
-> Generic DeleteBucketLifecycle
forall x. Rep DeleteBucketLifecycle x -> DeleteBucketLifecycle
forall x. DeleteBucketLifecycle -> Rep DeleteBucketLifecycle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteBucketLifecycle x -> DeleteBucketLifecycle
$cfrom :: forall x. DeleteBucketLifecycle -> Rep DeleteBucketLifecycle x
Generic )
    deriving newtype ( DeleteBucketLifecycle -> DeleteBucketLifecycle -> Bool
(DeleteBucketLifecycle -> DeleteBucketLifecycle -> Bool)
-> (DeleteBucketLifecycle -> DeleteBucketLifecycle -> Bool)
-> Eq DeleteBucketLifecycle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBucketLifecycle -> DeleteBucketLifecycle -> Bool
$c/= :: DeleteBucketLifecycle -> DeleteBucketLifecycle -> Bool
== :: DeleteBucketLifecycle -> DeleteBucketLifecycle -> Bool
$c== :: DeleteBucketLifecycle -> DeleteBucketLifecycle -> Bool
Eq )

type DeleteBucketLifecycleResponse = ()

instance MonadSpaces m => Action m DeleteBucketLifecycle where
    type ConsumedResponse DeleteBucketLifecycle = DeleteBucketLifecycleResponse

    buildRequest :: DeleteBucketLifecycle -> m SpacesRequestBuilder
buildRequest DeleteBucketLifecycle { Bucket
bucket :: Bucket
$sel:bucket:DeleteBucketLifecycle :: DeleteBucketLifecycle -> Bucket
.. } = do
        Spaces
spaces <- m Spaces
forall r (m :: * -> *). MonadReader r m => m r
ask
        SpacesRequestBuilder -> m SpacesRequestBuilder
forall (f :: * -> *) a. Applicative f => a -> f a
pure SpacesRequestBuilder :: Spaces
-> Maybe RequestBody
-> Maybe Method
-> [Header]
-> Maybe Bucket
-> Maybe Object
-> Maybe Query
-> Maybe Query
-> Maybe Region
-> SpacesRequestBuilder
SpacesRequestBuilder
             { $sel:bucket:SpacesRequestBuilder :: Maybe Bucket
bucket         = Bucket -> Maybe Bucket
forall a. a -> Maybe a
Just Bucket
bucket
             , $sel:method:SpacesRequestBuilder :: Maybe Method
method         = Method -> Maybe Method
forall a. a -> Maybe a
Just Method
DELETE
             , $sel:body:SpacesRequestBuilder :: Maybe RequestBody
body           = Maybe RequestBody
forall a. Maybe a
Nothing
             , $sel:object:SpacesRequestBuilder :: Maybe Object
object         = Maybe Object
forall a. Maybe a
Nothing
             , $sel:overrideRegion:SpacesRequestBuilder :: Maybe Region
overrideRegion = Maybe Region
forall a. Maybe a
Nothing
             , $sel:queryString:SpacesRequestBuilder :: Maybe Query
queryString    = Maybe Query
forall a. Maybe a
Nothing
             , $sel:headers:SpacesRequestBuilder :: [Header]
headers        = [Header]
forall a. Monoid a => a
mempty
             , $sel:subresources:SpacesRequestBuilder :: Maybe Query
subresources   = Query -> Maybe Query
forall a. a -> Maybe a
Just
                   (Query -> Maybe Query) -> Query -> Maybe Query
forall a b. (a -> b) -> a -> b
$ Query -> Query
forall a. QueryLike a => a -> Query
H.toQuery [ ( ByteString
"lifecycle" :: ByteString
                                 , Maybe ByteString
forall a. Maybe a
Nothing :: Maybe ByteString
                                 )
                               ]
             , Spaces
$sel:spaces:SpacesRequestBuilder :: Spaces
spaces :: Spaces
..
             }

    consumeResponse :: RawResponse m -> m (ConsumedResponse DeleteBucketLifecycle)
consumeResponse RawResponse m
_ = () -> m ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()