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

Update datatype for instance from int to int64 #82

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
28 changes: 14 additions & 14 deletions pkg/client/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type InstancesAPIDeleteAnIstanceOpts struct {
}

func (a *InstancesAPIService) DeleteAnInstance(ctx context.Context,
instanceID int) (models.SuccessOrErrorMessage, error) {
instanceID int64) (models.SuccessOrErrorMessage, error) {
DelInstanceResp := models.SuccessOrErrorMessage{}

delInstanceAPI := &api{
Expand Down Expand Up @@ -124,7 +124,7 @@ Get a Specific Instance
@return models.GetInstanceResponse
*/
func (a *InstancesAPIService) GetASpecificInstance(ctx context.Context,
instanceID int) (models.GetInstanceResponse, error) {
instanceID int64) (models.GetInstanceResponse, error) {
SpecificInstResp := models.GetInstanceResponse{}

specificInstanceAPI := &api{
Expand Down Expand Up @@ -177,7 +177,7 @@ Lists VMware Snapshot of the instance
- @param instanceID
*/
func (a *InstancesAPIService) GetListOfSnapshotsForAnInstance(ctx context.Context,
instanceID int) (models.ListSnapshotResponse, error) {
instanceID int64) (models.ListSnapshotResponse, error) {
ListSnapshotResp := models.ListSnapshotResponse{}

listSnapshotAPI := &api{
Expand Down Expand Up @@ -208,7 +208,7 @@ it currently exists.

*/

func (a *InstancesAPIService) ImportSnapshotOfAnInstance(ctx context.Context, instanceID int,
func (a *InstancesAPIService) ImportSnapshotOfAnInstance(ctx context.Context, instanceID int64,
localVarOptionals *models.ImportSnapshotBody) (models.SuccessOrErrorMessage, error) {
ImportSnapshotResp := models.SuccessOrErrorMessage{}

Expand Down Expand Up @@ -236,7 +236,7 @@ Restarts all VM running within an instance
- @param instanceID
*/
func (a *InstancesAPIService) RestartAnInstance(ctx context.Context,
instanceID int) (models.InstancePowerResponse, error) {
instanceID int64) (models.InstancePowerResponse, error) {
RestartInstResp := models.InstancePowerResponse{}

restartInstAPI := &api{
Expand Down Expand Up @@ -266,7 +266,7 @@ Creates VMware Snapshot of the instance

*/

func (a *InstancesAPIService) SnapshotAnInstance(ctx context.Context, instanceID int,
func (a *InstancesAPIService) SnapshotAnInstance(ctx context.Context, instanceID int64,
localVarOptionals *models.SnapshotBody) (models.Instances, error) {
SnapshotInstResp := models.Instances{}

Expand Down Expand Up @@ -294,7 +294,7 @@ Starts all VM running within an instance
- @param instanceID
*/
func (a *InstancesAPIService) StartAnInstance(ctx context.Context,
instanceID int) (models.InstancePowerResponse, error) {
instanceID int64) (models.InstancePowerResponse, error) {
StartInstanceResp := models.InstancePowerResponse{}

startInstanceAPI := &api{
Expand All @@ -321,7 +321,7 @@ Stops all VM running within an instance
- @param instanceID
*/
func (a *InstancesAPIService) StopAnInstance(ctx context.Context,
instanceID int) (models.InstancePowerResponse, error) {
instanceID int64) (models.InstancePowerResponse, error) {
StopInstanceResp := models.InstancePowerResponse{}

stopInstanceAPI := &api{
Expand All @@ -348,7 +348,7 @@ Suspends all VM running within an instance
- @param instanceID
*/
func (a *InstancesAPIService) SuspendAnInstance(ctx context.Context,
instanceID int) (models.InstancePowerResponse, error) {
instanceID int64) (models.InstancePowerResponse, error) {
SuspendResp := models.InstancePowerResponse{}
suspendInstanceAPI := &api{
method: "PUT",
Expand All @@ -365,7 +365,7 @@ func (a *InstancesAPIService) SuspendAnInstance(ctx context.Context,
return SuspendResp, err
}

func (a *InstancesAPIService) ResizeAnInstance(ctx context.Context, instanceID int,
func (a *InstancesAPIService) ResizeAnInstance(ctx context.Context, instanceID int64,
request *models.ResizeInstanceBody) (models.ResizeInstanceResponse, error) {
ResizeResp := models.ResizeInstanceResponse{}

Expand All @@ -386,7 +386,7 @@ func (a *InstancesAPIService) ResizeAnInstance(ctx context.Context, instanceID i

func (a *InstancesAPIService) UpdatingAnInstance(
ctx context.Context,
instanceID int,
instanceID int64,
request *models.UpdateInstanceBody,
) (models.UpdateInstanceResponse, error) {
Instance := models.UpdateInstanceResponse{}
Expand All @@ -407,7 +407,7 @@ func (a *InstancesAPIService) UpdatingAnInstance(
}

func (a *InstancesAPIService) GetInstanceHistory(
ctx context.Context, instanceID int) (models.GetInstanceHistory, error) {
ctx context.Context, instanceID int64) (models.GetInstanceHistory, error) {
History := models.GetInstanceHistory{}

historyAPI := &api{
Expand All @@ -425,7 +425,7 @@ func (a *InstancesAPIService) GetInstanceHistory(
return History, err
}

func (a *InstancesAPIService) CloneAnInstance(ctx context.Context, instanceID int,
func (a *InstancesAPIService) CloneAnInstance(ctx context.Context, instanceID int64,
cloneRequest models.CreateInstanceCloneBody) (models.SuccessOrErrorMessage, error) {
var CloneResp models.SuccessOrErrorMessage
if v, _ := parseVersion("5.2.12"); v <= a.Client.getVersion() {
Expand Down Expand Up @@ -471,7 +471,7 @@ func (a *InstancesAPIService) GetStorageVolTypeID(ctx context.Context, cloudID,
return StorageVol, err
}

func (a *InstancesAPIService) GetStorageControllerMount(ctx context.Context, instanceID int, controllerType string,
func (a *InstancesAPIService) GetStorageControllerMount(ctx context.Context, instanceID int64, controllerType string,
busNumber, unitNumber int) (ControllerMount string, err error) {
controllerTypeInput := strings.ToLower(controllerType)
if controllerTypeInput == "ide" {
Expand Down
28 changes: 14 additions & 14 deletions pkg/client/instances_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) Copyright 2021 Hewlett Packard Enterprise Development LP
// (C) Copyright 2021-2024 Hewlett Packard Enterprise Development LP

package client

Expand All @@ -25,7 +25,7 @@ func TestInstancesAPIService_CloneAnInstance(t *testing.T) {
tests := []struct {
name string
param models.CreateInstanceCloneBody
instanceID int
instanceID int64
given func(m *MockAPIClientHandler)
want models.SuccessOrErrorMessage
wantErr bool
Expand Down Expand Up @@ -382,7 +382,7 @@ func TestInstancesAPIService_DeleteAnInstance(t *testing.T) {
defer ctrl.Finish()
tests := []struct {
name string
instanceID int
instanceID int64
given func(m *MockAPIClientHandler)
want models.SuccessOrErrorMessage
wantErr bool
Expand Down Expand Up @@ -490,7 +490,7 @@ func TestInstancesAPIService_ImportSnapshotOfAnInstance(t *testing.T) {

tests := []struct {
name string
instanceID int
instanceID int64
param models.ImportSnapshotBody
given func(m *MockAPIClientHandler)
want models.SuccessOrErrorMessage
Expand Down Expand Up @@ -623,7 +623,7 @@ func TestInstancesAPIService_ResizeAnInstance(t *testing.T) {

tests := []struct {
name string
instanceID int
instanceID int64
param models.ResizeInstanceBody
given func(m *MockAPIClientHandler)
want models.ResizeInstanceResponse
Expand Down Expand Up @@ -801,7 +801,7 @@ func TestInstancesAPIService_SnapshotAnInstance(t *testing.T) {
defer ctrl.Finish()
tests := []struct {
name string
instanceID int
instanceID int64
param models.SnapshotBody
given func(m *MockAPIClientHandler)
want models.Instances
Expand Down Expand Up @@ -963,7 +963,7 @@ func TestInstancesAPIService_UpdatingAnInstance(t *testing.T) {
defer ctrl.Finish()
tests := []struct {
name string
instanceID int
instanceID int64
param models.UpdateInstanceBody
given func(m *MockAPIClientHandler)
want models.UpdateInstanceResponse
Expand Down Expand Up @@ -1120,7 +1120,7 @@ func TestInstancesAPIService_GetASpecificInstance(t *testing.T) {
defer ctrl.Finish()
tests := []struct {
name string
instanceID int
instanceID int64
// All expectaion captures here
given func(m *MockAPIClientHandler)
want models.GetInstanceResponse
Expand Down Expand Up @@ -1369,7 +1369,7 @@ func TestInstancesAPIService_GetListOfSnapshotsForAnInstance(t *testing.T) {

tests := []struct {
name string
instanceID int
instanceID int64
given func(m *MockAPIClientHandler)
want models.ListSnapshotResponse
wantErr bool
Expand Down Expand Up @@ -1485,7 +1485,7 @@ func TestInstancesAPIService_GetInstanceHistory(t *testing.T) {

tests := []struct {
name string
instanceID int
instanceID int64
given func(m *MockAPIClientHandler)
want models.GetInstanceHistory
wantErr bool
Expand Down Expand Up @@ -1617,7 +1617,7 @@ func TestInstancesAPIService_RestartAnInstance(t *testing.T) {

tests := []struct {
name string
instanceID int
instanceID int64
given func(m *MockAPIClientHandler)
want models.InstancePowerResponse
wantErr bool
Expand Down Expand Up @@ -1723,7 +1723,7 @@ func TestInstancesAPIService_StartAnInstance(t *testing.T) {
defer ctrl.Finish()
tests := []struct {
name string
instanceID int
instanceID int64
given func(m *MockAPIClientHandler)
want models.InstancePowerResponse
wantErr bool
Expand Down Expand Up @@ -1829,7 +1829,7 @@ func TestInstancesAPIService_StopAnInstance(t *testing.T) {
defer ctrl.Finish()
tests := []struct {
name string
instanceID int
instanceID int64
given func(m *MockAPIClientHandler)
want models.InstancePowerResponse
wantErr bool
Expand Down Expand Up @@ -1935,7 +1935,7 @@ func TestInstancesAPIService_SuspendAnInstance(t *testing.T) {
defer ctrl.Finish()
tests := []struct {
name string
instanceID int
instanceID int64
given func(m *MockAPIClientHandler)
want models.InstancePowerResponse
wantErr bool
Expand Down
22 changes: 11 additions & 11 deletions pkg/models/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ type GetInstanceResponse struct {

// GetInstanceResponseInstance
type GetInstanceResponseInstance struct {
ID int `json:"id,omitempty"`
ID int64 `json:"id,omitempty"`
UUID string `json:"uuid,omitempty"`
AccountID int `json:"accountId,omitempty"`
AccountID int64 `json:"accountId,omitempty"`
Tenant *GetInstanceResponseInstanceTenant `json:"tenant,omitempty"`
InstanceType *GetInstanceResponseInstanceInstanceType `json:"instanceType,omitempty"`
Group *GetInstanceResponseInstanceGroup `json:"group,omitempty"`
Expand Down Expand Up @@ -517,12 +517,12 @@ type GetInstanceHistoryProcessType struct {
}

type GetInstanceHistoryProcesses struct {
ID int `json:"id" tf:"id"`
AccountID int `json:"accountId" tf:"account_id"`
ID int64 `json:"id" tf:"id"`
AccountID int64 `json:"accountId" tf:"account_id"`
UniqueID string `json:"uniqueId" tf:"unique_id"`
ProcessType GetInstanceHistoryProcessType `json:"processType" tf:"process_type,sub"`
DisplayName string `json:"displayName" tf:"display_name"`
InstanceID int `json:"instanceId" tf:"instance_id"`
InstanceID int64 `json:"instanceId" tf:"instance_id"`
Status string `json:"status" tf:"status"`
Reason interface{} `json:"reason" tf:"reason"`
Percent float64 `json:"percent" tf:"percent"`
Expand Down Expand Up @@ -578,20 +578,20 @@ type CreateInstanceCloneBody struct {
}

type GetInstanceContainer struct {
ID int `json:"id" tf:"id"`
ID int64 `json:"id" tf:"id"`
Name string `json:"name" tf:"name"`
IP string `json:"ip" tf:"ip"`
ExternalFqdn string `json:"externalFqdn" tf:"external_fqdn"`
ContainerType NameModel `json:"containerType" tf:"container_type,sub"`
Server GetInstanceContainersServer `json:"server" tf:"server,sub"`
Hostname string `json:"hostname" tf:"hostname"`
MaxStorage int `json:"maxStorage" tf:"max_storage"`
MaxMemory int `json:"maxMemory" tf:"max_memory"`
MaxStorage int64 `json:"maxStorage" tf:"max_storage"`
MaxMemory int64 `json:"maxMemory" tf:"max_memory"`
MaxCores int `json:"maxCores" tf:"max_cores"`
}

type GetInstanceContainersServer struct {
ID int `json:"id" tf:"id"`
ID int64 `json:"id" tf:"id"`
Owner UserNameModel `json:"owner" tf:"owner,sub"`
ComputeServerType GetInstanceContainersServerType `json:"computeServerType" tf:"compute_server_type,sub"`
Visibility string `json:"visibility" tf:"visibility"`
Expand All @@ -616,8 +616,8 @@ type InstancePlanResponse struct {
Name string `json:"name"`
Value int `json:"value"`
Code string `json:"code"`
MaxStorage int `json:"maxStorage"`
MaxMemory int `json:"maxMemory"`
MaxStorage int64 `json:"maxStorage"`
MaxMemory int64 `json:"maxMemory"`
MaxCPU interface{} `json:"maxCpu"`
MaxCores int `json:"maxCores"`
CustomCPU bool `json:"customCpu"`
Expand Down
Loading