{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# OPTIONS_GHC -fno-warn-unused-binds #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} -- | -- Module : Network.Google.Run.Types.Product -- Copyright : (c) 2015-2016 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- module Network.Google.Run.Types.Product where import Network.Google.Prelude import Network.Google.Run.Types.Sum -- | A resource that represents Google Cloud Platform location. -- -- /See:/ 'location' smart constructor. data Location = Location' { _lName :: !(Maybe Text) , _lMetadata :: !(Maybe LocationMetadata) , _lDisplayName :: !(Maybe Text) , _lLabels :: !(Maybe LocationLabels) , _lLocationId :: !(Maybe Text) } deriving (Eq, Show, Data, Typeable, Generic) -- | Creates a value of 'Location' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'lName' -- -- * 'lMetadata' -- -- * 'lDisplayName' -- -- * 'lLabels' -- -- * 'lLocationId' location :: Location location = Location' { _lName = Nothing , _lMetadata = Nothing , _lDisplayName = Nothing , _lLabels = Nothing , _lLocationId = Nothing } -- | Resource name for the location, which may vary between implementations. -- For example: \`\"projects\/example-project\/locations\/us-east1\"\` lName :: Lens' Location (Maybe Text) lName = lens _lName (\ s a -> s{_lName = a}) -- | Service-specific metadata. For example the available capacity at the -- given location. lMetadata :: Lens' Location (Maybe LocationMetadata) lMetadata = lens _lMetadata (\ s a -> s{_lMetadata = a}) -- | The friendly name for this location, typically a nearby city name. For -- example, \"Tokyo\". lDisplayName :: Lens' Location (Maybe Text) lDisplayName = lens _lDisplayName (\ s a -> s{_lDisplayName = a}) -- | Cross-service attributes for the location. For example -- {\"cloud.googleapis.com\/region\": \"us-east1\"} lLabels :: Lens' Location (Maybe LocationLabels) lLabels = lens _lLabels (\ s a -> s{_lLabels = a}) -- | The canonical id for this location. For example: \`\"us-east1\"\`. lLocationId :: Lens' Location (Maybe Text) lLocationId = lens _lLocationId (\ s a -> s{_lLocationId = a}) instance FromJSON Location where parseJSON = withObject "Location" (\ o -> Location' <$> (o .:? "name") <*> (o .:? "metadata") <*> (o .:? "displayName") <*> (o .:? "labels") <*> (o .:? "locationId")) instance ToJSON Location where toJSON Location'{..} = object (catMaybes [("name" .=) <$> _lName, ("metadata" .=) <$> _lMetadata, ("displayName" .=) <$> _lDisplayName, ("labels" .=) <$> _lLabels, ("locationId" .=) <$> _lLocationId]) -- | Cross-service attributes for the location. For example -- {\"cloud.googleapis.com\/region\": \"us-east1\"} -- -- /See:/ 'locationLabels' smart constructor. newtype LocationLabels = LocationLabels' { _llAddtional :: HashMap Text Text } deriving (Eq, Show, Data, Typeable, Generic) -- | Creates a value of 'LocationLabels' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'llAddtional' locationLabels :: HashMap Text Text -- ^ 'llAddtional' -> LocationLabels locationLabels pLlAddtional_ = LocationLabels' {_llAddtional = _Coerce # pLlAddtional_} llAddtional :: Lens' LocationLabels (HashMap Text Text) llAddtional = lens _llAddtional (\ s a -> s{_llAddtional = a}) . _Coerce instance FromJSON LocationLabels where parseJSON = withObject "LocationLabels" (\ o -> LocationLabels' <$> (parseJSONObject o)) instance ToJSON LocationLabels where toJSON = toJSON . _llAddtional -- | Service-specific metadata. For example the available capacity at the -- given location. -- -- /See:/ 'locationMetadata' smart constructor. newtype LocationMetadata = LocationMetadata' { _lmAddtional :: HashMap Text JSONValue } deriving (Eq, Show, Data, Typeable, Generic) -- | Creates a value of 'LocationMetadata' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'lmAddtional' locationMetadata :: HashMap Text JSONValue -- ^ 'lmAddtional' -> LocationMetadata locationMetadata pLmAddtional_ = LocationMetadata' {_lmAddtional = _Coerce # pLmAddtional_} -- | Properties of the object. Contains field \'type with type URL. lmAddtional :: Lens' LocationMetadata (HashMap Text JSONValue) lmAddtional = lens _lmAddtional (\ s a -> s{_lmAddtional = a}) . _Coerce instance FromJSON LocationMetadata where parseJSON = withObject "LocationMetadata" (\ o -> LocationMetadata' <$> (parseJSONObject o)) instance ToJSON LocationMetadata where toJSON = toJSON . _lmAddtional