{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.ServiceConsumerManagement.Types.Sum where
import Network.Google.Prelude hiding (Bytes)
data MetricDescriptorValueType
= ValueTypeUnspecified
| Bool
| INT64
| Double
| String
| Distribution
| Money
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable MetricDescriptorValueType
instance FromHttpApiData MetricDescriptorValueType where
parseQueryParam = \case
"VALUE_TYPE_UNSPECIFIED" -> Right ValueTypeUnspecified
"BOOL" -> Right Bool
"INT64" -> Right INT64
"DOUBLE" -> Right Double
"STRING" -> Right String
"DISTRIBUTION" -> Right Distribution
"MONEY" -> Right Money
x -> Left ("Unable to parse MetricDescriptorValueType from: " <> x)
instance ToHttpApiData MetricDescriptorValueType where
toQueryParam = \case
ValueTypeUnspecified -> "VALUE_TYPE_UNSPECIFIED"
Bool -> "BOOL"
INT64 -> "INT64"
Double -> "DOUBLE"
String -> "STRING"
Distribution -> "DISTRIBUTION"
Money -> "MONEY"
instance FromJSON MetricDescriptorValueType where
parseJSON = parseJSONText "MetricDescriptorValueType"
instance ToJSON MetricDescriptorValueType where
toJSON = toJSONText
data TenantResourceStatus
= StatusUnspecified
| PendingCreate
| Active
| PendingDelete
| Failed
| Deleted
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable TenantResourceStatus
instance FromHttpApiData TenantResourceStatus where
parseQueryParam = \case
"STATUS_UNSPECIFIED" -> Right StatusUnspecified
"PENDING_CREATE" -> Right PendingCreate
"ACTIVE" -> Right Active
"PENDING_DELETE" -> Right PendingDelete
"FAILED" -> Right Failed
"DELETED" -> Right Deleted
x -> Left ("Unable to parse TenantResourceStatus from: " <> x)
instance ToHttpApiData TenantResourceStatus where
toQueryParam = \case
StatusUnspecified -> "STATUS_UNSPECIFIED"
PendingCreate -> "PENDING_CREATE"
Active -> "ACTIVE"
PendingDelete -> "PENDING_DELETE"
Failed -> "FAILED"
Deleted -> "DELETED"
instance FromJSON TenantResourceStatus where
parseJSON = parseJSONText "TenantResourceStatus"
instance ToJSON TenantResourceStatus where
toJSON = toJSONText
data FieldKind
= TypeUnknown
| TypeDouble
| TypeFloat
| TypeINT64
| TypeUINT64
| TypeINT32
| TypeFIXED64
| TypeFIXED32
| TypeBool
| TypeString
| TypeGroup
| TypeMessage
| TypeBytes
| TypeUINT32
| TypeEnum
| TypeSFIXED32
| TypeSFIXED64
| TypeSINT32
| TypeSINT64
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable FieldKind
instance FromHttpApiData FieldKind where
parseQueryParam = \case
"TYPE_UNKNOWN" -> Right TypeUnknown
"TYPE_DOUBLE" -> Right TypeDouble
"TYPE_FLOAT" -> Right TypeFloat
"TYPE_INT64" -> Right TypeINT64
"TYPE_UINT64" -> Right TypeUINT64
"TYPE_INT32" -> Right TypeINT32
"TYPE_FIXED64" -> Right TypeFIXED64
"TYPE_FIXED32" -> Right TypeFIXED32
"TYPE_BOOL" -> Right TypeBool
"TYPE_STRING" -> Right TypeString
"TYPE_GROUP" -> Right TypeGroup
"TYPE_MESSAGE" -> Right TypeMessage
"TYPE_BYTES" -> Right TypeBytes
"TYPE_UINT32" -> Right TypeUINT32
"TYPE_ENUM" -> Right TypeEnum
"TYPE_SFIXED32" -> Right TypeSFIXED32
"TYPE_SFIXED64" -> Right TypeSFIXED64
"TYPE_SINT32" -> Right TypeSINT32
"TYPE_SINT64" -> Right TypeSINT64
x -> Left ("Unable to parse FieldKind from: " <> x)
instance ToHttpApiData FieldKind where
toQueryParam = \case
TypeUnknown -> "TYPE_UNKNOWN"
TypeDouble -> "TYPE_DOUBLE"
TypeFloat -> "TYPE_FLOAT"
TypeINT64 -> "TYPE_INT64"
TypeUINT64 -> "TYPE_UINT64"
TypeINT32 -> "TYPE_INT32"
TypeFIXED64 -> "TYPE_FIXED64"
TypeFIXED32 -> "TYPE_FIXED32"
TypeBool -> "TYPE_BOOL"
TypeString -> "TYPE_STRING"
TypeGroup -> "TYPE_GROUP"
TypeMessage -> "TYPE_MESSAGE"
TypeBytes -> "TYPE_BYTES"
TypeUINT32 -> "TYPE_UINT32"
TypeEnum -> "TYPE_ENUM"
TypeSFIXED32 -> "TYPE_SFIXED32"
TypeSFIXED64 -> "TYPE_SFIXED64"
TypeSINT32 -> "TYPE_SINT32"
TypeSINT64 -> "TYPE_SINT64"
instance FromJSON FieldKind where
parseJSON = parseJSONText "FieldKind"
instance ToJSON FieldKind where
toJSON = toJSONText
data EnumSyntax
= SyntaxPROTO2
| SyntaxPROTO3
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable EnumSyntax
instance FromHttpApiData EnumSyntax where
parseQueryParam = \case
"SYNTAX_PROTO2" -> Right SyntaxPROTO2
"SYNTAX_PROTO3" -> Right SyntaxPROTO3
x -> Left ("Unable to parse EnumSyntax from: " <> x)
instance ToHttpApiData EnumSyntax where
toQueryParam = \case
SyntaxPROTO2 -> "SYNTAX_PROTO2"
SyntaxPROTO3 -> "SYNTAX_PROTO3"
instance FromJSON EnumSyntax where
parseJSON = parseJSONText "EnumSyntax"
instance ToJSON EnumSyntax where
toJSON = toJSONText
data MetricDescriptorMetadataLaunchStage
= LaunchStageUnspecified
| EarlyAccess
| Alpha
| Beta
| GA
| Deprecated
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable MetricDescriptorMetadataLaunchStage
instance FromHttpApiData MetricDescriptorMetadataLaunchStage where
parseQueryParam = \case
"LAUNCH_STAGE_UNSPECIFIED" -> Right LaunchStageUnspecified
"EARLY_ACCESS" -> Right EarlyAccess
"ALPHA" -> Right Alpha
"BETA" -> Right Beta
"GA" -> Right GA
"DEPRECATED" -> Right Deprecated
x -> Left ("Unable to parse MetricDescriptorMetadataLaunchStage from: " <> x)
instance ToHttpApiData MetricDescriptorMetadataLaunchStage where
toQueryParam = \case
LaunchStageUnspecified -> "LAUNCH_STAGE_UNSPECIFIED"
EarlyAccess -> "EARLY_ACCESS"
Alpha -> "ALPHA"
Beta -> "BETA"
GA -> "GA"
Deprecated -> "DEPRECATED"
instance FromJSON MetricDescriptorMetadataLaunchStage where
parseJSON = parseJSONText "MetricDescriptorMetadataLaunchStage"
instance ToJSON MetricDescriptorMetadataLaunchStage where
toJSON = toJSONText
data LabelDescriptorValueType
= LDVTString
| LDVTBool
| LDVTINT64
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable LabelDescriptorValueType
instance FromHttpApiData LabelDescriptorValueType where
parseQueryParam = \case
"STRING" -> Right LDVTString
"BOOL" -> Right LDVTBool
"INT64" -> Right LDVTINT64
x -> Left ("Unable to parse LabelDescriptorValueType from: " <> x)
instance ToHttpApiData LabelDescriptorValueType where
toQueryParam = \case
LDVTString -> "STRING"
LDVTBool -> "BOOL"
LDVTINT64 -> "INT64"
instance FromJSON LabelDescriptorValueType where
parseJSON = parseJSONText "LabelDescriptorValueType"
instance ToJSON LabelDescriptorValueType where
toJSON = toJSONText
data APISyntax
= ASSyntaxPROTO2
| ASSyntaxPROTO3
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable APISyntax
instance FromHttpApiData APISyntax where
parseQueryParam = \case
"SYNTAX_PROTO2" -> Right ASSyntaxPROTO2
"SYNTAX_PROTO3" -> Right ASSyntaxPROTO3
x -> Left ("Unable to parse APISyntax from: " <> x)
instance ToHttpApiData APISyntax where
toQueryParam = \case
ASSyntaxPROTO2 -> "SYNTAX_PROTO2"
ASSyntaxPROTO3 -> "SYNTAX_PROTO3"
instance FromJSON APISyntax where
parseJSON = parseJSONText "APISyntax"
instance ToJSON APISyntax where
toJSON = toJSONText
data TypeSyntax
= TSSyntaxPROTO2
| TSSyntaxPROTO3
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable TypeSyntax
instance FromHttpApiData TypeSyntax where
parseQueryParam = \case
"SYNTAX_PROTO2" -> Right TSSyntaxPROTO2
"SYNTAX_PROTO3" -> Right TSSyntaxPROTO3
x -> Left ("Unable to parse TypeSyntax from: " <> x)
instance ToHttpApiData TypeSyntax where
toQueryParam = \case
TSSyntaxPROTO2 -> "SYNTAX_PROTO2"
TSSyntaxPROTO3 -> "SYNTAX_PROTO3"
instance FromJSON TypeSyntax where
parseJSON = parseJSONText "TypeSyntax"
instance ToJSON TypeSyntax where
toJSON = toJSONText
data Xgafv
= X1
| X2
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable Xgafv
instance FromHttpApiData Xgafv where
parseQueryParam = \case
"1" -> Right X1
"2" -> Right X2
x -> Left ("Unable to parse Xgafv from: " <> x)
instance ToHttpApiData Xgafv where
toQueryParam = \case
X1 -> "1"
X2 -> "2"
instance FromJSON Xgafv where
parseJSON = parseJSONText "Xgafv"
instance ToJSON Xgafv where
toJSON = toJSONText
data FieldCardinality
= CardinalityUnknown
| CardinalityOptional
| CardinalityRequired
| CardinalityRepeated
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable FieldCardinality
instance FromHttpApiData FieldCardinality where
parseQueryParam = \case
"CARDINALITY_UNKNOWN" -> Right CardinalityUnknown
"CARDINALITY_OPTIONAL" -> Right CardinalityOptional
"CARDINALITY_REQUIRED" -> Right CardinalityRequired
"CARDINALITY_REPEATED" -> Right CardinalityRepeated
x -> Left ("Unable to parse FieldCardinality from: " <> x)
instance ToHttpApiData FieldCardinality where
toQueryParam = \case
CardinalityUnknown -> "CARDINALITY_UNKNOWN"
CardinalityOptional -> "CARDINALITY_OPTIONAL"
CardinalityRequired -> "CARDINALITY_REQUIRED"
CardinalityRepeated -> "CARDINALITY_REPEATED"
instance FromJSON FieldCardinality where
parseJSON = parseJSONText "FieldCardinality"
instance ToJSON FieldCardinality where
toJSON = toJSONText
data MetricDescriptorMetricKind
= MetricKindUnspecified
| Gauge
| Delta
| Cumulative
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable MetricDescriptorMetricKind
instance FromHttpApiData MetricDescriptorMetricKind where
parseQueryParam = \case
"METRIC_KIND_UNSPECIFIED" -> Right MetricKindUnspecified
"GAUGE" -> Right Gauge
"DELTA" -> Right Delta
"CUMULATIVE" -> Right Cumulative
x -> Left ("Unable to parse MetricDescriptorMetricKind from: " <> x)
instance ToHttpApiData MetricDescriptorMetricKind where
toQueryParam = \case
MetricKindUnspecified -> "METRIC_KIND_UNSPECIFIED"
Gauge -> "GAUGE"
Delta -> "DELTA"
Cumulative -> "CUMULATIVE"
instance FromJSON MetricDescriptorMetricKind where
parseJSON = parseJSONText "MetricDescriptorMetricKind"
instance ToJSON MetricDescriptorMetricKind where
toJSON = toJSONText
data MethodSyntax
= MSSyntaxPROTO2
| MSSyntaxPROTO3
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable MethodSyntax
instance FromHttpApiData MethodSyntax where
parseQueryParam = \case
"SYNTAX_PROTO2" -> Right MSSyntaxPROTO2
"SYNTAX_PROTO3" -> Right MSSyntaxPROTO3
x -> Left ("Unable to parse MethodSyntax from: " <> x)
instance ToHttpApiData MethodSyntax where
toQueryParam = \case
MSSyntaxPROTO2 -> "SYNTAX_PROTO2"
MSSyntaxPROTO3 -> "SYNTAX_PROTO3"
instance FromJSON MethodSyntax where
parseJSON = parseJSONText "MethodSyntax"
instance ToJSON MethodSyntax where
toJSON = toJSONText