Skip to content

Commit

Permalink
fix: parse allowed_account_types in provider config (#91)
Browse files Browse the repository at this point in the history
* fix: introduce allowed_account_types in ProviderConfig proto message

* fix: nil safe check for accessing appeal config
  • Loading branch information
rahmatrhd authored Dec 13, 2021
1 parent dcb8ee5 commit 9d196b5
Show file tree
Hide file tree
Showing 4 changed files with 500 additions and 475 deletions.
36 changes: 24 additions & 12 deletions api/handler/v1beta1/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,19 @@ func (a *adapter) FromProviderConfigProto(pc *guardianv1beta1.ProviderConfig) (*
})
}

var allowedAccountTypes []string
if pc.GetAllowedAccountTypes() != nil {
allowedAccountTypes = pc.GetAllowedAccountTypes()
}

return &domain.ProviderConfig{
Type: pc.GetType(),
URN: pc.GetUrn(),
Labels: pc.GetLabels(),
Credentials: pc.GetCredentials().AsInterface(),
Appeal: appealConfig,
Resources: resources,
Type: pc.GetType(),
URN: pc.GetUrn(),
Labels: pc.GetLabels(),
Credentials: pc.GetCredentials().AsInterface(),
Appeal: appealConfig,
Resources: resources,
AllowedAccountTypes: allowedAccountTypes,
}, nil
}

Expand Down Expand Up @@ -122,13 +128,19 @@ func (a *adapter) ToProviderConfigProto(pc *domain.ProviderConfig) (*guardianv1b
})
}

var allowedAccountTypes []string
if pc.AllowedAccountTypes != nil {
allowedAccountTypes = pc.AllowedAccountTypes
}

return &guardianv1beta1.ProviderConfig{
Type: pc.Type,
Urn: pc.URN,
Labels: pc.Labels,
Credentials: credentials,
Appeal: appeal,
Resources: resources,
Type: pc.Type,
Urn: pc.URN,
Labels: pc.Labels,
Credentials: credentials,
Appeal: appeal,
Resources: resources,
AllowedAccountTypes: allowedAccountTypes,
}, nil
}

Expand Down
Loading

0 comments on commit 9d196b5

Please sign in to comment.