(folderId int, processKey string, processVersion string)
| 207 | } |
| 208 | |
| 209 | func (c OrchestratorClient) CreateRelease(folderId int, processKey string, processVersion string) (int, error) { |
| 210 | request, err := c.createNewReleaseRequest(folderId, processKey, processVersion) |
| 211 | if err != nil { |
| 212 | return -1, err |
| 213 | } |
| 214 | client := network.NewHttpClient(c.logger, c.httpClientSettings()) |
| 215 | response, err := client.Send(request) |
| 216 | if err != nil { |
| 217 | return -1, err |
| 218 | } |
| 219 | defer func() { _ = response.Body.Close() }() |
| 220 | body, err := io.ReadAll(response.Body) |
| 221 | if err != nil { |
| 222 | return -1, fmt.Errorf("Error reading response: %w", err) |
| 223 | } |
| 224 | if response.StatusCode != http.StatusCreated { |
| 225 | return -1, fmt.Errorf("Orchestrator returned status code '%v' and body '%v'", response.StatusCode, string(body)) |
| 226 | } |
| 227 | |
| 228 | var result createReleaseResponseJson |
| 229 | err = json.Unmarshal(body, &result) |
| 230 | if err != nil { |
| 231 | return -1, fmt.Errorf("Orchestrator returned invalid response body '%v'", string(body)) |
| 232 | } |
| 233 | return result.Id, nil |
| 234 | } |
| 235 | |
| 236 | func (c OrchestratorClient) createNewReleaseRequest(folderId int, processKey string, processVersion string) (*network.HttpRequest, error) { |
| 237 | json, err := json.Marshal(createReleaseRequestJson{ |
no test coverage detected