diff --git a/entropy/job.go b/entropy/job.go new file mode 100644 index 0000000..40412a2 --- /dev/null +++ b/entropy/job.go @@ -0,0 +1,39 @@ +package entropy + +type JobConfig struct { + Stopped bool `json:"stopped,omitempty"` + Replicas int32 `json:"replicas"` + Namespace string `json:"namespace,omitempty"` + Name string `json:"name,omitempty"` + Containers []JobContainer `json:"containers,omitempty"` + JobLabels map[string]string `json:"job_labels,omitempty"` + Volumes []JobVolume `json:"volumes,omitempty"` +} + +type JobVolume struct { + Name string + Kind string // secret or config-map. secret is for gcs/bq credential +} + +type JobContainer struct { + Name string `json:"name"` + Image string `json:"image"` + ImagePullPolicy string `json:"image_pull_policy,omitempty"` + Command []string `json:"command,omitempty"` + SecretsVolumes []JobSecret `json:"secrets_volumes,omitempty"` + ConfigMapsVolumes []JobConfigMap `json:"config_maps_volumes,omitempty"` + Limits *UsageSpec `json:"limits,omitempty"` + Requests *UsageSpec `json:"requests,omitempty"` + EnvConfigMaps []string `json:"env_config_maps,omitempty"` + EnvVariables map[string]string `json:"env_variables,omitempty"` +} + +type JobSecret struct { + Name string `json:"name"` + Mount string `json:"mount"` +} + +type JobConfigMap struct { + Name string `json:"name"` + Mount string `json:"mount"` +} diff --git a/entropy/kind.go b/entropy/kind.go new file mode 100644 index 0000000..b919e21 --- /dev/null +++ b/entropy/kind.go @@ -0,0 +1,6 @@ +package entropy + +const ( + ResourceKindFirehose = "firehose" + ResourceKindJob = "job" +) diff --git a/entropy/kube_job.go b/entropy/kube_job.go deleted file mode 100644 index 6b59fb4..0000000 --- a/entropy/kube_job.go +++ /dev/null @@ -1,39 +0,0 @@ -package entropy - -type KubeJobConfig struct { - Stopped bool `json:"stopped,omitempty"` - Replicas int32 `json:"replicas"` - Namespace string `json:"namespace,omitempty"` - Name string `json:"name,omitempty"` - Containers []KubeJobContainer `json:"containers,omitempty"` - JobLabels map[string]string `json:"job_labels,omitempty"` - Volumes []KubeJobVolume `json:"volumes,omitempty"` -} - -type KubeJobVolume struct { - Name string - Kind string // secret or config-map. secret is for gcs/bq credential -} - -type KubeJobContainer struct { - Name string `json:"name"` - Image string `json:"image"` - ImagePullPolicy string `json:"image_pull_policy,omitempty"` - Command []string `json:"command,omitempty"` - SecretsVolumes []KubeJobSecret `json:"secrets_volumes,omitempty"` - ConfigMapsVolumes []KubeJobConfigMap `json:"config_maps_volumes,omitempty"` - Limits *UsageSpec `json:"limits,omitempty"` - Requests *UsageSpec `json:"requests,omitempty"` - EnvConfigMaps []string `json:"env_config_maps,omitempty"` - EnvVariables map[string]string `json:"env_variables,omitempty"` -} - -type KubeJobSecret struct { - Name string `json:"name"` - Mount string `json:"mount"` -} - -type KubeJobConfigMap struct { - Name string `json:"name"` - Mount string `json:"mount"` -} diff --git a/generated/models/dlq_job.go b/generated/models/dlq_job.go index b4a2ada..d50ead8 100644 --- a/generated/models/dlq_job.go +++ b/generated/models/dlq_job.go @@ -50,7 +50,8 @@ type DlqJob struct { ResourceID string `json:"resource_id,omitempty"` // resource type - ResourceType *string `json:"resource_type,omitempty"` + // Enum: [firehose] + ResourceType string `json:"resource_type,omitempty"` // status // Enum: [pending error running stopped] @@ -78,6 +79,10 @@ func (m *DlqJob) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateResourceType(formats); err != nil { + res = append(res, err) + } + if err := m.validateStatus(formats); err != nil { res = append(res, err) } @@ -104,6 +109,45 @@ func (m *DlqJob) validateCreatedAt(formats strfmt.Registry) error { return nil } +var dlqJobTypeResourceTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["firehose"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + dlqJobTypeResourceTypePropEnum = append(dlqJobTypeResourceTypePropEnum, v) + } +} + +const ( + + // DlqJobResourceTypeFirehose captures enum value "firehose" + DlqJobResourceTypeFirehose string = "firehose" +) + +// prop value enum +func (m *DlqJob) validateResourceTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, dlqJobTypeResourceTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *DlqJob) validateResourceType(formats strfmt.Registry) error { + if swag.IsZero(m.ResourceType) { // not required + return nil + } + + // value enum + if err := m.validateResourceTypeEnum("resource_type", "body", m.ResourceType); err != nil { + return err + } + + return nil +} + var dlqJobTypeStatusPropEnum []interface{} func init() { diff --git a/swagger.yml b/swagger.yml index 908c531..531154f 100644 --- a/swagger.yml +++ b/swagger.yml @@ -1242,7 +1242,8 @@ definitions: type: string resource_type: type: string - default: firehose + enum: + - firehose error_types: type: string description: "List of firehose error types, comma separated"