Skip to content

Commit

Permalink
final cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
bpg committed May 26, 2023
1 parent 5df9506 commit 00cf688
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions proxmox/access/users_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type UserChangePasswordRequestBody struct {
Password string `json:"password" url:"password"`
}

// UserCreateRequestBody contains the data for an user create request.
// UserCreateRequestBody contains the data for a user create request.
type UserCreateRequestBody struct {
Comment *string `json:"comment,omitempty" url:"comment,omitempty"`
Email *string `json:"email,omitempty" url:"email,omitempty"`
Expand All @@ -28,7 +28,7 @@ type UserCreateRequestBody struct {
Password string `json:"password" url:"password"`
}

// UserGetResponseBody contains the body from an user get response.
// UserGetResponseBody contains the body from a user get response.
type UserGetResponseBody struct {
Data *UserGetResponseData `json:"data,omitempty"`
}
Expand All @@ -45,7 +45,7 @@ type UserGetResponseData struct {
LastName *string `json:"lastname,omitempty"`
}

// UserListResponseBody contains the body from an user list response.
// UserListResponseBody contains the body from a user list response.
type UserListResponseBody struct {
Data []*UserListResponseData `json:"data,omitempty"`
}
Expand Down
8 changes: 4 additions & 4 deletions proxmox/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ type Client interface {
// Version returns a client for getting the version of the Proxmox Virtual Environment API.
Version() *version.Client

// REST returns a lower-lever REST API client.
REST() api.Client
// API returns a lower-lever REST API client.
API() api.Client

// SSH returns a lower-lever SSH client.
SSH() ssh.Client
Expand Down Expand Up @@ -84,8 +84,8 @@ func (c *client) Version() *version.Client {
return &version.Client{Client: c.a}
}

// REST returns a lower-lever REST API client.
func (c *client) REST() api.Client {
// API returns a lower-lever REST API client.
func (c *client) API() api.Client {
return c.a
}

Expand Down
2 changes: 1 addition & 1 deletion proxmox/nodes/vms/vms_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ type GetStatusResponseData struct {
VMID *int `json:"vmid,omitempty"`
}

// ListResponseBody contains the body from an virtual machine list response.
// ListResponseBody contains the body from a virtual machine list response.
type ListResponseBody struct {
Data []*ListResponseData `json:"data,omitempty"`
}
Expand Down
2 changes: 1 addition & 1 deletion proxmox/pools/pool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type PoolGetResponseData struct {
Members []VirtualEnvironmentPoolGetResponseMembers `json:"members,omitempty"`
}

// VirtualEnvironmentPoolGetResponseMembers contains the members data from an pool get response.
// VirtualEnvironmentPoolGetResponseMembers contains the members data from a pool get response.
type VirtualEnvironmentPoolGetResponseMembers struct {
ID string `json:"id"`
Node string `json:"node"`
Expand Down
4 changes: 2 additions & 2 deletions proxmoxtf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ type ProviderConfiguration struct {

// NewProviderConfiguration creates a new provider configuration.
func NewProviderConfiguration(
veClient api.Client,
apiClient api.Client,
sshClient ssh.Client,
) ProviderConfiguration {
return ProviderConfiguration{
apiClient: veClient,
apiClient: apiClient,
sshClient: sshClient,
}
}
Expand Down
8 changes: 4 additions & 4 deletions proxmoxtf/resource/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d
}

// Only the root account is allowed to change the CPU architecture, which makes this check necessary.
if api.REST().IsRoot() ||
if api.API().IsRoot() ||
cpuArchitecture != dvResourceVirtualEnvironmentVMCPUArchitecture {
updateBody.CPUArchitecture = &cpuArchitecture
}
Expand Down Expand Up @@ -2050,7 +2050,7 @@ func vmCreateCustom(ctx context.Context, d *schema.ResourceData, m interface{})
}

// Only the root account is allowed to change the CPU architecture, which makes this check necessary.
if api.REST().IsRoot() ||
if api.API().IsRoot() ||
cpuArchitecture != dvResourceVirtualEnvironmentVMCPUArchitecture {
createBody.CPUArchitecture = &cpuArchitecture
}
Expand Down Expand Up @@ -2963,7 +2963,7 @@ func vmReadCustom(
} else {
// Default value of "arch" is "" according to the API documentation.
// However, assume the provider's default value as a workaround when the root account is not being used.
if !api.REST().IsRoot() {
if !api.API().IsRoot() {
cpu[mkResourceVirtualEnvironmentVMCPUArchitecture] = dvResourceVirtualEnvironmentVMCPUArchitecture
} else {
cpu[mkResourceVirtualEnvironmentVMCPUArchitecture] = ""
Expand Down Expand Up @@ -4158,7 +4158,7 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
cpuUnits := cpuBlock[mkResourceVirtualEnvironmentVMCPUUnits].(int)

// Only the root account is allowed to change the CPU architecture, which makes this check necessary.
if api.REST().IsRoot() ||
if api.API().IsRoot() ||
cpuArchitecture != dvResourceVirtualEnvironmentVMCPUArchitecture {
updateBody.CPUArchitecture = &cpuArchitecture
}
Expand Down

0 comments on commit 00cf688

Please sign in to comment.