Skip to content

Commit

Permalink
feat: add dashboard URL to service instance
Browse files Browse the repository at this point in the history
  • Loading branch information
lechnerc77 committed Jul 23, 2024
1 parent 9ffc8b2 commit c96200e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/provider/datasource_subaccount_service_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ You must be assigned to the admin or viewer role of the subaccount.`,
MarkdownDescription: "The set of words or phrases assigned to the service instance.",
Computed: true,
},
"dashboard_url": schema.StringAttribute{
MarkdownDescription: "The URL of the web-based management UI for the service instance.",
Computed: true,
},
},
}
}
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/datasource_subaccount_service_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type subaccountServiceInstancesValueConfig struct {
CreatedDate types.String `tfsdk:"created_date"`
LastModified types.String `tfsdk:"last_modified"`
Labels types.Map `tfsdk:"labels"`
DashboardUrl types.String `tfsdk:"dashboard_url"`
}

type subaccountServiceInstancesDataSourceConfig struct {
Expand Down Expand Up @@ -136,6 +137,10 @@ You must be assigned to the admin or viewer role of the subaccount.`,
MarkdownDescription: "The set of words or phrases assigned to the service instance.",
Computed: true,
},
"dashboard_url": schema.StringAttribute{
MarkdownDescription: "The URL of the web-based management UI for the service instance.",
Computed: true,
},
},
},
Computed: true,
Expand Down Expand Up @@ -181,6 +186,7 @@ func (ds *subaccountServiceInstancesDataSource) Read(ctx context.Context, req da
Context: types.StringValue(string(serviceInstance.Context)),
CreatedDate: timeToValue(serviceInstance.CreatedAt),
LastModified: timeToValue(serviceInstance.UpdatedAt),
DashboardUrl: types.StringValue(serviceInstance.DashboardUrl),
}

val.Labels, diags = types.MapValueFrom(ctx, types.SetType{ElemType: types.StringType}, serviceInstance.Labels)
Expand Down
4 changes: 4 additions & 0 deletions internal/provider/resource_subaccount_service_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ You must be assigned to the admin or the service administrator role of the subac
MarkdownDescription: "The date and time when the resource was last modified in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format.",
Computed: true,
},
"dashboard_url": schema.StringAttribute{
MarkdownDescription: "The URL of the web-based management UI for the service instance.",
Computed: true,
},
},
}
}
Expand Down
4 changes: 4 additions & 0 deletions internal/provider/type_subaccount_service_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type subaccountServiceInstanceType struct {
LastModified types.String `tfsdk:"last_modified"`
Labels types.Map `tfsdk:"labels"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
DashboardUrl types.String `tfsdk:"dashboard_url"`
}

func subaccountServiceInstanceValueFrom(ctx context.Context, value servicemanager.ServiceInstanceResponseObject) (subaccountServiceInstanceType, diag.Diagnostics) {
Expand All @@ -45,6 +46,7 @@ func subaccountServiceInstanceValueFrom(ctx context.Context, value servicemanage
State: types.StringValue(value.LastOperation.State),
CreatedDate: timeToValue(value.CreatedAt),
LastModified: timeToValue(value.UpdatedAt),
DashboardUrl: types.StringValue(value.DashboardUrl),
}

var diags, diagnostics diag.Diagnostics
Expand Down Expand Up @@ -74,6 +76,7 @@ type subaccountServiceInstanceDataSourceType struct {
CreatedDate types.String `tfsdk:"created_date"`
LastModified types.String `tfsdk:"last_modified"`
Labels types.Map `tfsdk:"labels"`
DashboardUrl types.String `tfsdk:"dashboard_url"`
}

func subaccountServiceInstanceDataSourceValueFrom(ctx context.Context, value servicemanager.ServiceInstanceResponseObject) (subaccountServiceInstanceDataSourceType, diag.Diagnostics) {
Expand All @@ -92,6 +95,7 @@ func subaccountServiceInstanceDataSourceValueFrom(ctx context.Context, value ser
Context: types.StringValue(string(value.Context)),
CreatedDate: timeToValue(value.CreatedAt),
LastModified: timeToValue(value.UpdatedAt),
DashboardUrl: types.StringValue(value.DashboardUrl),
}

var diags, diagnostics diag.Diagnostics
Expand Down

0 comments on commit c96200e

Please sign in to comment.