Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: serverStatus and serverStatusService.Get() #50

Merged
merged 1 commit into from
Mar 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions integration/server_status_service_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package integration

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestServerStatusServiceGet(t *testing.T) {
client := getOctopusClient()
require.NotNil(t, client)

serverStatus, err := client.ServerStatus.Get()
require.NoError(t, err)
require.NotNil(t, serverStatus)
}
2 changes: 1 addition & 1 deletion octopusdeploy/constants_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const (
ServiceSchedulerService string = "SchedulerService"
ServiceScopedUserRoleService string = "ScopedUserRoleService"
ServiceServerConfigurationService string = "ServerConfigurationService"
ServiceServerStatuService string = "ServerStatuService"
ServiceServerStatusService string = "ServerStatusService"
ServiceSpaceService string = "SpaceService"
ServiceSMTPConfigurationService string = "SMTPConfigurationService"
ServiceSubscriptionService string = "SubscriptionService"
Expand Down
13 changes: 13 additions & 0 deletions octopusdeploy/server_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package octopusdeploy

type ServerStatus struct {
IsDatabaseEncrypted bool `json:"IsDatabaseEncrypted,omitempty"`
IsMajorMinorUpgrade bool `json:"IsMajorMinorUpgrade,omitempty"`
IsInMaintenanceMode bool `json:"IsInMaintenanceMode,omitempty"`
IsUpgradeAvailable bool `json:"IsUpgradeAvailable,omitempty"`
MaintenanceExpires string `json:"MaintenanceExpires,omitempty"`
MaximumAvailableVersion string `json:"MaximumAvailableVersion,omitempty"`
MaximumAvailableVersionCoveredByLicense string `json:"MaximumAvailableVersionCoveredByLicense,omitempty"`

resource
}
19 changes: 18 additions & 1 deletion octopusdeploy/server_status_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@ func newServerStatusService(sling *sling.Sling, uriTemplate string, extensionSta
extensionStatsPath: extensionStatsPath,
healthStatusPath: healthStatusPath,
timezonesPath: timezonesPath,
service: newService(ServiceServerStatuService, sling, uriTemplate),
service: newService(ServiceServerStatusService, sling, uriTemplate),
}
}

// Get returns the status of the server.
func (s serverStatusService) Get() (*ServerStatus, error) {
path, err := getPath(s)
if err != nil {
return nil, err
}

response, err := apiGet(s.getClient(), new(ServerStatus), path)
if err != nil {
return nil, err
}

return response.(*ServerStatus), nil
}

var _ IService = &serverStatusService{}