Skip to content

Commit

Permalink
Merge pull request #17 from ConductorOne/lauren/set-default-requested…
Browse files Browse the repository at this point in the history
…-for

Set default for requested for variable
  • Loading branch information
laurenleach authored Aug 15, 2024
2 parents 4c30707 + d46e85a commit 2468f5f
Show file tree
Hide file tree
Showing 30 changed files with 1,767 additions and 871 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21
toolchain go1.22.3

require (
github.com/conductorone/baton-sdk v0.2.15
github.com/conductorone/baton-sdk v0.2.19
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/spf13/viper v1.18.2
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/conductorone/baton-sdk v0.2.15 h1:jHT30Qi+eTdubUbow1XB4/AxbryJdFITvYly+RgldU0=
github.com/conductorone/baton-sdk v0.2.15/go.mod h1:hmd/Oz3DPIKD+9QmkusZaA18ZoiinnTDdrxh2skcdUc=
github.com/conductorone/baton-sdk v0.2.19 h1:XY+mRuQVKso8IgIWOK8WlKHF7L94n/PkPUQ+cZYBt0I=
github.com/conductorone/baton-sdk v0.2.19/go.mod h1:hmd/Oz3DPIKD+9QmkusZaA18ZoiinnTDdrxh2skcdUc=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
2 changes: 1 addition & 1 deletion pkg/connector/ticket.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (s *ServiceNow) CreateTicket(ctx context.Context, ticket *v2.Ticket, schema
}
// TODO(lauren) handle multi pick differently also

val, err := sdkTicket.GetCustomFieldValue(ticketFields[id])
val, err := sdkTicket.GetCustomFieldValueOrDefault(ticketFields[id])
if err != nil {
return nil, nil, err
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/servicenow/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"go.uber.org/zap"
)

const SystemAdminUserId = "6816f79cc0a8016401c5a33be04be441"

type BaseResource struct {
Id string `json:"sys_id"`
}
Expand Down Expand Up @@ -340,7 +342,9 @@ func ConvertVariableToSchemaCustomField(ctx context.Context, variable *CatalogIt
return sdkTicket.StringFieldSchema(variable.Name, variable.Name, variable.Mandatory), nil
case TypeRequestedFor:
// This should be sys_id of user
return sdkTicket.StringFieldSchema(variable.Name, variable.Name, variable.Mandatory), nil
rf := sdkTicket.StringFieldSchema(variable.Name, variable.Name, variable.Mandatory)
rf.GetStringValue().DefaultValue = SystemAdminUserId
return rf, nil
case TypeListCollector: // TODO(lauren) I think this just takes sys_ids but in the UI its populated from other tables
return nil, nil
case TypeDuration: // TODO(lauren) make duration field?
Expand Down
708 changes: 402 additions & 306 deletions vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/ticket.pb.go

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2468f5f

Please sign in to comment.