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

Doc/update struct member doc #30

Merged
merged 8 commits into from
May 16, 2024
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
11 changes: 6 additions & 5 deletions bonsai/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type ClusterStats struct {

// ClusterAccess holds information about connecting to the cluster.
type ClusterAccess struct {
// Host name of the cluster
// Host name of the cluster.
Host string `json:"host"`
// HTTP Port the cluster is running on.
Port int `json:"port"`
Expand Down Expand Up @@ -67,19 +67,20 @@ const (
ClusterStateUpdatingPlan ClusterState = "UPDATING PLAN"
)

// Cluster represents a subscription cluster.
// Cluster represents a single cluster on your account.
type Cluster struct {
// Slug represents a unique, machine-readable name for the cluster.
// A cluster slug is based its name at creation, to which a random integer
// is concatenated.
Slug string `json:"slug"`
// Name is the human-readable name of the cluster.
Name string `json:"name"`
// URI is a machine-readable name for the cluster.
// URI is a link to additional information about this cluster.
URI string `json:"uri"`

// Plan holds some information about the cluster's current subscription plan.
Plan Plan `json:"plan"`

// Release holds some information about the cluster's current release.
Release Release `json:"release"`

Expand Down Expand Up @@ -178,7 +179,7 @@ type ClusterCreateOpts struct {
// The slug of the Plan that the new cluster will be configured for.
// Use the [PlanClient.All] method to view a list of all Plans available.
Plan string `json:"plan,omitempty"`
// The slug of the Space where the new cluster should be deployed to.
// The path of the Space where the new cluster should be deployed to.
// Use the [SpaceClient.All] method to view a list of all Spaces.
Space string `json:"space,omitempty"`
// The Search Service Release that the new cluster will use.
Expand Down Expand Up @@ -282,7 +283,7 @@ func (c *ClusterClient) list(ctx context.Context, opt clusterListOpts) (
return results.Clusters, resp, nil
}

// All lists all Clusters from the Clusters API.
// All lists all active clusters on your account.
func (c *ClusterClient) All(ctx context.Context) ([]Cluster, error) {
var (
err error
Expand Down
4 changes: 3 additions & 1 deletion bonsai/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ type planAllResponse struct {
// A collection of search release slugs available for the plan. Additional
// information about a release can be retrieved from the Releases API.
AvailableReleases []string `json:"available_releases"`
AvailableSpaces []string `json:"available_spaces"`
// A collection of Space paths available for the plan. Additional
// information about a space can be retrieved from the Spaces API.
AvailableSpaces []string `json:"available_spaces"`

// A URI to retrieve more information about this Plan.
URI string `json:"uri,omitempty"`
Expand Down
15 changes: 10 additions & 5 deletions bonsai/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ import (

const ReleaseAPIBasePath = "/releases"

// Release is a placeholder for now.
// Release is a version of Elasticsearch available to the account.
type Release struct {
Name string `json:"name,omitempty"`
Slug string `json:"slug,omitempty"`
// The name for the release.
Name string `json:"name,omitempty"`
// The machine-readable name for the deployment.
Slug string `json:"slug,omitempty"`
// The service type of the deployment - for example, "elasticsearch".
ServiceType string `json:"service_type,omitempty"`
Version string `json:"version,omitempty"`
MultiTenant *bool `json:"multitenant,omitempty"`
// The version of the release.
Version string `json:"version,omitempty"`
// Whether the release is available on multitenant deployments.
MultiTenant *bool `json:"multitenant,omitempty"`

// A URI to retrieve more information about this Release.
URI string `json:"uri,omitempty"`
Expand Down
20 changes: 14 additions & 6 deletions bonsai/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,28 @@ const (
// CloudProvider contains details about the cloud provider and region
// attributes.
type CloudProvider struct {
// A machine-readable name for the cloud provider in which this space is
// deployed.
Provider string `json:"provider"`
Region string `json:"region"`
// A machine-readable name for the geographic region of the server group.
Region string `json:"region"`
}

// Space represents the server groups and geographic regions available to their
// account, where clusters may be provisioned.
type Space struct {
Path string `json:"path"`
PrivateNetwork *bool `json:"private_network,omitempty"`
Cloud *CloudProvider `json:"cloud,omitempty"`
// A machine-readable name for the server group.
Path string `json:"path"`
// Indicates whether the space is isolated and inaccessible from the
// public Internet. A VPC connection will be needed to communicate
// with a private cluster.
PrivateNetwork *bool `json:"private_network,omitempty"`
// Details about the cloud provider and region attributes.
Cloud *CloudProvider `json:"cloud,omitempty"`

// The geographic region in which the cluster is running.
Region string `json:"region,omitempty"`
// A URI to retrieve more information about this Release.
// A URI to retrieve more information about this Space.
URI string `json:"uri,omitempty"`
}

Expand Down Expand Up @@ -125,7 +133,7 @@ func (c *SpaceClient) All(ctx context.Context) ([]Space, error) {
return allResults, fmt.Errorf("client.all failed: %w", err)
}

return allResults, err
return allResults, err //nolint:nolintlint
}

//nolint:dupl // Allow duplicated code blocks in code paths that may change
Expand Down
Loading