From dd4558df78fabe797880c8d4ff2d3a04e8458a0a Mon Sep 17 00:00:00 2001 From: Marko Simon Date: Thu, 7 Nov 2024 22:40:37 +0100 Subject: [PATCH 1/8] add deployment pipeline resource --- client.go | 90 +++++++------- deployment_pipeline.go | 259 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 305 insertions(+), 44 deletions(-) create mode 100644 deployment_pipeline.go diff --git a/client.go b/client.go index c0f6107..da91efc 100644 --- a/client.go +++ b/client.go @@ -222,51 +222,53 @@ func getGenericAPIError(response *resty.Response, expectedStatusCode ...int) err // apiRoutes defines api routes var apiRoutes = struct { - alerts string - alertActions string - alertSources string - automationRules string - connections string - connectors string - escalationPolicies string - events string - heartbeats string - incidents string - incidentTemplates string - metrics string - metricDataSources string - numbers string - schedules string - series string - services string - statusPages string - supportHours string - uptimeMonitors string - users string - teams string + alerts string + alertActions string + alertSources string + automationRules string + connections string + connectors string + deploymentPipelines string + escalationPolicies string + events string + heartbeats string + incidents string + incidentTemplates string + metrics string + metricDataSources string + numbers string + schedules string + series string + services string + statusPages string + supportHours string + uptimeMonitors string + users string + teams string }{ - alerts: "/api/alerts", - alertActions: "/api/alert-actions", - alertSources: "/api/alert-sources", - automationRules: "/api/automation-rules", - connections: "/api/v1/connections", - connectors: "/api/connectors", - escalationPolicies: "/api/escalation-policies", - events: "/api/events", - heartbeats: "/api/heartbeats", - incidents: "/api/incidents", - incidentTemplates: "/api/incident-templates", - metrics: "/api/metrics", - metricDataSources: "/api/metric-data-sources", - numbers: "/api/numbers", - schedules: "/api/schedules", - series: "/api/series", - services: "/api/services", - statusPages: "/api/status-pages", - supportHours: "/api/support-hours", - uptimeMonitors: "/api/uptime-monitors", - users: "/api/users", - teams: "/api/teams", + alerts: "/api/alerts", + alertActions: "/api/alert-actions", + alertSources: "/api/alert-sources", + automationRules: "/api/automation-rules", + connections: "/api/v1/connections", + connectors: "/api/connectors", + deploymentPipelines: "/api/deployment-pipelines", + escalationPolicies: "/api/escalation-policies", + events: "/api/events", + heartbeats: "/api/heartbeats", + incidents: "/api/incidents", + incidentTemplates: "/api/incident-templates", + metrics: "/api/metrics", + metricDataSources: "/api/metric-data-sources", + numbers: "/api/numbers", + schedules: "/api/schedules", + series: "/api/series", + services: "/api/services", + statusPages: "/api/status-pages", + supportHours: "/api/support-hours", + uptimeMonitors: "/api/uptime-monitors", + users: "/api/users", + teams: "/api/teams", } func getEnv(key string) *string { diff --git a/deployment_pipeline.go b/deployment_pipeline.go new file mode 100644 index 0000000..26a100f --- /dev/null +++ b/deployment_pipeline.go @@ -0,0 +1,259 @@ +package ilert + +import ( + "encoding/json" + "errors" + "fmt" + "net/url" + "strconv" +) + +// DeploymentPipeline definition https://api.ilert.com/api-docs/#tag/deployment-pipelines +type DeploymentPipeline struct { + ID int64 `json:"id"` + Name string `json:"name"` + IntegrationType string `json:"integrationType"` + IntegrationKey string `json:"integrationKey,omitempty"` + Teams []TeamShort `json:"teams,omitempty"` + CreatedAt string `json:"createdAt,omitempty"` + UpdatedAt string `json:"updatedAt,omitempty"` + IntegrationUrl string `json:"integrationUrl,omitempty"` + Params *DeploymentPipelineParams `json:"params"` +} + +// DeploymentPipelineParams defines settings for a deployment pipeline +type DeploymentPipelineParams struct { + BranchFilters []string `json:"branchFilters,omitempty"` // used for GitHub + EventFilters []string `json:"eventFilters,omitempty"` // used for GitHub +} + +// CreateDeploymentPipelineInput represents the input of a CreateDeploymentPipeline operation. +type CreateDeploymentPipelineInput struct { + _ struct{} + DeploymentPipeline *DeploymentPipeline +} + +// CreateDeploymentPipelineOutput represents the output of a CreateDeploymentPipeline operation. +type CreateDeploymentPipelineOutput struct { + _ struct{} + DeploymentPipeline *DeploymentPipeline +} + +// CreateDeploymentPipeline creates a new deployment pipeline resource. https://api.ilert.com/api-docs/#tag/deployment-pipelines/post/deployment-pipelines +func (c *Client) CreateDeploymentPipeline(input *CreateDeploymentPipelineInput) (*CreateDeploymentPipelineOutput, error) { + if input == nil { + return nil, errors.New("input is required") + } + if input.DeploymentPipeline == nil { + return nil, errors.New("deployment pipeline input is required") + } + resp, err := c.httpClient.R().SetBody(input.DeploymentPipeline).Post(apiRoutes.deploymentPipelines) + if err != nil { + return nil, err + } + if apiErr := getGenericAPIError(resp, 201); apiErr != nil { + return nil, apiErr + } + + deploymentPipeline := &DeploymentPipeline{} + err = json.Unmarshal(resp.Body(), deploymentPipeline) + if err != nil { + return nil, err + } + + return &CreateDeploymentPipelineOutput{DeploymentPipeline: deploymentPipeline}, nil +} + +// GetDeploymentPipelineInput represents the input of a GetDeploymentPipeline operation. +type GetDeploymentPipelineInput struct { + _ struct{} + DeploymentPipelineID *int64 +} + +// GetDeploymentPipelineOutput represents the output of a GetDeploymentPipeline operation. +type GetDeploymentPipelineOutput struct { + _ struct{} + DeploymentPipeline *DeploymentPipeline +} + +// GetDeploymentPipeline gets the deployment pipelines resource with specified id. https://api.ilert.com/api-docs/#tag/deployment-pipelines/get/deployment-pipelines/{id} +func (c *Client) GetDeploymentPipeline(input *GetDeploymentPipelineInput) (*GetDeploymentPipelineOutput, error) { + if input == nil { + return nil, errors.New("input is required") + } + if input.DeploymentPipelineID == nil { + return nil, errors.New("deployment pipeline id is required") + } + + resp, err := c.httpClient.R().Get(fmt.Sprintf("%s/%d", apiRoutes.deploymentPipelines, *input.DeploymentPipelineID)) + if err != nil { + return nil, err + } + if apiErr := getGenericAPIError(resp, 200); apiErr != nil { + return nil, apiErr + } + + deploymentPipeline := &DeploymentPipeline{} + err = json.Unmarshal(resp.Body(), deploymentPipeline) + if err != nil { + return nil, err + } + + return &GetDeploymentPipelineOutput{DeploymentPipeline: deploymentPipeline}, nil +} + +// GetDeploymentPipelinesInput represents the input of a GetDeploymentPipelines operation. +type GetDeploymentPipelinesInput struct { + _ struct{} + + // an integer specifying the starting point (beginning with 0) when paging through a list of entities + StartIndex *int + + // the maximum number of results when paging through a list of entities. + // Maximum: 100 + MaxResults *int +} + +// GetDeploymentPipelinesOutput represents the output of a GetDeploymentPipelines operation. +type GetDeploymentPipelinesOutput struct { + _ struct{} + DeploymentPipelines []*DeploymentPipeline +} + +// GetDeploymentPipelines lists existing deployment pipeline resources. https://api.ilert.com/api-docs/#tag/deployment-pipelines/get/deployment-pipelines +func (c *Client) GetDeploymentPipelines(input *GetDeploymentPipelinesInput) (*GetDeploymentPipelinesOutput, error) { + q := url.Values{} + if input.StartIndex != nil { + q.Add("start-index", strconv.Itoa(*input.StartIndex)) + } + if input.MaxResults != nil { + q.Add("max-results", strconv.Itoa(*input.MaxResults)) + } + + resp, err := c.httpClient.R().Get(fmt.Sprintf("%s?%s", apiRoutes.deploymentPipelines, q.Encode())) + if err != nil { + return nil, err + } + if apiErr := getGenericAPIError(resp, 200); apiErr != nil { + return nil, apiErr + } + + deploymentPipelines := make([]*DeploymentPipeline, 0) + err = json.Unmarshal(resp.Body(), &deploymentPipelines) + if err != nil { + return nil, err + } + + return &GetDeploymentPipelinesOutput{DeploymentPipelines: deploymentPipelines}, nil +} + +// SearchDeploymentPipelineInput represents the input of a SearchDeploymentPipeline operation. +type SearchDeploymentPipelineInput struct { + _ struct{} + DeploymentPipelineName *string +} + +// SearchDeploymentPipelineOutput represents the output of a SearchDeploymentPipeline operation. +type SearchDeploymentPipelineOutput struct { + _ struct{} + DeploymentPipeline *DeploymentPipeline +} + +// SearchDeploymentPipeline gets the deployment pipeline resource with specified name. +func (c *Client) SearchDeploymentPipeline(input *SearchDeploymentPipelineInput) (*SearchDeploymentPipelineOutput, error) { + if input == nil { + return nil, errors.New("input is required") + } + if input.DeploymentPipelineName == nil { + return nil, errors.New("deployment pipeline name is required") + } + + resp, err := c.httpClient.R().Get(fmt.Sprintf("%s/name/%s", apiRoutes.deploymentPipelines, *input.DeploymentPipelineName)) + if err != nil { + return nil, err + } + if apiErr := getGenericAPIError(resp, 200); apiErr != nil { + return nil, apiErr + } + + deploymentPipeline := &DeploymentPipeline{} + err = json.Unmarshal(resp.Body(), deploymentPipeline) + if err != nil { + return nil, err + } + + return &SearchDeploymentPipelineOutput{DeploymentPipeline: deploymentPipeline}, nil +} + +// UpdateDeploymentPipelineInput represents the input of a UpdateDeploymentPipeline operation. +type UpdateDeploymentPipelineInput struct { + _ struct{} + DeploymentPipelineID *int64 + DeploymentPipeline *DeploymentPipeline +} + +// UpdateDeploymentPipelineOutput represents the output of a UpdateDeploymentPipeline operation. +type UpdateDeploymentPipelineOutput struct { + _ struct{} + DeploymentPipeline *DeploymentPipeline +} + +// UpdateDeploymentPipeline updates an existing deployment pipeline resource. https://api.ilert.com/api-docs/#tag/deployment-pipelines/put/deployment-pipelines/{id} +func (c *Client) UpdateDeploymentPipeline(input *UpdateDeploymentPipelineInput) (*UpdateDeploymentPipelineOutput, error) { + if input == nil { + return nil, errors.New("input is required") + } + if input.DeploymentPipeline == nil { + return nil, errors.New("deployment pipeline input is required") + } + if input.DeploymentPipelineID == nil { + return nil, errors.New("deployment pipeline id is required") + } + + resp, err := c.httpClient.R().SetBody(input.DeploymentPipeline).Put(fmt.Sprintf("%s/%d", apiRoutes.deploymentPipelines, *input.DeploymentPipelineID)) + if err != nil { + return nil, err + } + if apiErr := getGenericAPIError(resp, 200); apiErr != nil { + return nil, apiErr + } + + deploymentPipeline := &DeploymentPipeline{} + err = json.Unmarshal(resp.Body(), deploymentPipeline) + if err != nil { + return nil, err + } + + return &UpdateDeploymentPipelineOutput{DeploymentPipeline: deploymentPipeline}, nil +} + +// DeleteDeploymentPipelineInput represents the input of a DeleteDeploymentPipeline operation. +type DeleteDeploymentPipelineInput struct { + _ struct{} + DeploymentPipelineID *int64 +} + +// DeleteDeploymentPipelineOutput represents the output of a DeleteDeploymentPipeline operation. +type DeleteDeploymentPipelineOutput struct { + _ struct{} +} + +// DeleteDeploymentPipeline deletes the specified deployment pipeline resource. https://api.ilert.com/api-docs/#tag/deployment-pipelines/delete/deployment-pipelines/{id} +func (c *Client) DeleteDeploymentPipeline(input *DeleteDeploymentPipelineInput) (*DeleteDeploymentPipelineOutput, error) { + if input == nil { + return nil, errors.New("input is required") + } + if input.DeploymentPipelineID == nil { + return nil, errors.New("deployment pipeline id is required") + } + + resp, err := c.httpClient.R().Delete(fmt.Sprintf("%s/%d", apiRoutes.deploymentPipelines, *input.DeploymentPipelineID)) + if err != nil { + return nil, err + } + if apiErr := getGenericAPIError(resp, 204); apiErr != nil { + return nil, apiErr + } + + return &DeleteDeploymentPipelineOutput{}, nil +} From d398b3eb055b9b4620bfd05adbd1fdbbd54ba97d Mon Sep 17 00:00:00 2001 From: Marko Simon Date: Thu, 7 Nov 2024 22:51:37 +0100 Subject: [PATCH 2/8] add extensible params --- deployment_pipeline.go | 43 ++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/deployment_pipeline.go b/deployment_pipeline.go index 26a100f..4eae45a 100644 --- a/deployment_pipeline.go +++ b/deployment_pipeline.go @@ -10,21 +10,40 @@ import ( // DeploymentPipeline definition https://api.ilert.com/api-docs/#tag/deployment-pipelines type DeploymentPipeline struct { - ID int64 `json:"id"` - Name string `json:"name"` - IntegrationType string `json:"integrationType"` - IntegrationKey string `json:"integrationKey,omitempty"` - Teams []TeamShort `json:"teams,omitempty"` - CreatedAt string `json:"createdAt,omitempty"` - UpdatedAt string `json:"updatedAt,omitempty"` - IntegrationUrl string `json:"integrationUrl,omitempty"` - Params *DeploymentPipelineParams `json:"params"` + ID int64 `json:"id"` + Name string `json:"name"` + IntegrationType string `json:"integrationType"` + IntegrationKey string `json:"integrationKey,omitempty"` + Teams []TeamShort `json:"teams,omitempty"` + CreatedAt string `json:"createdAt,omitempty"` + UpdatedAt string `json:"updatedAt,omitempty"` + IntegrationUrl string `json:"integrationUrl,omitempty"` + Params interface{} `json:"params"` +} + +// DeploymentPipelineOutput definition https://api.ilert.com/api-docs/#tag/deployment-pipelines +type DeploymentPipelineOutput struct { + ID int64 `json:"id"` + Name string `json:"name"` + IntegrationType string `json:"integrationType"` + IntegrationKey string `json:"integrationKey,omitempty"` + Teams []TeamShort `json:"teams,omitempty"` + CreatedAt string `json:"createdAt,omitempty"` + UpdatedAt string `json:"updatedAt,omitempty"` + IntegrationUrl string `json:"integrationUrl,omitempty"` + Params *DeploymentPipelineOutputParams `json:"params"` } // DeploymentPipelineParams defines settings for a deployment pipeline -type DeploymentPipelineParams struct { - BranchFilters []string `json:"branchFilters,omitempty"` // used for GitHub - EventFilters []string `json:"eventFilters,omitempty"` // used for GitHub +type DeploymentPipelineOutputParams struct { + BranchFilters []string `json:"branchFilters,omitempty"` // used for Github + EventFilters []string `json:"eventFilters,omitempty"` // used for Github +} + +// DeploymentPipelineGithubParams definition +type DeploymentPipelineGithubParams struct { + BranchFilters []string `json:"branchFilters,omitempty"` // used for Github + EventFilters []string `json:"eventFilters,omitempty"` // used for Github } // CreateDeploymentPipelineInput represents the input of a CreateDeploymentPipeline operation. From 00cd32c61230c0b087fd4ff66cd5fb20bfdcfa14 Mon Sep 17 00:00:00 2001 From: Marko Simon Date: Thu, 7 Nov 2024 23:36:03 +0100 Subject: [PATCH 3/8] add includes to api calls --- deployment_pipeline.go | 87 +++++++++++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 13 deletions(-) diff --git a/deployment_pipeline.go b/deployment_pipeline.go index 4eae45a..05ba3ae 100644 --- a/deployment_pipeline.go +++ b/deployment_pipeline.go @@ -15,8 +15,8 @@ type DeploymentPipeline struct { IntegrationType string `json:"integrationType"` IntegrationKey string `json:"integrationKey,omitempty"` Teams []TeamShort `json:"teams,omitempty"` - CreatedAt string `json:"createdAt,omitempty"` - UpdatedAt string `json:"updatedAt,omitempty"` + CreatedAt string `json:"createdAt,omitempty"` // date time string in ISO 8601 + UpdatedAt string `json:"updatedAt,omitempty"` // date time string in ISO 8601 IntegrationUrl string `json:"integrationUrl,omitempty"` Params interface{} `json:"params"` } @@ -28,28 +28,65 @@ type DeploymentPipelineOutput struct { IntegrationType string `json:"integrationType"` IntegrationKey string `json:"integrationKey,omitempty"` Teams []TeamShort `json:"teams,omitempty"` - CreatedAt string `json:"createdAt,omitempty"` - UpdatedAt string `json:"updatedAt,omitempty"` + CreatedAt string `json:"createdAt,omitempty"` // date time string in ISO 8601 + UpdatedAt string `json:"updatedAt,omitempty"` // date time string in ISO 8601 IntegrationUrl string `json:"integrationUrl,omitempty"` Params *DeploymentPipelineOutputParams `json:"params"` } // DeploymentPipelineParams defines settings for a deployment pipeline type DeploymentPipelineOutputParams struct { - BranchFilters []string `json:"branchFilters,omitempty"` // used for Github - EventFilters []string `json:"eventFilters,omitempty"` // used for Github + BranchFilters []string `json:"branchFilters,omitempty"` // used for GitHub + EventFilters []string `json:"eventFilters,omitempty"` // used for GitHub } -// DeploymentPipelineGithubParams definition -type DeploymentPipelineGithubParams struct { - BranchFilters []string `json:"branchFilters,omitempty"` // used for Github - EventFilters []string `json:"eventFilters,omitempty"` // used for Github +// DeploymentPipelineGitHubParams definition +type DeploymentPipelineGitHubParams struct { + BranchFilters []string `json:"branchFilters,omitempty"` + EventFilters []string `json:"eventFilters,omitempty"` +} + +// IntegrationType defines integration type +var IntegrationType = struct { + Api string + GitHub string +}{ + Api: "API", + GitHub: "GITHUB", +} + +// IntegrationTypeAll defines integration type list +var IntegrationTypeAll = []string{ + IntegrationType.Api, + IntegrationType.GitHub, +} + +// GitHubEventFilterType defines github event filter type +var GitHubEventFilterType = struct { + PullRequest string + Push string + Release string +}{ + PullRequest: "pull_request", + Push: "push", + Release: "release", +} + +// GitHubEventFilterTypeAll defines github event filter type list +var GitHubEventFilterTypeAll = []string{ + GitHubEventFilterType.PullRequest, + GitHubEventFilterType.Push, + GitHubEventFilterType.Release, } // CreateDeploymentPipelineInput represents the input of a CreateDeploymentPipeline operation. type CreateDeploymentPipelineInput struct { _ struct{} DeploymentPipeline *DeploymentPipeline + + // describes optional properties that should be included in the response + // possible values: "integrationUrl" + Include []*string } // CreateDeploymentPipelineOutput represents the output of a CreateDeploymentPipeline operation. @@ -66,7 +103,13 @@ func (c *Client) CreateDeploymentPipeline(input *CreateDeploymentPipelineInput) if input.DeploymentPipeline == nil { return nil, errors.New("deployment pipeline input is required") } - resp, err := c.httpClient.R().SetBody(input.DeploymentPipeline).Post(apiRoutes.deploymentPipelines) + + q := url.Values{} + for _, include := range input.Include { + q.Add("include", *include) + } + + resp, err := c.httpClient.R().SetBody(input.DeploymentPipeline).Post(fmt.Sprintf("%s?%s", apiRoutes.deploymentPipelines, q.Encode())) if err != nil { return nil, err } @@ -87,6 +130,10 @@ func (c *Client) CreateDeploymentPipeline(input *CreateDeploymentPipelineInput) type GetDeploymentPipelineInput struct { _ struct{} DeploymentPipelineID *int64 + + // describes optional properties that should be included in the response + // possible values: "integrationUrl" + Include []*string } // GetDeploymentPipelineOutput represents the output of a GetDeploymentPipeline operation. @@ -104,7 +151,12 @@ func (c *Client) GetDeploymentPipeline(input *GetDeploymentPipelineInput) (*GetD return nil, errors.New("deployment pipeline id is required") } - resp, err := c.httpClient.R().Get(fmt.Sprintf("%s/%d", apiRoutes.deploymentPipelines, *input.DeploymentPipelineID)) + q := url.Values{} + for _, include := range input.Include { + q.Add("include", *include) + } + + resp, err := c.httpClient.R().Get(fmt.Sprintf("%s/%d?%s", apiRoutes.deploymentPipelines, *input.DeploymentPipelineID, q.Encode())) if err != nil { return nil, err } @@ -209,6 +261,10 @@ type UpdateDeploymentPipelineInput struct { _ struct{} DeploymentPipelineID *int64 DeploymentPipeline *DeploymentPipeline + + // describes optional properties that should be included in the response + // possible values: "integrationUrl" + Include []*string } // UpdateDeploymentPipelineOutput represents the output of a UpdateDeploymentPipeline operation. @@ -229,7 +285,12 @@ func (c *Client) UpdateDeploymentPipeline(input *UpdateDeploymentPipelineInput) return nil, errors.New("deployment pipeline id is required") } - resp, err := c.httpClient.R().SetBody(input.DeploymentPipeline).Put(fmt.Sprintf("%s/%d", apiRoutes.deploymentPipelines, *input.DeploymentPipelineID)) + q := url.Values{} + for _, include := range input.Include { + q.Add("include", *include) + } + + resp, err := c.httpClient.R().SetBody(input.DeploymentPipeline).Put(fmt.Sprintf("%s/%d?%s", apiRoutes.deploymentPipelines, *input.DeploymentPipelineID, q.Encode())) if err != nil { return nil, err } From 003b25caf798161cb1db1c6add43b44f1376e7f2 Mon Sep 17 00:00:00 2001 From: Marko Simon Date: Thu, 7 Nov 2024 23:36:09 +0100 Subject: [PATCH 4/8] add example --- examples/deployment_pipeline/main.go | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 examples/deployment_pipeline/main.go diff --git a/examples/deployment_pipeline/main.go b/examples/deployment_pipeline/main.go new file mode 100644 index 0000000..cf8ace9 --- /dev/null +++ b/examples/deployment_pipeline/main.go @@ -0,0 +1,30 @@ +package main + +import ( + "log" + + "github.com/iLert/ilert-go/v3" +) + +func main() { + var apiToken = "your API token" + client := ilert.NewClient(ilert.WithAPIToken(apiToken)) + + createDeploymentPipelineInput := &ilert.CreateDeploymentPipelineInput{ + DeploymentPipeline: &ilert.DeploymentPipeline{ + Name: "example", + IntegrationType: ilert.IntegrationType.GitHub, + Params: &ilert.DeploymentPipelineGitHubParams{ + BranchFilters: []string{"main", "master"}, + EventFilters: []string{ilert.GitHubEventFilterType.Release}, + }, + }, + } + + result, err := client.CreateDeploymentPipeline(createDeploymentPipelineInput) + if err != nil { + log.Println(result) + log.Fatalln("ERROR:", err) + } + log.Printf("Deployment pipeline:\n\n %+v\n", result.DeploymentPipeline) +} From 4e2ee7f0e024864c9d7b43617ea650d67403fa74 Mon Sep 17 00:00:00 2001 From: Marko Simon Date: Thu, 7 Nov 2024 23:52:09 +0100 Subject: [PATCH 5/8] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ce82a4..1d125f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 07.11.2024, Version 3.11.0 + +- add new resource deployment pipeline [#47](https://github.com/iLert/ilert-go/pull/47) + ## 01.10.2024, Version 3.10.1 - fix to ensure backwards compatibility when using conditions field [#46](https://github.com/iLert/ilert-go/pull/46) From 4f3ce4c3df2cb8ee63ce1bfd8a8c193ce7516c0d Mon Sep 17 00:00:00 2001 From: Marko Simon Date: Thu, 7 Nov 2024 23:52:29 +0100 Subject: [PATCH 6/8] bump version --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index df716f7..adc009b 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,4 @@ package ilert // Version package version -const Version = "v3.10.1" +const Version = "v3.11.0" From 47c1e0d3547a9e192fbd290f02e0f2dcd94ff190 Mon Sep 17 00:00:00 2001 From: Marko Simon Date: Mon, 11 Nov 2024 15:37:31 +0100 Subject: [PATCH 7/8] adjust name --- deployment_pipeline.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deployment_pipeline.go b/deployment_pipeline.go index 05ba3ae..65e76ea 100644 --- a/deployment_pipeline.go +++ b/deployment_pipeline.go @@ -47,7 +47,7 @@ type DeploymentPipelineGitHubParams struct { } // IntegrationType defines integration type -var IntegrationType = struct { +var DeploymentPipelineIntegrationType = struct { Api string GitHub string }{ @@ -56,9 +56,9 @@ var IntegrationType = struct { } // IntegrationTypeAll defines integration type list -var IntegrationTypeAll = []string{ - IntegrationType.Api, - IntegrationType.GitHub, +var DeploymentPipelineIntegrationTypeAll = []string{ + DeploymentPipelineIntegrationType.Api, + DeploymentPipelineIntegrationType.GitHub, } // GitHubEventFilterType defines github event filter type From 6721b66fc34d0f7a8e147bd22e94a52cd05aed52 Mon Sep 17 00:00:00 2001 From: Marko Simon Date: Sun, 17 Nov 2024 18:50:37 +0100 Subject: [PATCH 8/8] update output payload to use output struct --- deployment_pipeline.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/deployment_pipeline.go b/deployment_pipeline.go index 65e76ea..25a5d44 100644 --- a/deployment_pipeline.go +++ b/deployment_pipeline.go @@ -92,7 +92,7 @@ type CreateDeploymentPipelineInput struct { // CreateDeploymentPipelineOutput represents the output of a CreateDeploymentPipeline operation. type CreateDeploymentPipelineOutput struct { _ struct{} - DeploymentPipeline *DeploymentPipeline + DeploymentPipeline *DeploymentPipelineOutput } // CreateDeploymentPipeline creates a new deployment pipeline resource. https://api.ilert.com/api-docs/#tag/deployment-pipelines/post/deployment-pipelines @@ -117,7 +117,7 @@ func (c *Client) CreateDeploymentPipeline(input *CreateDeploymentPipelineInput) return nil, apiErr } - deploymentPipeline := &DeploymentPipeline{} + deploymentPipeline := &DeploymentPipelineOutput{} err = json.Unmarshal(resp.Body(), deploymentPipeline) if err != nil { return nil, err @@ -139,7 +139,7 @@ type GetDeploymentPipelineInput struct { // GetDeploymentPipelineOutput represents the output of a GetDeploymentPipeline operation. type GetDeploymentPipelineOutput struct { _ struct{} - DeploymentPipeline *DeploymentPipeline + DeploymentPipeline *DeploymentPipelineOutput } // GetDeploymentPipeline gets the deployment pipelines resource with specified id. https://api.ilert.com/api-docs/#tag/deployment-pipelines/get/deployment-pipelines/{id} @@ -164,7 +164,7 @@ func (c *Client) GetDeploymentPipeline(input *GetDeploymentPipelineInput) (*GetD return nil, apiErr } - deploymentPipeline := &DeploymentPipeline{} + deploymentPipeline := &DeploymentPipelineOutput{} err = json.Unmarshal(resp.Body(), deploymentPipeline) if err != nil { return nil, err @@ -188,7 +188,7 @@ type GetDeploymentPipelinesInput struct { // GetDeploymentPipelinesOutput represents the output of a GetDeploymentPipelines operation. type GetDeploymentPipelinesOutput struct { _ struct{} - DeploymentPipelines []*DeploymentPipeline + DeploymentPipelines []*DeploymentPipelineOutput } // GetDeploymentPipelines lists existing deployment pipeline resources. https://api.ilert.com/api-docs/#tag/deployment-pipelines/get/deployment-pipelines @@ -209,7 +209,7 @@ func (c *Client) GetDeploymentPipelines(input *GetDeploymentPipelinesInput) (*Ge return nil, apiErr } - deploymentPipelines := make([]*DeploymentPipeline, 0) + deploymentPipelines := make([]*DeploymentPipelineOutput, 0) err = json.Unmarshal(resp.Body(), &deploymentPipelines) if err != nil { return nil, err @@ -227,7 +227,7 @@ type SearchDeploymentPipelineInput struct { // SearchDeploymentPipelineOutput represents the output of a SearchDeploymentPipeline operation. type SearchDeploymentPipelineOutput struct { _ struct{} - DeploymentPipeline *DeploymentPipeline + DeploymentPipeline *DeploymentPipelineOutput } // SearchDeploymentPipeline gets the deployment pipeline resource with specified name. @@ -247,7 +247,7 @@ func (c *Client) SearchDeploymentPipeline(input *SearchDeploymentPipelineInput) return nil, apiErr } - deploymentPipeline := &DeploymentPipeline{} + deploymentPipeline := &DeploymentPipelineOutput{} err = json.Unmarshal(resp.Body(), deploymentPipeline) if err != nil { return nil, err @@ -270,7 +270,7 @@ type UpdateDeploymentPipelineInput struct { // UpdateDeploymentPipelineOutput represents the output of a UpdateDeploymentPipeline operation. type UpdateDeploymentPipelineOutput struct { _ struct{} - DeploymentPipeline *DeploymentPipeline + DeploymentPipeline *DeploymentPipelineOutput } // UpdateDeploymentPipeline updates an existing deployment pipeline resource. https://api.ilert.com/api-docs/#tag/deployment-pipelines/put/deployment-pipelines/{id} @@ -298,7 +298,7 @@ func (c *Client) UpdateDeploymentPipeline(input *UpdateDeploymentPipelineInput) return nil, apiErr } - deploymentPipeline := &DeploymentPipeline{} + deploymentPipeline := &DeploymentPipelineOutput{} err = json.Unmarshal(resp.Body(), deploymentPipeline) if err != nil { return nil, err