Skip to content

Commit

Permalink
Fix description handling
Browse files Browse the repository at this point in the history
  • Loading branch information
komalali committed Aug 26, 2024
1 parent 9c0505c commit e7508ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions provider/pkg/internal/pulumiapi/agent_pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type AgentPoolClient interface {
type AgentPool struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Description string `json:"description,omitempty"`
TokenValue string `json:"tokenValue"`
}

Expand All @@ -42,7 +42,7 @@ type createAgentPoolResponse struct {

type createUpdateAgentPoolRequest struct {
Name string `json:"name"`
Description string `json:"description"`
Description string `json:"description,omitempty"`
}

func (c *Client) CreateAgentPool(ctx context.Context, orgName, name, description string) (*AgentPool, error) {
Expand Down
8 changes: 6 additions & 2 deletions provider/pkg/provider/agent_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,19 @@ type PulumiServiceAgentPoolInput struct {
func GenerateAgentPoolProperties(input PulumiServiceAgentPoolInput, agentPool pulumiapi.AgentPool) (outputs *structpb.Struct, inputs *structpb.Struct, err error) {
inputMap := resource.PropertyMap{}
inputMap["name"] = resource.NewPropertyValue(input.Name)
inputMap["description"] = resource.NewPropertyValue(input.Description)
inputMap["organizationName"] = resource.NewPropertyValue(input.OrgName)
if input.Description != "" {
inputMap["description"] = resource.NewPropertyValue(input.Description)
}

outputMap := resource.PropertyMap{}
outputMap["agentPoolId"] = resource.NewPropertyValue(agentPool.ID)
outputMap["name"] = inputMap["name"]
outputMap["organizationName"] = inputMap["organizationName"]
outputMap["description"] = inputMap["description"]
outputMap["tokenValue"] = resource.NewPropertyValue(agentPool.TokenValue)
if input.Description != "" {
outputMap["description"] = inputMap["description"]
}

inputs, err = plugin.MarshalProperties(inputMap, plugin.MarshalOptions{})
if err != nil {
Expand Down

0 comments on commit e7508ef

Please sign in to comment.