Skip to content

Commit

Permalink
working operations for deployment freezes
Browse files Browse the repository at this point in the history
  • Loading branch information
benPearce1 committed Nov 21, 2024
1 parent 92b4c45 commit b9716ee
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
1 change: 0 additions & 1 deletion pkg/client/octopusdeploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ func NewClientWithCredentials(httpClient *http.Client, apiURL *url.URL, apiCrede
Configuration: configuration.NewConfigurationService(base, configurationPath, versionControlClearCachePath),
DashboardConfigurations: dashboard.NewDashboardConfigurationService(base, dashboardConfigurationPath),
Dashboards: dashboard.NewDashboardService(base, dashboardPath, dashboardDynamicPath),
DeploymentFreezes: deploymentfreezes.NewDeploymentFreezeService(),
DeploymentProcesses: deployments.NewDeploymentProcessService(base, deploymentProcessesPath),
Deployments: deployments.NewDeploymentService(base, deploymentsPath),
DynamicExtensions: extensions.NewDynamicExtensionService(base, dynamicExtensionsPath, dynamicExtensionsFeaturesMetadataPath, dynamicExtensionsFeaturesValuesPath, dynamicExtensionsScriptsPath),
Expand Down
21 changes: 19 additions & 2 deletions pkg/deploymentfreezes/deploymentfreezes_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@ func Get(client newclient.Client, deploymentFreezesQuery *DeploymentFreezeQuery)
return res, nil
}

func GetById(client newclient.Client, id string) (*DeploymentFreeze, error) {
path, err := client.URITemplateCache().Expand(template, map[string]any{
"id": id,
})
if err != nil {
return nil, err
}

res, err := newclient.Get[DeploymentFreeze](client.HttpSession(), path)
if err != nil {
return &DeploymentFreeze{}, err
}

return res, nil

}

func GetAll(client newclient.Client) ([]*DeploymentFreeze, error) {
path, err := client.URITemplateCache().Expand(template, &DeploymentFreezeQuery{Skip: 0, Take: math.MaxInt32})
if err != nil {
Expand Down Expand Up @@ -64,7 +81,7 @@ func Update(client newclient.Client, deploymentFreeze *DeploymentFreeze) (*Deplo
return nil, internal.CreateRequiredParameterIsEmptyOrNilError("deploymentFreeze")
}

path, err := client.URITemplateCache().Expand(template, deploymentFreeze)
path, err := client.URITemplateCache().Expand(template, map[string]any{"id": deploymentFreeze.ID})
if err != nil {
return nil, err
}
Expand All @@ -81,7 +98,7 @@ func Delete(client newclient.Client, deploymentFreeze *DeploymentFreeze) error {
return internal.CreateRequiredParameterIsEmptyOrNilError("deploymentFreeze")
}

path, err := client.URITemplateCache().Expand(template, deploymentFreeze)
path, err := client.URITemplateCache().Expand(template, map[string]any{"id": deploymentFreeze.ID})
if err != nil {
return err
}
Expand Down

0 comments on commit b9716ee

Please sign in to comment.