Skip to content

Commit

Permalink
Merge pull request #231 from alrayyes/refactor/acronyms
Browse files Browse the repository at this point in the history
Refactor/acronyms
  • Loading branch information
alrayyes authored Dec 20, 2024
2 parents 78b1403 + 0f34c5c commit 575dce2
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 111 deletions.
4 changes: 2 additions & 2 deletions docs/data-sources/dedicated_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ data "leaseweb_dedicated_server" "srv" {

### Read-Only

- `asset_id` (String) The Asset Id of the server.
- `asset_id` (String) The Asset ID of the server.
- `contract_id` (String) The unique identifier of the contract.
- `cpu_quantity` (Number) The quantity of the cpu.
- `cpu_type` (String) The type of the cpu.
Expand All @@ -48,7 +48,7 @@ data "leaseweb_dedicated_server" "srv" {
- `public_ip` (String) Public ip address.
- `public_mac` (String) Public mac address.
- `rack_capacity` (String) The capacity of the rack.
- `rack_id` (String) The Id of the rack.
- `rack_id` (String) The ID of the rack.
- `rack_type` (String) The type of the rack.
- `ram_size` (Number) The size of the ram.
- `ram_unit` (String) The unit of the ram.
Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/dedicated_server_control_panels.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ data "leaseweb_dedicated_server_control_panels" "all" {}

Read-Only:

- `id` (String) Id of the control panel.
- `id` (String) ID of the control panel.
- `name` (String) Name of the control panel.
4 changes: 2 additions & 2 deletions docs/data-sources/dedicated_server_operating_systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ data "leaseweb_dedicated_server_operating_systems" "all" {}

Read-Only:

- `id` (String) Id of the operating system.
- `name` (String) Id of the operating system.
- `id` (String) ID of the operating system.
- `name` (String) ID of the operating system.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type controlPanelsDataSource struct {
}

type controlPanelDataSourceModel struct {
Id types.String `tfsdk:"id"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
}

Expand Down Expand Up @@ -63,7 +63,7 @@ func (c *controlPanelsDataSource) Read(

for _, cp := range result.GetControlPanels() {
controlPanels = append(controlPanels, controlPanelDataSourceModel{
Id: basetypes.NewStringValue(cp.GetId()),
ID: basetypes.NewStringValue(cp.GetId()),
Name: basetypes.NewStringValue(cp.GetName()),
})
}
Expand Down Expand Up @@ -92,7 +92,7 @@ func (c *controlPanelsDataSource) Schema(
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Computed: true,
Description: "Id of the control panel.",
Description: "ID of the control panel.",
},
"name": schema.StringAttribute{
Computed: true,
Expand Down
16 changes: 8 additions & 8 deletions internal/provider/dedicatedserver/credential_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type credentialResource struct {
}

type credentialResourceModel struct {
DedicatedServerId types.String `tfsdk:"dedicated_server_id"`
DedicatedServerID types.String `tfsdk:"dedicated_server_id"`
Username types.String `tfsdk:"username"`
Type types.String `tfsdk:"type"`
Password types.String `tfsdk:"password"`
Expand Down Expand Up @@ -95,7 +95,7 @@ func (c *credentialResource) Create(
)
request := c.DedicatedserverAPI.CreateServerCredential(
ctx,
plan.DedicatedServerId.ValueString(),
plan.DedicatedServerID.ValueString(),
).CreateServerCredentialOpts(*opts)
result, response, err := request.Execute()
if err != nil {
Expand All @@ -107,7 +107,7 @@ func (c *credentialResource) Create(
resp.State.Set(
ctx,
credentialResourceModel{
DedicatedServerId: plan.DedicatedServerId,
DedicatedServerID: plan.DedicatedServerID,
Type: types.StringValue(string(result.GetType())),
Password: types.StringValue(result.GetPassword()),
Username: types.StringValue(result.GetUsername()),
Expand All @@ -129,7 +129,7 @@ func (c *credentialResource) Read(

request := c.DedicatedserverAPI.GetServerCredential(
ctx,
state.DedicatedServerId.ValueString(),
state.DedicatedServerID.ValueString(),
dedicatedserver.CredentialType(state.Type.ValueString()),
state.Username.ValueString(),
)
Expand All @@ -143,7 +143,7 @@ func (c *credentialResource) Read(
resp.State.Set(
ctx,
credentialResourceModel{
DedicatedServerId: state.DedicatedServerId,
DedicatedServerID: state.DedicatedServerID,
Type: types.StringValue(string(result.GetType())),
Password: types.StringValue(result.GetPassword()),
Username: types.StringValue(result.GetUsername()),
Expand All @@ -168,7 +168,7 @@ func (c *credentialResource) Update(
)
request := c.DedicatedserverAPI.UpdateServerCredential(
ctx,
plan.DedicatedServerId.ValueString(),
plan.DedicatedServerID.ValueString(),
dedicatedserver.CredentialType(plan.Type.ValueString()),
plan.Username.ValueString(),
).UpdateServerCredentialOpts(*opts)
Expand All @@ -182,7 +182,7 @@ func (c *credentialResource) Update(
resp.State.Set(
ctx,
credentialResourceModel{
DedicatedServerId: plan.DedicatedServerId,
DedicatedServerID: plan.DedicatedServerID,
Type: types.StringValue(string(result.GetType())),
Password: types.StringValue(result.GetPassword()),
Username: types.StringValue(result.GetUsername()),
Expand All @@ -204,7 +204,7 @@ func (c *credentialResource) Delete(

request := c.DedicatedserverAPI.DeleteServerCredential(
ctx,
state.DedicatedServerId.ValueString(),
state.DedicatedServerID.ValueString(),
dedicatedserver.CredentialType(state.Type.ValueString()),
state.Username.ValueString(),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ type notificationSettingBandwidthResource struct {
}

type notificationSettingBandwidthResourceModel struct {
Id types.String `tfsdk:"id"`
DedicatedServerId types.String `tfsdk:"dedicated_server_id"`
ID types.String `tfsdk:"id"`
DedicatedServerID types.String `tfsdk:"dedicated_server_id"`
Frequency types.String `tfsdk:"frequency"`
Threshold types.String `tfsdk:"threshold"`
Unit types.String `tfsdk:"unit"`
Expand Down Expand Up @@ -100,7 +100,7 @@ func (n *notificationSettingBandwidthResource) Create(
)
request := n.DedicatedserverAPI.CreateServerBandwidthNotificationSetting(
ctx,
plan.DedicatedServerId.ValueString(),
plan.DedicatedServerID.ValueString(),
).BandwidthNotificationSettingOpts(*opts)
result, response, err := request.Execute()
if err != nil {
Expand All @@ -112,11 +112,11 @@ func (n *notificationSettingBandwidthResource) Create(
resp.State.Set(
ctx,
notificationSettingBandwidthResourceModel{
Id: types.StringValue(result.GetId()),
ID: types.StringValue(result.GetId()),
Frequency: types.StringValue(result.GetFrequency()),
Threshold: types.StringValue(result.GetThreshold()),
Unit: types.StringValue(result.GetUnit()),
DedicatedServerId: plan.DedicatedServerId,
DedicatedServerID: plan.DedicatedServerID,
},
)...,
)
Expand All @@ -135,8 +135,8 @@ func (n *notificationSettingBandwidthResource) Read(

request := n.DedicatedserverAPI.GetServerBandwidthNotificationSetting(
ctx,
state.DedicatedServerId.ValueString(),
state.Id.ValueString(),
state.DedicatedServerID.ValueString(),
state.ID.ValueString(),
)
result, response, err := request.Execute()
if err != nil {
Expand All @@ -148,11 +148,11 @@ func (n *notificationSettingBandwidthResource) Read(
resp.State.Set(
ctx,
notificationSettingBandwidthResourceModel{
Id: types.StringValue(result.GetId()),
ID: types.StringValue(result.GetId()),
Frequency: types.StringValue(result.GetFrequency()),
Threshold: types.StringValue(result.GetThreshold()),
Unit: types.StringValue(result.GetUnit()),
DedicatedServerId: state.DedicatedServerId,
DedicatedServerID: state.DedicatedServerID,
},
)...,
)
Expand All @@ -176,8 +176,8 @@ func (n *notificationSettingBandwidthResource) Update(
)
request := n.DedicatedserverAPI.UpdateServerBandwidthNotificationSetting(
ctx,
plan.DedicatedServerId.ValueString(),
plan.Id.ValueString(),
plan.DedicatedServerID.ValueString(),
plan.ID.ValueString(),
).BandwidthNotificationSettingOpts(*opts)
result, response, err := request.Execute()
if err != nil {
Expand All @@ -189,8 +189,8 @@ func (n *notificationSettingBandwidthResource) Update(
resp.State.Set(
ctx,
notificationSettingBandwidthResourceModel{
Id: plan.Id,
DedicatedServerId: plan.DedicatedServerId,
ID: plan.ID,
DedicatedServerID: plan.DedicatedServerID,
Frequency: types.StringValue(result.GetFrequency()),
Threshold: types.StringValue(result.GetThreshold()),
Unit: types.StringValue(result.GetUnit()),
Expand All @@ -212,8 +212,8 @@ func (n *notificationSettingBandwidthResource) Delete(

request := n.DedicatedserverAPI.DeleteServerBandwidthNotificationSetting(
ctx,
state.DedicatedServerId.ValueString(),
state.Id.ValueString(),
state.DedicatedServerID.ValueString(),
state.ID.ValueString(),
)
response, err := request.Execute()
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ type notificationSettingDatatrafficResource struct {
}

type notificationSettingDatatrafficResourceModel struct {
Id types.String `tfsdk:"id"`
DedicatedServerId types.String `tfsdk:"dedicated_server_id"`
ID types.String `tfsdk:"id"`
DedicatedServerID types.String `tfsdk:"dedicated_server_id"`
Frequency types.String `tfsdk:"frequency"`
Threshold types.String `tfsdk:"threshold"`
Unit types.String `tfsdk:"unit"`
Expand Down Expand Up @@ -100,7 +100,7 @@ func (n *notificationSettingDatatrafficResource) Create(
)
request := n.DedicatedserverAPI.CreateServerDataTrafficNotificationSetting(
ctx,
plan.DedicatedServerId.ValueString(),
plan.DedicatedServerID.ValueString(),
).DataTrafficNotificationSettingOpts(*opts)
result, response, err := request.Execute()
if err != nil {
Expand All @@ -112,8 +112,8 @@ func (n *notificationSettingDatatrafficResource) Create(
resp.State.Set(
ctx,
notificationSettingDatatrafficResourceModel{
DedicatedServerId: plan.DedicatedServerId,
Id: types.StringValue(result.GetId()),
DedicatedServerID: plan.DedicatedServerID,
ID: types.StringValue(result.GetId()),
Frequency: types.StringValue(result.GetFrequency()),
Threshold: types.StringValue(result.GetThreshold()),
Unit: types.StringValue(result.GetUnit()),
Expand All @@ -135,8 +135,8 @@ func (n *notificationSettingDatatrafficResource) Read(

request := n.DedicatedserverAPI.GetServerDataTrafficNotificationSetting(
ctx,
state.DedicatedServerId.ValueString(),
state.Id.ValueString(),
state.DedicatedServerID.ValueString(),
state.ID.ValueString(),
)
result, response, err := request.Execute()
if err != nil {
Expand All @@ -148,8 +148,8 @@ func (n *notificationSettingDatatrafficResource) Read(
resp.State.Set(
ctx,
notificationSettingDatatrafficResourceModel{
DedicatedServerId: state.DedicatedServerId,
Id: types.StringValue(result.GetId()),
DedicatedServerID: state.DedicatedServerID,
ID: types.StringValue(result.GetId()),
Frequency: types.StringValue(result.GetFrequency()),
Threshold: types.StringValue(result.GetThreshold()),
Unit: types.StringValue(result.GetUnit()),
Expand All @@ -176,8 +176,8 @@ func (n *notificationSettingDatatrafficResource) Update(
)
request := n.DedicatedserverAPI.UpdateServerDataTrafficNotificationSetting(
ctx,
plan.DedicatedServerId.ValueString(),
plan.Id.ValueString(),
plan.DedicatedServerID.ValueString(),
plan.ID.ValueString(),
).DataTrafficNotificationSettingOpts(*opts)
result, response, err := request.Execute()
if err != nil {
Expand All @@ -189,8 +189,8 @@ func (n *notificationSettingDatatrafficResource) Update(
resp.State.Set(
ctx,
notificationSettingDatatrafficResourceModel{
Id: plan.Id,
DedicatedServerId: plan.DedicatedServerId,
ID: plan.ID,
DedicatedServerID: plan.DedicatedServerID,
Frequency: types.StringValue(result.GetFrequency()),
Threshold: types.StringValue(result.GetThreshold()),
Unit: types.StringValue(result.GetUnit()),
Expand All @@ -212,8 +212,8 @@ func (n *notificationSettingDatatrafficResource) Delete(

request := n.DedicatedserverAPI.DeleteServerDataTrafficNotificationSetting(
ctx,
state.DedicatedServerId.ValueString(),
state.Id.ValueString(),
state.DedicatedServerID.ValueString(),
state.ID.ValueString(),
)
response, err := request.Execute()
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ type operatingSystemsDataSource struct {
}

type operatingSystemDataSourceModel struct {
Id types.String `tfsdk:"id"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
}

type operatingSystemsDataSourceModel struct {
OperatingSystems []operatingSystemDataSourceModel `tfsdk:"operating_systems"`
ControlPanelId types.String `tfsdk:"control_panel_id"`
ControlPanelID types.String `tfsdk:"control_panel_id"`
}

func (o *operatingSystemsDataSource) Read(
Expand All @@ -38,8 +38,8 @@ func (o *operatingSystemsDataSource) Read(
resp.Diagnostics.Append(req.Config.Get(ctx, &config)...)

request := o.DedicatedserverAPI.GetOperatingSystemList(ctx)
if !config.ControlPanelId.IsNull() && !config.ControlPanelId.IsUnknown() {
request = request.ControlPanelId(config.ControlPanelId.ValueString())
if !config.ControlPanelID.IsNull() && !config.ControlPanelID.IsUnknown() {
request = request.ControlPanelId(config.ControlPanelID.ValueString())
}
// NOTE: we show only the latest 50 items.
result, response, err := request.Limit(50).Execute()
Expand All @@ -51,7 +51,7 @@ func (o *operatingSystemsDataSource) Read(
var operatingSystems []operatingSystemDataSourceModel
for _, os := range result.GetOperatingSystems() {
operatingSystems = append(operatingSystems, operatingSystemDataSourceModel{
Id: basetypes.NewStringValue(os.GetId()),
ID: basetypes.NewStringValue(os.GetId()),
Name: basetypes.NewStringValue(os.GetName()),
})
}
Expand All @@ -61,7 +61,7 @@ func (o *operatingSystemsDataSource) Read(
ctx,
operatingSystemsDataSourceModel{
OperatingSystems: operatingSystems,
ControlPanelId: config.ControlPanelId,
ControlPanelID: config.ControlPanelID,
},
)...,
)
Expand All @@ -80,11 +80,11 @@ func (o *operatingSystemsDataSource) Schema(
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Computed: true,
Description: "Id of the operating system.",
Description: "ID of the operating system.",
},
"name": schema.StringAttribute{
Computed: true,
Description: "Id of the operating system.",
Description: "ID of the operating system.",
},
},
},
Expand Down
Loading

0 comments on commit 575dce2

Please sign in to comment.