Skip to content

Commit

Permalink
Make port fields int32
Browse files Browse the repository at this point in the history
  • Loading branch information
danafallon committed Aug 6, 2024
1 parent d453169 commit a9b5908
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions internal/provider/deployment_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (r *DeploymentResource) Schema(ctx context.Context, req resource.SchemaRequ
Optional: true,
Attributes: map[string]schema.Attribute{
"host": schema.StringAttribute{Required: true},
"port": schema.Int64Attribute{Required: true},
"port": schema.Int32Attribute{Required: true},
"user": schema.StringAttribute{Required: true},
"password": schema.StringAttribute{Required: true, Sensitive: true},
"database": schema.StringAttribute{Required: true},
Expand All @@ -64,7 +64,7 @@ func (r *DeploymentResource) Schema(ctx context.Context, req resource.SchemaRequ
Optional: true,
Attributes: map[string]schema.Attribute{
"host": schema.StringAttribute{Required: true},
"port": schema.Int64Attribute{Required: true},
"port": schema.Int32Attribute{Required: true},
"user": schema.StringAttribute{Required: true},
"password": schema.StringAttribute{Required: true, Sensitive: true},
"database": schema.StringAttribute{Required: true},
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/destination_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (r *DestinationResource) Schema(ctx context.Context, req resource.SchemaReq
Attributes: map[string]schema.Attribute{
"endpoint": schema.StringAttribute{Required: true},
"host": schema.StringAttribute{Required: true},
"port": schema.Int64Attribute{Required: true},
"port": schema.Int32Attribute{Required: true},
"username": schema.StringAttribute{Required: true},
"password": schema.StringAttribute{Required: true, Sensitive: true},
},
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/models/deployment_api_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type SourceAPIModel struct {
type SourceConfigAPIModel struct {
Host string `json:"host"`
SnapshotHost string `json:"snapshotHost"`
Port int64 `json:"port"`
Port int32 `json:"port"`
User string `json:"user"`
Password string `json:"password"`
Database string `json:"database"`
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/models/deployment_resource_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ type SourceModel struct {

type PostgresConfigModel struct {
Host types.String `tfsdk:"host"`
Port types.Int64 `tfsdk:"port"`
Port types.Int32 `tfsdk:"port"`
User types.String `tfsdk:"user"`
Database types.String `tfsdk:"database"`
Password types.String `tfsdk:"password"`
}

type MySQLConfigModel struct {
Host types.String `tfsdk:"host"`
Port types.Int64 `tfsdk:"port"`
Port types.Int32 `tfsdk:"port"`
User types.String `tfsdk:"user"`
Database types.String `tfsdk:"database"`
Password types.String `tfsdk:"password"`
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/models/destination_api_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type DestinationAPIModel struct {

type DestinationSharedConfigAPIModel struct {
Host string `json:"host"`
Port int64 `json:"port"`
Port int32 `json:"port"`
Endpoint string `json:"endpoint"`
Username string `json:"username"`
Password string `json:"password"`
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/models/destination_resource_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type BigQuerySharedConfigModel struct {
type RedshiftSharedConfigModel struct {
Endpoint types.String `tfsdk:"endpoint"`
Host types.String `tfsdk:"host"`
Port types.Int64 `tfsdk:"port"`
Port types.Int32 `tfsdk:"port"`
Username types.String `tfsdk:"username"`
Password types.String `tfsdk:"password"`
}
8 changes: 4 additions & 4 deletions internal/provider/models/translate_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ func DeploymentAPIToResourceModel(apiModel DeploymentAPIModel, resourceModel *De
case string(PostgreSQL):
resourceModel.Source.PostgresConfig = &PostgresConfigModel{
Host: types.StringValue(apiModel.Source.Config.Host),
Port: types.Int64Value(apiModel.Source.Config.Port),
Port: types.Int32Value(apiModel.Source.Config.Port),
User: types.StringValue(apiModel.Source.Config.User),
Password: types.StringValue(apiModel.Source.Config.Password),
Database: types.StringValue(apiModel.Source.Config.Database),
}
case string(MySQL):
resourceModel.Source.MySQLConfig = &MySQLConfigModel{
Host: types.StringValue(apiModel.Source.Config.Host),
Port: types.Int64Value(apiModel.Source.Config.Port),
Port: types.Int32Value(apiModel.Source.Config.Port),
User: types.StringValue(apiModel.Source.Config.User),
Password: types.StringValue(apiModel.Source.Config.Password),
Database: types.StringValue(apiModel.Source.Config.Database),
Expand Down Expand Up @@ -95,15 +95,15 @@ func DeploymentResourceToAPIModel(resourceModel DeploymentResourceModel) Deploym
case string(PostgreSQL):
apiModel.Source.Config = SourceConfigAPIModel{
Host: resourceModel.Source.PostgresConfig.Host.ValueString(),
Port: resourceModel.Source.PostgresConfig.Port.ValueInt64(),
Port: resourceModel.Source.PostgresConfig.Port.ValueInt32(),
User: resourceModel.Source.PostgresConfig.User.ValueString(),
Password: resourceModel.Source.PostgresConfig.Password.ValueString(),
Database: resourceModel.Source.PostgresConfig.Database.ValueString(),
}
case string(MySQL):
apiModel.Source.Config = SourceConfigAPIModel{
Host: resourceModel.Source.MySQLConfig.Host.ValueString(),
Port: resourceModel.Source.MySQLConfig.Port.ValueInt64(),
Port: resourceModel.Source.MySQLConfig.Port.ValueInt32(),
User: resourceModel.Source.MySQLConfig.User.ValueString(),
Password: resourceModel.Source.MySQLConfig.Password.ValueString(),
Database: resourceModel.Source.MySQLConfig.Database.ValueString(),
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/models/translate_destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func DestinationAPIToResourceModel(apiModel DestinationAPIModel, resourceModel *
resourceModel.RedshiftConfig = &RedshiftSharedConfigModel{
Endpoint: types.StringValue(apiModel.Config.Endpoint),
Host: types.StringValue(apiModel.Config.Host),
Port: types.Int64Value(apiModel.Config.Port),
Port: types.Int32Value(apiModel.Config.Port),
Username: types.StringValue(apiModel.Config.Username),
Password: types.StringValue(apiModel.Config.Password),
}
Expand Down Expand Up @@ -68,7 +68,7 @@ func DestinationResourceToAPIModel(resourceModel DestinationResourceModel) Desti
apiModel.Config = DestinationSharedConfigAPIModel{
Endpoint: resourceModel.RedshiftConfig.Endpoint.ValueString(),
Host: resourceModel.RedshiftConfig.Host.ValueString(),
Port: resourceModel.RedshiftConfig.Port.ValueInt64(),
Port: resourceModel.RedshiftConfig.Port.ValueInt32(),
Username: resourceModel.RedshiftConfig.Username.ValueString(),
Password: resourceModel.RedshiftConfig.Password.ValueString(),
}
Expand Down

0 comments on commit a9b5908

Please sign in to comment.