Skip to content

Commit

Permalink
Add documentation snippets for PG LA (#530)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarber-akamai authored Jun 20, 2024
1 parent e55147a commit 9bb3d96
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 21 deletions.
46 changes: 25 additions & 21 deletions instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,28 @@ const (

// Instance represents a linode object
type Instance struct {
ID int `json:"id"`
Created *time.Time `json:"-"`
Updated *time.Time `json:"-"`
Region string `json:"region"`
Alerts *InstanceAlert `json:"alerts"`
Backups *InstanceBackup `json:"backups"`
Image string `json:"image"`
Group string `json:"group"`
IPv4 []*net.IP `json:"ipv4"`
IPv6 string `json:"ipv6"`
Label string `json:"label"`
Type string `json:"type"`
Status InstanceStatus `json:"status"`
HasUserData bool `json:"has_user_data"`
Hypervisor string `json:"hypervisor"`
HostUUID string `json:"host_uuid"`
Specs *InstanceSpec `json:"specs"`
WatchdogEnabled bool `json:"watchdog_enabled"`
Tags []string `json:"tags"`
PlacementGroup *InstancePlacementGroup `json:"placement_group"`
ID int `json:"id"`
Created *time.Time `json:"-"`
Updated *time.Time `json:"-"`
Region string `json:"region"`
Alerts *InstanceAlert `json:"alerts"`
Backups *InstanceBackup `json:"backups"`
Image string `json:"image"`
Group string `json:"group"`
IPv4 []*net.IP `json:"ipv4"`
IPv6 string `json:"ipv6"`
Label string `json:"label"`
Type string `json:"type"`
Status InstanceStatus `json:"status"`
HasUserData bool `json:"has_user_data"`
Hypervisor string `json:"hypervisor"`
HostUUID string `json:"host_uuid"`
Specs *InstanceSpec `json:"specs"`
WatchdogEnabled bool `json:"watchdog_enabled"`
Tags []string `json:"tags"`

// NOTE: Placement Groups may not currently be available to all users.
PlacementGroup *InstancePlacementGroup `json:"placement_group"`
}

// InstanceSpec represents a linode spec
Expand Down Expand Up @@ -139,7 +141,9 @@ type InstanceCreateOptions struct {
Tags []string `json:"tags,omitempty"`
Metadata *InstanceMetadataOptions `json:"metadata,omitempty"`
FirewallID int `json:"firewall_id,omitempty"`
PlacementGroup *InstanceCreatePlacementGroupOptions `json:"placement_group,omitempty"`

// NOTE: Placement Groups may not currently be available to all users.
PlacementGroup *InstanceCreatePlacementGroupOptions `json:"placement_group,omitempty"`

// Creation fields that need to be set explicitly false, "", or 0 use pointers
SwapSize *int `json:"swap_size,omitempty"`
Expand Down
8 changes: 8 additions & 0 deletions placement_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type PlacementGroupMember struct {
}

// PlacementGroup represents a Linode placement group.
// NOTE: Placement Groups may not currently be available to all users.
type PlacementGroup struct {
ID int `json:"id"`
Label string `json:"label"`
Expand Down Expand Up @@ -58,6 +59,7 @@ type PlacementGroupUnAssignOptions struct {

// ListPlacementGroups lists placement groups under the current account
// matching the given list options.
// NOTE: Placement Groups may not currently be available to all users.
func (c *Client) ListPlacementGroups(
ctx context.Context,
options *ListOptions,
Expand All @@ -71,6 +73,7 @@ func (c *Client) ListPlacementGroups(
}

// GetPlacementGroup gets a placement group with the specified ID.
// NOTE: Placement Groups may not currently be available to all users.
func (c *Client) GetPlacementGroup(
ctx context.Context,
id int,
Expand All @@ -83,6 +86,7 @@ func (c *Client) GetPlacementGroup(
}

// CreatePlacementGroup creates a placement group with the specified options.
// NOTE: Placement Groups may not currently be available to all users.
func (c *Client) CreatePlacementGroup(
ctx context.Context,
options PlacementGroupCreateOptions,
Expand All @@ -96,6 +100,7 @@ func (c *Client) CreatePlacementGroup(
}

// UpdatePlacementGroup updates a placement group with the specified ID using the provided options.
// NOTE: Placement Groups may not currently be available to all users.
func (c *Client) UpdatePlacementGroup(
ctx context.Context,
id int,
Expand All @@ -111,6 +116,7 @@ func (c *Client) UpdatePlacementGroup(

// AssignPlacementGroupLinodes assigns the specified Linodes to the given
// placement group.
// NOTE: Placement Groups may not currently be available to all users.
func (c *Client) AssignPlacementGroupLinodes(
ctx context.Context,
id int,
Expand All @@ -126,6 +132,7 @@ func (c *Client) AssignPlacementGroupLinodes(

// UnassignPlacementGroupLinodes un-assigns the specified Linodes from the given
// placement group.
// NOTE: Placement Groups may not currently be available to all users.
func (c *Client) UnassignPlacementGroupLinodes(
ctx context.Context,
id int,
Expand All @@ -140,6 +147,7 @@ func (c *Client) UnassignPlacementGroupLinodes(
}

// DeletePlacementGroup deletes a placement group with the specified ID.
// NOTE: Placement Groups may not currently be available to all users.
func (c *Client) DeletePlacementGroup(
ctx context.Context,
id int,
Expand Down

0 comments on commit 9bb3d96

Please sign in to comment.