Skip to content

Commit

Permalink
Add hotstartpool to Sandbox
Browse files Browse the repository at this point in the history
Signed-off-by: Raphaël Pinson <[email protected]>
  • Loading branch information
raphink committed Dec 13, 2024
1 parent e8f71c4 commit cc780fb
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 6 deletions.
66 changes: 66 additions & 0 deletions instruqt/hotstartpool.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2024 Cisco Systems, Inc. and its affiliates

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package instruqt

import "time"

// HotStartPoolType defines a custom type for HotStartPool types.
type HotStartPoolType string

// Constants representing different types of HotStartPool.
const (
HotStartPoolTypeDedicated HotStartPoolType = "dedicated"
HotStartPoolTypeShared HotStartPoolType = "shared"
)

// HotStartStatus defines a custom type for HotStartPool status.
type HotStartStatus string

// Constats representing the different types of status of HotStartPool.
const (
HostStartStatusRunning HotStartStatus = "Running"
HostStartStatusProvisioning HotStartStatus = "Provisioning"
HostStartStatusInactive HotStartStatus = "Inactive"
HostStartStatusExpired HotStartStatus = "Expired"
HostStartStatusDeleted HotStartStatus = "Deleted"
HostStartStatusAutoRefill HotStartStatus = "AutoRefill"
)

// HotStartPoolConfigTrackEdge
type HotStartPoolConfigTrackEdge struct {
Claimed int
Available int
Created int
Failed int
Creating int
Total int
Node SandboxConfig
}

// HotStartPool represents a hot start pool in Instruqt.
type HotStartPool struct {
Id string // ID of the hot start pool.
Type HotStartPoolType // The type of hot start pool.
Size int // Number of sandboxes available per track.
Created *time.Time // Creation time of the hot start pool.
Deleted *time.Time // Deletion time of the hot start pool.
Name string // Name given to the hot start pool.
Auto_refill bool // Flag that signals if the sandboxes should be auto refillable.
Starts_at *time.Time // Schedule time for the hot start pool to start creating sandboxes.
Ends_at *time.Time // Schedule time for the hot start pool to stop creating sandboxes.
Status HotStartStatus // Status of the hot start pool.
Region string // Region of a hotstart pool.
Configs []HotStartPoolConfigTrackEdge // Configs status for the hotstart pool.
}
13 changes: 7 additions & 6 deletions instruqt/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ type sandboxesQuery struct {
// Sandbox represents a sandbox environment within Instruqt, including details
// about its state, associated track, and invite.
type Sandbox struct {
Id string // The id of the sandbox.
Last_Activity_At time.Time // The timestamp of the last activity in the sandbox.
State string // The current state of the sandbox (e.g., "running", "stopped").
Track SandboxTrack // The track associated with the sandbox.
Invite TrackInvite // The invite details associated with the sandbox.
User User // The user running the sandbox.
Id string // The id of the sandbox.
Last_Activity_At time.Time // The timestamp of the last activity in the sandbox.
State string // The current state of the sandbox (e.g., "running", "stopped").
Track SandboxTrack // The track associated with the sandbox.
Invite TrackInvite // The invite details associated with the sandbox.
User User // The user running the sandbox.
Hot_Start_Pool *HotStartPool // The hot start pool associated with the sandbox.
}

// GetSandboxVariable retrieves a specific variable from a sandbox environment
Expand Down
11 changes: 11 additions & 0 deletions instruqt/sandboxconfig.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package instruqt

import "time"

type SandboxConfig struct {
Id string
Name string
Slug string
Version int
Deleted *time.Time
}

0 comments on commit cc780fb

Please sign in to comment.