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

add missing route fields to data source #23

Merged
merged 7 commits into from
Jan 9, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'main' into wasaga/route-data-sources
  • Loading branch information
wasaga committed Jan 9, 2025
commit f83b75552553a6ff0145ff5e07d8589237e9ae6a
4 changes: 2 additions & 2 deletions internal/provider/convert.go
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ func ToStringSlice(ctx context.Context, dst *[]string, list types.List, diagnost
}
}

// ToDuration converts a types.String containing a duration to a durationpb.Duration and handles diagnostics internally
// ToDuration converts a timetypes.Duration to durationpb.Duration
func ToDuration(dst **durationpb.Duration, src timetypes.GoDuration, diagnostics *diag.Diagnostics) {
if src.IsNull() || src.IsUnknown() {
*dst = nil
@@ -103,7 +103,7 @@ func ToDuration(dst **durationpb.Duration, src timetypes.GoDuration, diagnostics
*dst = durationpb.New(d)
}

// FromDuration converts a durationpb.Duration to a types.String
// FromDuration converts a durationpb.Duration to a timetypes.GoDuration
func FromDuration(d *durationpb.Duration) timetypes.GoDuration {
if d == nil {
return timetypes.NewGoDurationNull()
6 changes: 6 additions & 0 deletions internal/provider/route.go
Original file line number Diff line number Diff line change
@@ -126,13 +126,19 @@
Description: "Timeout.",
Optional: true,
CustomType: timetypes.GoDurationType{},
<<<<<<< HEAD

Check failure on line 129 in internal/provider/route.go

GitHub Actions / Lint

syntax error: unexpected <<, expected expression

Check failure on line 129 in internal/provider/route.go

GitHub Actions / Lint

expected operand, found '<<' (typecheck)
Computed: true,
=======
>>>>>>> main
},
"idle_timeout": schema.StringAttribute{
Description: "Idle timeout.",
Optional: true,
CustomType: timetypes.GoDurationType{},
<<<<<<< HEAD

Check failure on line 138 in internal/provider/route.go

GitHub Actions / Lint

syntax error: unexpected <<, expected expression (typecheck)
Computed: true,
=======
>>>>>>> main
},
"allow_websockets": schema.BoolAttribute{
Description: "Allow websockets.",
@@ -203,30 +209,30 @@
}

func (r *RouteResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
if req.ProviderData == nil {

Check failure on line 212 in internal/provider/route.go

GitHub Actions / Lint

missing ',' in composite literal (typecheck)
return

Check failure on line 213 in internal/provider/route.go

GitHub Actions / Lint

expected operand, found 'return' (typecheck)
}

c, ok := req.ProviderData.(*client.Client)
if !ok {

Check failure on line 217 in internal/provider/route.go

GitHub Actions / Lint

missing ',' in composite literal (typecheck)
resp.Diagnostics.AddError(
"Unexpected Resource Configure Type",
fmt.Sprintf("Expected Config, got: %T.", req.ProviderData),
)

Check failure on line 221 in internal/provider/route.go

GitHub Actions / Lint

missing ',' before newline in composite literal (typecheck)

return

Check failure on line 223 in internal/provider/route.go

GitHub Actions / Lint

expected operand, found 'return' (typecheck)
}

r.client = c
}

func (r *RouteResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
var plan RouteResourceModel

Check failure on line 230 in internal/provider/route.go

GitHub Actions / Lint

missing ',' in composite literal (typecheck)

resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...)

if resp.Diagnostics.HasError() {
return

Check failure on line 235 in internal/provider/route.go

GitHub Actions / Lint

expected operand, found 'return' (typecheck)
}

pbRoute, diags := ConvertRouteToPB(ctx, &plan)
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.