/
types.go
146 lines (128 loc) · 5.12 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// Code generated by goa v3.13.2, DO NOT EDIT.
//
// pipeline HTTP client types
//
// Command:
// $ goa gen github.com/artefactual-labs/enduro/internal/api/design -o
// internal/api
package client
import (
pipeline "github.com/artefactual-labs/enduro/internal/api/gen/pipeline"
pipelineviews "github.com/artefactual-labs/enduro/internal/api/gen/pipeline/views"
goa "goa.design/goa/v3/pkg"
)
// ListResponseBody is the type of the "pipeline" service "list" endpoint HTTP
// response body.
type ListResponseBody []*EnduroStoredPipelineResponse
// ShowResponseBody is the type of the "pipeline" service "show" endpoint HTTP
// response body.
type ShowResponseBody struct {
// Identifier of pipeline
ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
// Name of the pipeline
Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
// Maximum concurrent transfers
Capacity *int64 `form:"capacity,omitempty" json:"capacity,omitempty" xml:"capacity,omitempty"`
// Current transfers
Current *int64 `form:"current,omitempty" json:"current,omitempty" xml:"current,omitempty"`
Status *string `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"`
}
// ShowNotFoundResponseBody is the type of the "pipeline" service "show"
// endpoint HTTP response body for the "not_found" error.
type ShowNotFoundResponseBody struct {
// Message of error
Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
// Identifier of missing pipeline
ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
}
// ProcessingNotFoundResponseBody is the type of the "pipeline" service
// "processing" endpoint HTTP response body for the "not_found" error.
type ProcessingNotFoundResponseBody struct {
// Message of error
Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
// Identifier of missing pipeline
ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
}
// EnduroStoredPipelineResponse is used to define fields on response body types.
type EnduroStoredPipelineResponse struct {
// Identifier of pipeline
ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
// Name of the pipeline
Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
// Maximum concurrent transfers
Capacity *int64 `form:"capacity,omitempty" json:"capacity,omitempty" xml:"capacity,omitempty"`
// Current transfers
Current *int64 `form:"current,omitempty" json:"current,omitempty" xml:"current,omitempty"`
Status *string `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"`
}
// NewListEnduroStoredPipelineOK builds a "pipeline" service "list" endpoint
// result from a HTTP "OK" response.
func NewListEnduroStoredPipelineOK(body []*EnduroStoredPipelineResponse) []*pipeline.EnduroStoredPipeline {
v := make([]*pipeline.EnduroStoredPipeline, len(body))
for i, val := range body {
v[i] = unmarshalEnduroStoredPipelineResponseToPipelineEnduroStoredPipeline(val)
}
return v
}
// NewShowEnduroStoredPipelineOK builds a "pipeline" service "show" endpoint
// result from a HTTP "OK" response.
func NewShowEnduroStoredPipelineOK(body *ShowResponseBody) *pipelineviews.EnduroStoredPipelineView {
v := &pipelineviews.EnduroStoredPipelineView{
ID: body.ID,
Name: body.Name,
Capacity: body.Capacity,
Current: body.Current,
Status: body.Status,
}
return v
}
// NewShowNotFound builds a pipeline service show endpoint not_found error.
func NewShowNotFound(body *ShowNotFoundResponseBody) *pipeline.PipelineNotFound {
v := &pipeline.PipelineNotFound{
Message: *body.Message,
ID: *body.ID,
}
return v
}
// NewProcessingNotFound builds a pipeline service processing endpoint
// not_found error.
func NewProcessingNotFound(body *ProcessingNotFoundResponseBody) *pipeline.PipelineNotFound {
v := &pipeline.PipelineNotFound{
Message: *body.Message,
ID: *body.ID,
}
return v
}
// ValidateShowNotFoundResponseBody runs the validations defined on
// show_not_found_response_body
func ValidateShowNotFoundResponseBody(body *ShowNotFoundResponseBody) (err error) {
if body.Message == nil {
err = goa.MergeErrors(err, goa.MissingFieldError("message", "body"))
}
if body.ID == nil {
err = goa.MergeErrors(err, goa.MissingFieldError("id", "body"))
}
return
}
// ValidateProcessingNotFoundResponseBody runs the validations defined on
// processing_not_found_response_body
func ValidateProcessingNotFoundResponseBody(body *ProcessingNotFoundResponseBody) (err error) {
if body.Message == nil {
err = goa.MergeErrors(err, goa.MissingFieldError("message", "body"))
}
if body.ID == nil {
err = goa.MergeErrors(err, goa.MissingFieldError("id", "body"))
}
return
}
// ValidateEnduroStoredPipelineResponse runs the validations defined on
// EnduroStored-PipelineResponse
func ValidateEnduroStoredPipelineResponse(body *EnduroStoredPipelineResponse) (err error) {
if body.Name == nil {
err = goa.MergeErrors(err, goa.MissingFieldError("name", "body"))
}
if body.ID != nil {
err = goa.MergeErrors(err, goa.ValidateFormat("body.id", *body.ID, goa.FormatUUID))
}
return
}