Skip to content

Commit

Permalink
update attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Apr 22, 2024
1 parent 9cec940 commit d5b3242
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions internal/resource/infrastructure_stack_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ func (is *infrastructureStack) Attributes(ctx context.Context, d diag.Diagnostic
Type: gqlclient.StackType(is.Type.ValueString()),
RepositoryID: is.Repository.Id.ValueString(),
ClusterID: is.ClusterId.ValueString(),
Git: gqlclient.GitRefAttributes{},
Git: is.Repository.Attributes(),
JobSpec: nil,
Configuration: gqlclient.StackConfigurationAttributes{},
Configuration: is.Configuration.Attributes(),
Approval: is.Approval.ValueBoolPointer(),
ReadBindings: is.Bindings.ReadAttributes(ctx, d),
WriteBindings: is.Bindings.WriteAttributes(ctx, d),
Expand Down Expand Up @@ -75,6 +75,17 @@ type InfrastructureStackRepository struct {
Folder types.String `tfsdk:"folder"`
}

func (isr *InfrastructureStackRepository) Attributes() gqlclient.GitRefAttributes {
if isr == nil {
return gqlclient.GitRefAttributes{}
}

return gqlclient.GitRefAttributes{
Ref: isr.Ref.ValueString(),
Folder: isr.Folder.ValueString(),
}
}

func (isr *InfrastructureStackRepository) From(repository *gqlclient.GitRepositoryFragment, ref *gqlclient.GitRefFragment) {
if isr == nil {
return
Expand All @@ -95,6 +106,17 @@ type InfrastructureStackConfiguration struct {
Version types.String `tfsdk:"version"`
}

func (isc *InfrastructureStackConfiguration) Attributes() gqlclient.StackConfigurationAttributes {
if isc == nil {
return gqlclient.StackConfigurationAttributes{}
}

return gqlclient.StackConfigurationAttributes{
Image: isc.Image.ValueStringPointer(),
Version: isc.Version.ValueString(),
}
}

func (isc *InfrastructureStackConfiguration) From(configuration *gqlclient.StackConfigurationFragment) {
if isc == nil || configuration == nil {
return
Expand Down

0 comments on commit d5b3242

Please sign in to comment.