Pull in fix for concurrent map updates in clues (#2562)
## Description Pulls in fix for a panic caused by concurrent map updates in the clues pkg ## Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No ## Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Test - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup ## Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [x] 💚 E2E
This commit is contained in:
parent
62d652764a
commit
daad056d7e
@ -4,7 +4,7 @@ go 1.19
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0
|
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0
|
||||||
github.com/alcionai/clues v0.0.0-20230202001016-cbda58c9de9e
|
github.com/alcionai/clues v0.0.0-20230217203352-c3714e5e9013
|
||||||
github.com/aws/aws-sdk-go v1.44.202
|
github.com/aws/aws-sdk-go v1.44.202
|
||||||
github.com/aws/aws-xray-sdk-go v1.8.0
|
github.com/aws/aws-xray-sdk-go v1.8.0
|
||||||
github.com/cenkalti/backoff/v4 v4.2.0
|
github.com/cenkalti/backoff/v4 v4.2.0
|
||||||
@ -29,7 +29,7 @@ require (
|
|||||||
github.com/tomlazar/table v0.1.2
|
github.com/tomlazar/table v0.1.2
|
||||||
github.com/vbauerster/mpb/v8 v8.1.6
|
github.com/vbauerster/mpb/v8 v8.1.6
|
||||||
go.uber.org/zap v1.24.0
|
go.uber.org/zap v1.24.0
|
||||||
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15
|
golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb
|
||||||
golang.org/x/tools v0.6.0
|
golang.org/x/tools v0.6.0
|
||||||
gopkg.in/resty.v1 v1.12.0
|
gopkg.in/resty.v1 v1.12.0
|
||||||
)
|
)
|
||||||
|
|||||||
@ -52,8 +52,8 @@ github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1o
|
|||||||
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
|
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
|
||||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
|
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
|
||||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
|
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
|
||||||
github.com/alcionai/clues v0.0.0-20230202001016-cbda58c9de9e h1:KMRGDB9lh0wC/WYVmQ28MJ07qiHszCSH2PRwkw2YElM=
|
github.com/alcionai/clues v0.0.0-20230217203352-c3714e5e9013 h1:WWQ6E8hnoITmc/adlEySSVo3SOVvo1xhJKO08A1YPYY=
|
||||||
github.com/alcionai/clues v0.0.0-20230202001016-cbda58c9de9e/go.mod h1:UlAs8jkWIpsOMakiC8NxPgQQVQRdvyf1hYMszlYYLb4=
|
github.com/alcionai/clues v0.0.0-20230217203352-c3714e5e9013/go.mod h1:DeaMbAwDvYM6ZfPMR/GUl3hceqI5C8jIQ1lstjB2IW8=
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
@ -463,8 +463,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
|
|||||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||||
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15 h1:5oN1Pz/eDhCpbMbLstvIPa0b/BEQo6g6nwV3pLjfM6w=
|
golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb h1:PaBZQdo+iSDyHT053FjUCgZQ/9uqVwPOcl7KSWhKn6w=
|
||||||
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
|
golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
|
||||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
|
|||||||
@ -97,7 +97,7 @@ func (c Users) GetAll(ctx context.Context, errs *fault.Errors) ([]models.Userabl
|
|||||||
resp, err = service.Client().Users().Get(ctx, userOptions(&userFilterNoGuests))
|
resp, err = service.Client().Users().Get(ctx, userOptions(&userFilterNoGuests))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "getting all users").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "getting all users").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
iter, err := msgraphgocore.NewPageIterator(
|
iter, err := msgraphgocore.NewPageIterator(
|
||||||
@ -105,7 +105,7 @@ func (c Users) GetAll(ctx context.Context, errs *fault.Errors) ([]models.Userabl
|
|||||||
service.Adapter(),
|
service.Adapter(),
|
||||||
models.CreateUserCollectionResponseFromDiscriminatorValue)
|
models.CreateUserCollectionResponseFromDiscriminatorValue)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "creating users iterator").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "creating users iterator").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
us := make([]models.Userable, 0)
|
us := make([]models.Userable, 0)
|
||||||
@ -117,7 +117,7 @@ func (c Users) GetAll(ctx context.Context, errs *fault.Errors) ([]models.Userabl
|
|||||||
|
|
||||||
u, err := validateUser(item)
|
u, err := validateUser(item)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs.Add(clues.Wrap(err, "validating user").WithClues(ctx).WithAll(graph.ErrData(err)...))
|
errs.Add(clues.Wrap(err, "validating user").WithClues(ctx).With(graph.ErrData(err)...))
|
||||||
} else {
|
} else {
|
||||||
us = append(us, u)
|
us = append(us, u)
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ func (c Users) GetAll(ctx context.Context, errs *fault.Errors) ([]models.Userabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := iter.Iterate(ctx, iterator); err != nil {
|
if err := iter.Iterate(ctx, iterator); err != nil {
|
||||||
return nil, clues.Wrap(err, "iterating all users").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "iterating all users").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return us, errs.Err()
|
return us, errs.Err()
|
||||||
@ -141,7 +141,7 @@ func (c Users) GetByID(ctx context.Context, userID string) (models.Userable, err
|
|||||||
resp, err = c.stable.Client().UsersById(userID).Get(ctx, nil)
|
resp, err = c.stable.Client().UsersById(userID).Get(ctx, nil)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "getting user").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "getting user").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, err
|
return resp, err
|
||||||
@ -160,7 +160,7 @@ func (c Users) GetInfo(ctx context.Context, userID string) (*UserInfo, error) {
|
|||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !graph.IsErrExchangeMailFolderNotFound(err) {
|
if !graph.IsErrExchangeMailFolderNotFound(err) {
|
||||||
return nil, clues.Wrap(err, "getting user's mail folder").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "getting user's mail folder").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(userInfo.DiscoveredServices, path.ExchangeService)
|
delete(userInfo.DiscoveredServices, path.ExchangeService)
|
||||||
|
|||||||
@ -49,7 +49,7 @@ func (c Contacts) CreateContactFolder(
|
|||||||
|
|
||||||
mdl, err := c.stable.Client().UsersById(user).ContactFolders().Post(ctx, requestBody, nil)
|
mdl, err := c.stable.Client().UsersById(user).ContactFolders().Post(ctx, requestBody, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "creating contact folder").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "creating contact folder").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return mdl, nil
|
return mdl, nil
|
||||||
@ -62,7 +62,7 @@ func (c Contacts) DeleteContainer(
|
|||||||
) error {
|
) error {
|
||||||
err := c.stable.Client().UsersById(user).ContactFoldersById(folderID).Delete(ctx, nil)
|
err := c.stable.Client().UsersById(user).ContactFoldersById(folderID).Delete(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -76,7 +76,7 @@ func (c Contacts) GetItem(
|
|||||||
) (serialization.Parsable, *details.ExchangeInfo, error) {
|
) (serialization.Parsable, *details.ExchangeInfo, error) {
|
||||||
cont, err := c.stable.Client().UsersById(user).ContactsById(itemID).Get(ctx, nil)
|
cont, err := c.stable.Client().UsersById(user).ContactsById(itemID).Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return cont, ContactInfo(cont), nil
|
return cont, ContactInfo(cont), nil
|
||||||
@ -88,12 +88,12 @@ func (c Contacts) GetContainerByID(
|
|||||||
) (graph.Container, error) {
|
) (graph.Container, error) {
|
||||||
ofcf, err := optionsForContactFolderByID([]string{"displayName", "parentFolderId"})
|
ofcf, err := optionsForContactFolderByID([]string{"displayName", "parentFolderId"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "setting contact folder options").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "setting contact folder options").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := c.stable.Client().UsersById(userID).ContactFoldersById(dirID).Get(ctx, ofcf)
|
resp, err := c.stable.Client().UsersById(userID).ContactFoldersById(dirID).Get(ctx, ofcf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@ -113,7 +113,7 @@ func (c Contacts) EnumerateContainers(
|
|||||||
) error {
|
) error {
|
||||||
service, err := c.service()
|
service, err := c.service()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
fields := []string{"displayName", "parentFolderId"}
|
fields := []string{"displayName", "parentFolderId"}
|
||||||
@ -122,7 +122,7 @@ func (c Contacts) EnumerateContainers(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Wrap(err, "setting contact child folder options").
|
return clues.Wrap(err, "setting contact child folder options").
|
||||||
WithClues(ctx).
|
WithClues(ctx).
|
||||||
WithAll(graph.ErrData(err)...).
|
With(graph.ErrData(err)...).
|
||||||
With("options_fields", fields)
|
With("options_fields", fields)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ func (c Contacts) EnumerateContainers(
|
|||||||
for {
|
for {
|
||||||
resp, err := builder.Get(ctx, ofcf)
|
resp, err := builder.Get(ctx, ofcf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, fold := range resp.GetValue() {
|
for _, fold := range resp.GetValue() {
|
||||||
@ -143,18 +143,18 @@ func (c Contacts) EnumerateContainers(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := checkIDAndName(fold); err != nil {
|
if err := checkIDAndName(fold); err != nil {
|
||||||
errs.Add(clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...))
|
errs.Add(clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
fctx := clues.AddAll(
|
fctx := clues.Add(
|
||||||
ctx,
|
ctx,
|
||||||
"container_id", ptr.Val(fold.GetId()),
|
"container_id", ptr.Val(fold.GetId()),
|
||||||
"container_display_name", ptr.Val(fold.GetDisplayName()))
|
"container_display_name", ptr.Val(fold.GetDisplayName()))
|
||||||
|
|
||||||
temp := graph.NewCacheFolder(fold, nil, nil)
|
temp := graph.NewCacheFolder(fold, nil, nil)
|
||||||
if err := fn(temp); err != nil {
|
if err := fn(temp); err != nil {
|
||||||
errs.Add(clues.Stack(err).WithClues(fctx).WithAll(graph.ErrData(err)...))
|
errs.Add(clues.Stack(err).WithClues(fctx).With(graph.ErrData(err)...))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ type contactPager struct {
|
|||||||
func (p *contactPager) getPage(ctx context.Context) (api.DeltaPageLinker, error) {
|
func (p *contactPager) getPage(ctx context.Context) (api.DeltaPageLinker, error) {
|
||||||
resp, err := p.builder.Get(ctx, p.options)
|
resp, err := p.builder.Get(ctx, p.options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@ -205,12 +205,12 @@ func (c Contacts) GetAddedAndRemovedItemIDs(
|
|||||||
) ([]string, []string, DeltaUpdate, error) {
|
) ([]string, []string, DeltaUpdate, error) {
|
||||||
service, err := c.service()
|
service, err := c.service()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, DeltaUpdate{}, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, nil, DeltaUpdate{}, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
var resetDelta bool
|
var resetDelta bool
|
||||||
|
|
||||||
ctx = clues.AddAll(
|
ctx = clues.Add(
|
||||||
ctx,
|
ctx,
|
||||||
"category", selectors.ExchangeContact,
|
"category", selectors.ExchangeContact,
|
||||||
"container_id", directoryID)
|
"container_id", directoryID)
|
||||||
@ -220,7 +220,7 @@ func (c Contacts) GetAddedAndRemovedItemIDs(
|
|||||||
return nil,
|
return nil,
|
||||||
nil,
|
nil,
|
||||||
DeltaUpdate{},
|
DeltaUpdate{},
|
||||||
clues.Wrap(err, "setting contact folder options").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
clues.Wrap(err, "setting contact folder options").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(oldDelta) > 0 {
|
if len(oldDelta) > 0 {
|
||||||
@ -238,7 +238,7 @@ func (c Contacts) GetAddedAndRemovedItemIDs(
|
|||||||
// only return on error if it is NOT a delta issue.
|
// only return on error if it is NOT a delta issue.
|
||||||
// on bad deltas we retry the call with the regular builder
|
// on bad deltas we retry the call with the regular builder
|
||||||
if !graph.IsErrInvalidDelta(err) {
|
if !graph.IsErrInvalidDelta(err) {
|
||||||
return nil, nil, DeltaUpdate{}, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, nil, DeltaUpdate{}, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
resetDelta = true
|
resetDelta = true
|
||||||
@ -294,12 +294,12 @@ func (c Contacts) Serialize(
|
|||||||
defer writer.Close()
|
defer writer.Close()
|
||||||
|
|
||||||
if err = writer.WriteObjectValue("", contact); err != nil {
|
if err = writer.WriteObjectValue("", contact); err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
bs, err := writer.GetSerializedContent()
|
bs, err := writer.GetSerializedContent()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "serializing contact").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "serializing contact").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bs, nil
|
return bs, nil
|
||||||
|
|||||||
@ -50,7 +50,7 @@ func (c Events) CreateCalendar(
|
|||||||
|
|
||||||
mdl, err := c.stable.Client().UsersById(user).Calendars().Post(ctx, requestbody, nil)
|
mdl, err := c.stable.Client().UsersById(user).Calendars().Post(ctx, requestbody, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "creating calendar").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "creating calendar").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return mdl, nil
|
return mdl, nil
|
||||||
@ -64,7 +64,7 @@ func (c Events) DeleteContainer(
|
|||||||
) error {
|
) error {
|
||||||
err := c.stable.Client().UsersById(user).CalendarsById(calendarID).Delete(ctx, nil)
|
err := c.stable.Client().UsersById(user).CalendarsById(calendarID).Delete(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -76,17 +76,17 @@ func (c Events) GetContainerByID(
|
|||||||
) (graph.Container, error) {
|
) (graph.Container, error) {
|
||||||
service, err := c.service()
|
service, err := c.service()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
ofc, err := optionsForCalendarsByID([]string{"name", "owner"})
|
ofc, err := optionsForCalendarsByID([]string{"name", "owner"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "setting event calendar options").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "setting event calendar options").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
cal, err := service.Client().UsersById(userID).CalendarsById(containerID).Get(ctx, ofc)
|
cal, err := service.Client().UsersById(userID).CalendarsById(containerID).Get(ctx, ofc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return graph.CalendarDisplayable{Calendarable: cal}, nil
|
return graph.CalendarDisplayable{Calendarable: cal}, nil
|
||||||
@ -105,7 +105,7 @@ func (c Events) GetItem(
|
|||||||
|
|
||||||
event, err = c.stable.Client().UsersById(user).EventsById(itemID).Get(ctx, nil)
|
event, err = c.stable.Client().UsersById(user).EventsById(itemID).Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if *event.GetHasAttachments() || HasAttachments(event.GetBody()) {
|
if *event.GetHasAttachments() || HasAttachments(event.GetBody()) {
|
||||||
@ -122,7 +122,7 @@ func (c Events) GetItem(
|
|||||||
Attachments().
|
Attachments().
|
||||||
Get(ctx, options)
|
Get(ctx, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, clues.Wrap(err, "event attachment download").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, nil, clues.Wrap(err, "event attachment download").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
event.SetAttachments(attached.GetValue())
|
event.SetAttachments(attached.GetValue())
|
||||||
@ -145,12 +145,12 @@ func (c Events) EnumerateContainers(
|
|||||||
) error {
|
) error {
|
||||||
service, err := c.service()
|
service, err := c.service()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
ofc, err := optionsForCalendars([]string{"name"})
|
ofc, err := optionsForCalendars([]string{"name"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Wrap(err, "setting calendar options").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return clues.Wrap(err, "setting calendar options").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
builder := service.Client().UsersById(userID).Calendars()
|
builder := service.Client().UsersById(userID).Calendars()
|
||||||
@ -158,17 +158,17 @@ func (c Events) EnumerateContainers(
|
|||||||
for {
|
for {
|
||||||
resp, err := builder.Get(ctx, ofc)
|
resp, err := builder.Get(ctx, ofc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, cal := range resp.GetValue() {
|
for _, cal := range resp.GetValue() {
|
||||||
cd := CalendarDisplayable{Calendarable: cal}
|
cd := CalendarDisplayable{Calendarable: cal}
|
||||||
if err := checkIDAndName(cd); err != nil {
|
if err := checkIDAndName(cd); err != nil {
|
||||||
errs.Add(clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...))
|
errs.Add(clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
fctx := clues.AddAll(
|
fctx := clues.Add(
|
||||||
ctx,
|
ctx,
|
||||||
"container_id", ptr.Val(cal.GetId()),
|
"container_id", ptr.Val(cal.GetId()),
|
||||||
"container_name", ptr.Val(cal.GetName()))
|
"container_name", ptr.Val(cal.GetName()))
|
||||||
@ -178,7 +178,7 @@ func (c Events) EnumerateContainers(
|
|||||||
path.Builder{}.Append(ptr.Val(cd.GetId())), // storage path
|
path.Builder{}.Append(ptr.Val(cd.GetId())), // storage path
|
||||||
path.Builder{}.Append(ptr.Val(cd.GetDisplayName()))) // display location
|
path.Builder{}.Append(ptr.Val(cd.GetDisplayName()))) // display location
|
||||||
if err := fn(temp); err != nil {
|
if err := fn(temp); err != nil {
|
||||||
errs.Add(clues.Stack(err).WithClues(fctx).WithAll(graph.ErrData(err)...))
|
errs.Add(clues.Stack(err).WithClues(fctx).With(graph.ErrData(err)...))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ type eventPager struct {
|
|||||||
func (p *eventPager) getPage(ctx context.Context) (api.DeltaPageLinker, error) {
|
func (p *eventPager) getPage(ctx context.Context) (api.DeltaPageLinker, error) {
|
||||||
resp, err := p.builder.Get(ctx, p.options)
|
resp, err := p.builder.Get(ctx, p.options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@ -238,7 +238,7 @@ func (c Events) GetAddedAndRemovedItemIDs(
|
|||||||
|
|
||||||
var resetDelta bool
|
var resetDelta bool
|
||||||
|
|
||||||
ctx = clues.AddAll(
|
ctx = clues.Add(
|
||||||
ctx,
|
ctx,
|
||||||
"container_id", calendarID)
|
"container_id", calendarID)
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ func (c Events) GetAddedAndRemovedItemIDs(
|
|||||||
// only return on error if it is NOT a delta issue.
|
// only return on error if it is NOT a delta issue.
|
||||||
// on bad deltas we retry the call with the regular builder
|
// on bad deltas we retry the call with the regular builder
|
||||||
if !graph.IsErrInvalidDelta(err) {
|
if !graph.IsErrInvalidDelta(err) {
|
||||||
return nil, nil, DeltaUpdate{}, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, nil, DeltaUpdate{}, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
resetDelta = true
|
resetDelta = true
|
||||||
@ -322,12 +322,12 @@ func (c Events) Serialize(
|
|||||||
defer writer.Close()
|
defer writer.Close()
|
||||||
|
|
||||||
if err = writer.WriteObjectValue("", event); err != nil {
|
if err = writer.WriteObjectValue("", event); err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
bs, err := writer.GetSerializedContent()
|
bs, err := writer.GetSerializedContent()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "serializing event").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "serializing event").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bs, nil
|
return bs, nil
|
||||||
|
|||||||
@ -50,7 +50,7 @@ func (c Mail) CreateMailFolder(
|
|||||||
|
|
||||||
mdl, err := c.stable.Client().UsersById(user).MailFolders().Post(ctx, requestBody, nil)
|
mdl, err := c.stable.Client().UsersById(user).MailFolders().Post(ctx, requestBody, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "creating mail folder").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "creating mail folder").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return mdl, nil
|
return mdl, nil
|
||||||
@ -62,7 +62,7 @@ func (c Mail) CreateMailFolderWithParent(
|
|||||||
) (models.MailFolderable, error) {
|
) (models.MailFolderable, error) {
|
||||||
service, err := c.service()
|
service, err := c.service()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
isHidden := false
|
isHidden := false
|
||||||
@ -77,7 +77,7 @@ func (c Mail) CreateMailFolderWithParent(
|
|||||||
ChildFolders().
|
ChildFolders().
|
||||||
Post(ctx, requestBody, nil)
|
Post(ctx, requestBody, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "creating nested mail folder").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "creating nested mail folder").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return mdl, nil
|
return mdl, nil
|
||||||
@ -91,7 +91,7 @@ func (c Mail) DeleteContainer(
|
|||||||
) error {
|
) error {
|
||||||
err := c.stable.Client().UsersById(user).MailFoldersById(folderID).Delete(ctx, nil)
|
err := c.stable.Client().UsersById(user).MailFoldersById(folderID).Delete(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -103,17 +103,17 @@ func (c Mail) GetContainerByID(
|
|||||||
) (graph.Container, error) {
|
) (graph.Container, error) {
|
||||||
service, err := c.service()
|
service, err := c.service()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
ofmf, err := optionsForMailFoldersItem([]string{"displayName", "parentFolderId"})
|
ofmf, err := optionsForMailFoldersItem([]string{"displayName", "parentFolderId"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "setting mail folder options").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "setting mail folder options").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := service.Client().UsersById(userID).MailFoldersById(dirID).Get(ctx, ofmf)
|
resp, err := service.Client().UsersById(userID).MailFoldersById(dirID).Get(ctx, ofmf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@ -128,7 +128,7 @@ func (c Mail) GetItem(
|
|||||||
) (serialization.Parsable, *details.ExchangeInfo, error) {
|
) (serialization.Parsable, *details.ExchangeInfo, error) {
|
||||||
mail, err := c.stable.Client().UsersById(user).MessagesById(itemID).Get(ctx, nil)
|
mail, err := c.stable.Client().UsersById(user).MessagesById(itemID).Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if *mail.GetHasAttachments() || HasAttachments(mail.GetBody()) {
|
if *mail.GetHasAttachments() || HasAttachments(mail.GetBody()) {
|
||||||
@ -145,7 +145,7 @@ func (c Mail) GetItem(
|
|||||||
Attachments().
|
Attachments().
|
||||||
Get(ctx, options)
|
Get(ctx, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, clues.Wrap(err, "mail attachment download").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, nil, clues.Wrap(err, "mail attachment download").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
mail.SetAttachments(attached.GetValue())
|
mail.SetAttachments(attached.GetValue())
|
||||||
@ -168,7 +168,7 @@ func (c Mail) EnumerateContainers(
|
|||||||
) error {
|
) error {
|
||||||
service, err := c.service()
|
service, err := c.service()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
builder := service.Client().
|
builder := service.Client().
|
||||||
@ -179,18 +179,18 @@ func (c Mail) EnumerateContainers(
|
|||||||
for {
|
for {
|
||||||
resp, err := builder.Get(ctx, nil)
|
resp, err := builder.Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range resp.GetValue() {
|
for _, v := range resp.GetValue() {
|
||||||
fctx := clues.AddAll(
|
fctx := clues.Add(
|
||||||
ctx,
|
ctx,
|
||||||
"container_id", ptr.Val(v.GetId()),
|
"container_id", ptr.Val(v.GetId()),
|
||||||
"container_name", ptr.Val(v.GetDisplayName()))
|
"container_name", ptr.Val(v.GetDisplayName()))
|
||||||
|
|
||||||
temp := graph.NewCacheFolder(v, nil, nil)
|
temp := graph.NewCacheFolder(v, nil, nil)
|
||||||
if err := fn(temp); err != nil {
|
if err := fn(temp); err != nil {
|
||||||
errs.Add(clues.Stack(err).WithClues(fctx).WithAll(graph.ErrData(err)...))
|
errs.Add(clues.Stack(err).WithClues(fctx).With(graph.ErrData(err)...))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,7 +221,7 @@ type mailPager struct {
|
|||||||
func (p *mailPager) getPage(ctx context.Context) (api.DeltaPageLinker, error) {
|
func (p *mailPager) getPage(ctx context.Context) (api.DeltaPageLinker, error) {
|
||||||
page, err := p.builder.Get(ctx, p.options)
|
page, err := p.builder.Get(ctx, p.options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return page, nil
|
return page, nil
|
||||||
@ -249,7 +249,7 @@ func (c Mail) GetAddedAndRemovedItemIDs(
|
|||||||
resetDelta bool
|
resetDelta bool
|
||||||
)
|
)
|
||||||
|
|
||||||
ctx = clues.AddAll(
|
ctx = clues.Add(
|
||||||
ctx,
|
ctx,
|
||||||
"category", selectors.ExchangeMail,
|
"category", selectors.ExchangeMail,
|
||||||
"container_id", directoryID)
|
"container_id", directoryID)
|
||||||
@ -259,7 +259,7 @@ func (c Mail) GetAddedAndRemovedItemIDs(
|
|||||||
return nil,
|
return nil,
|
||||||
nil,
|
nil,
|
||||||
DeltaUpdate{},
|
DeltaUpdate{},
|
||||||
clues.Wrap(err, "setting contact folder options").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
clues.Wrap(err, "setting contact folder options").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(oldDelta) > 0 {
|
if len(oldDelta) > 0 {
|
||||||
@ -332,12 +332,12 @@ func (c Mail) Serialize(
|
|||||||
defer writer.Close()
|
defer writer.Close()
|
||||||
|
|
||||||
if err = writer.WriteObjectValue("", msg); err != nil {
|
if err = writer.WriteObjectValue("", msg); err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
bs, err := writer.GetSerializedContent()
|
bs, err := writer.GetSerializedContent()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "serializing email").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "serializing email").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bs, nil
|
return bs, nil
|
||||||
|
|||||||
@ -74,14 +74,14 @@ func getItemsAddedAndRemovedFromContainer(
|
|||||||
// get the next page of data, check for standard errors
|
// get the next page of data, check for standard errors
|
||||||
resp, err := pager.getPage(ctx)
|
resp, err := pager.getPage(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, deltaURL, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, nil, deltaURL, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// each category type responds with a different interface, but all
|
// each category type responds with a different interface, but all
|
||||||
// of them comply with GetValue, which is where we'll get our item data.
|
// of them comply with GetValue, which is where we'll get our item data.
|
||||||
items, err := pager.valuesIn(resp)
|
items, err := pager.valuesIn(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, "", clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, nil, "", clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
itemCount += len(items)
|
itemCount += len(items)
|
||||||
|
|||||||
@ -48,7 +48,7 @@ func uploadAttachment(
|
|||||||
) error {
|
) error {
|
||||||
attachmentType := attachmentType(attachment)
|
attachmentType := attachmentType(attachment)
|
||||||
|
|
||||||
ctx = clues.AddAll(
|
ctx = clues.Add(
|
||||||
ctx,
|
ctx,
|
||||||
"attachment_size", ptr.Val(attachment.GetSize()),
|
"attachment_size", ptr.Val(attachment.GetSize()),
|
||||||
"attachment_id", ptr.Val(attachment.GetId()),
|
"attachment_id", ptr.Val(attachment.GetId()),
|
||||||
|
|||||||
@ -44,7 +44,7 @@ func (mau *mailAttachmentUploader) uploadSmallAttachment(ctx context.Context, at
|
|||||||
Attachments().
|
Attachments().
|
||||||
Post(ctx, attach, nil)
|
Post(ctx, attach, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -68,7 +68,7 @@ func (mau *mailAttachmentUploader) uploadSession(
|
|||||||
CreateUploadSession().
|
CreateUploadSession().
|
||||||
Post(ctx, session, nil)
|
Post(ctx, session, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "uploading mail attachment").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "uploading mail attachment").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return r, nil
|
return r, nil
|
||||||
@ -94,7 +94,7 @@ func (eau *eventAttachmentUploader) uploadSmallAttachment(ctx context.Context, a
|
|||||||
Attachments().
|
Attachments().
|
||||||
Post(ctx, attach, nil)
|
Post(ctx, attach, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -116,7 +116,7 @@ func (eau *eventAttachmentUploader) uploadSession(
|
|||||||
CreateUploadSession().
|
CreateUploadSession().
|
||||||
Post(ctx, session, nil)
|
Post(ctx, session, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "uploading event attachment").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "uploading event attachment").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return r, nil
|
return r, nil
|
||||||
|
|||||||
@ -77,7 +77,7 @@ func RestoreExchangeContact(
|
|||||||
|
|
||||||
response, err := service.Client().UsersById(user).ContactFoldersById(destination).Contacts().Post(ctx, contact, nil)
|
response, err := service.Client().UsersById(user).ContactFoldersById(destination).Contacts().Post(ctx, contact, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "uploading Contact").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "uploading Contact").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if response == nil {
|
if response == nil {
|
||||||
@ -124,7 +124,7 @@ func RestoreExchangeEvent(
|
|||||||
|
|
||||||
response, err := service.Client().UsersById(user).CalendarsById(destination).Events().Post(ctx, transformedEvent, nil)
|
response, err := service.Client().UsersById(user).CalendarsById(destination).Events().Post(ctx, transformedEvent, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "uploading event").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Wrap(err, "uploading event").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if response == nil {
|
if response == nil {
|
||||||
@ -248,7 +248,7 @@ func SendMailToBackStore(
|
|||||||
|
|
||||||
response, err := service.Client().UsersById(user).MailFoldersById(destination).Messages().Post(ctx, message, nil)
|
response, err := service.Client().UsersById(user).MailFoldersById(destination).Messages().Post(ctx, message, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Wrap(err, "restoring mail").WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return clues.Wrap(err, "restoring mail").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if response == nil {
|
if response == nil {
|
||||||
@ -379,7 +379,7 @@ func restoreCollection(
|
|||||||
user = directory.ResourceOwner()
|
user = directory.ResourceOwner()
|
||||||
)
|
)
|
||||||
|
|
||||||
ctx = clues.AddAll(
|
ctx = clues.Add(
|
||||||
ctx,
|
ctx,
|
||||||
"full_path", directory,
|
"full_path", directory,
|
||||||
"service", service,
|
"service", service,
|
||||||
|
|||||||
@ -336,7 +336,7 @@ func (middleware RetryHandler) Intercept(
|
|||||||
|
|
||||||
response, err := pipeline.Next(req, middlewareIndex)
|
response, err := pipeline.Next(req, middlewareIndex)
|
||||||
if err != nil && !IsErrTimeout(err) {
|
if err != nil && !IsErrTimeout(err) {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
exponentialBackOff := backoff.NewExponentialBackOff()
|
exponentialBackOff := backoff.NewExponentialBackOff()
|
||||||
@ -354,7 +354,7 @@ func (middleware RetryHandler) Intercept(
|
|||||||
exponentialBackOff,
|
exponentialBackOff,
|
||||||
err)
|
err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return response, nil
|
return response, nil
|
||||||
|
|||||||
@ -322,12 +322,12 @@ func getResources(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "retrieving tenant's resources").
|
return nil, clues.Wrap(err, "retrieving tenant's resources").
|
||||||
WithClues(ctx).
|
WithClues(ctx).
|
||||||
WithAll(graph.ErrData(err)...)
|
With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
iter, err := msgraphgocore.NewPageIterator(response, gs.Adapter(), parser)
|
iter, err := msgraphgocore.NewPageIterator(response, gs.Adapter(), parser)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
callbackFunc := func(item any) bool {
|
callbackFunc := func(item any) bool {
|
||||||
@ -352,7 +352,7 @@ func getResources(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := iter.Iterate(ctx, callbackFunc); err != nil {
|
if err := iter.Iterate(ctx, callbackFunc); err != nil {
|
||||||
return nil, clues.Stack(err).WithClues(ctx).WithAll(graph.ErrData(err)...)
|
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return resources, errs.Err()
|
return resources, errs.Err()
|
||||||
|
|||||||
@ -505,7 +505,7 @@ func (c *Collections) UpdateCollections(
|
|||||||
if ok {
|
if ok {
|
||||||
prevPath, err = path.FromDataLayerPath(prevPathStr, false)
|
prevPath, err = path.FromDataLayerPath(prevPathStr, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Wrap(err, "invalid previous path").WithAll("path_string", prevPathStr)
|
return clues.Wrap(err, "invalid previous path").With("path_string", prevPathStr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,7 +617,7 @@ func (c *Collections) UpdateCollections(
|
|||||||
if ok {
|
if ok {
|
||||||
prevCollectionPath, err = path.FromDataLayerPath(prevCollectionPathStr, false)
|
prevCollectionPath, err = path.FromDataLayerPath(prevCollectionPathStr, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Wrap(err, "invalid previous path").WithAll("path_string", prevCollectionPathStr)
|
return clues.Wrap(err, "invalid previous path").With("path_string", prevCollectionPathStr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ func (iw *writer) Write(p []byte) (int, error) {
|
|||||||
}).
|
}).
|
||||||
SetBody(bytes.NewReader(p)).Put(iw.url)
|
SetBody(bytes.NewReader(p)).Put(iw.url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, clues.Wrap(err, "uploading item").WithAll(
|
return 0, clues.Wrap(err, "uploading item").With(
|
||||||
"upload_id", iw.id,
|
"upload_id", iw.id,
|
||||||
"upload_chunk_size", rangeLength,
|
"upload_chunk_size", rangeLength,
|
||||||
"upload_offset", iw.lastWrittenOffset,
|
"upload_offset", iw.lastWrittenOffset,
|
||||||
|
|||||||
@ -214,7 +214,7 @@ func (ms ModelStore) baseModelFromMetadata(
|
|||||||
) (*model.BaseModel, error) {
|
) (*model.BaseModel, error) {
|
||||||
res := &model.BaseModel{}
|
res := &model.BaseModel{}
|
||||||
if err := ms.populateBaseModelFromMetadata(res, m); err != nil {
|
if err := ms.populateBaseModelFromMetadata(res, m); err != nil {
|
||||||
return nil, clues.Stack(err).WithAll("metadata_id", m.ID, "metadata_modtime", m.ModTime)
|
return nil, clues.Stack(err).With("metadata_id", m.ID, "metadata_modtime", m.ModTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
@ -349,7 +349,7 @@ func (ms *ModelStore) GetWithModelStoreID(
|
|||||||
if mdlbl != s.String() {
|
if mdlbl != s.String() {
|
||||||
return clues.Stack(errModelTypeMismatch).
|
return clues.Stack(errModelTypeMismatch).
|
||||||
WithClues(ctx).
|
WithClues(ctx).
|
||||||
WithAll("expected_label", s, "got_label", mdlbl)
|
With("expected_label", s, "got_label", mdlbl)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ms.populateBaseModelFromMetadata(m.Base(), metadata); err != nil {
|
if err := ms.populateBaseModelFromMetadata(m.Base(), metadata); err != nil {
|
||||||
@ -387,14 +387,14 @@ func (ms *ModelStore) checkPrevModelVersion(
|
|||||||
if meta.ID != b.ModelStoreID {
|
if meta.ID != b.ModelStoreID {
|
||||||
return clues.New("updated model has different ModelStoreID").
|
return clues.New("updated model has different ModelStoreID").
|
||||||
WithClues(ctx).
|
WithClues(ctx).
|
||||||
WithAll("expected_id", meta.ID, "model_store_id", b.ModelStoreID)
|
With("expected_id", meta.ID, "model_store_id", b.ModelStoreID)
|
||||||
}
|
}
|
||||||
|
|
||||||
mdlbl := meta.Labels[manifest.TypeLabelKey]
|
mdlbl := meta.Labels[manifest.TypeLabelKey]
|
||||||
if mdlbl != s.String() {
|
if mdlbl != s.String() {
|
||||||
return clues.New("updated model has different model type").
|
return clues.New("updated model has different model type").
|
||||||
WithClues(ctx).
|
WithClues(ctx).
|
||||||
WithAll("expected_label", s, "got_label", mdlbl)
|
With("expected_label", s, "got_label", mdlbl)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -170,7 +170,7 @@ func (cp *corsoProgress) FinishedFile(relativePath string, err error) {
|
|||||||
if d.info == nil {
|
if d.info == nil {
|
||||||
if d.prevPath == nil {
|
if d.prevPath == nil {
|
||||||
cp.errs.Add(clues.New("item sourced from previous backup with no previous path").
|
cp.errs.Add(clues.New("item sourced from previous backup with no previous path").
|
||||||
WithAll(
|
With(
|
||||||
"service", d.repoPath.Service().String(),
|
"service", d.repoPath.Service().String(),
|
||||||
"category", d.repoPath.Category().String(),
|
"category", d.repoPath.Category().String(),
|
||||||
))
|
))
|
||||||
@ -264,7 +264,7 @@ func (cp *corsoProgress) Error(relpath string, err error, isIgnored bool) {
|
|||||||
defer cp.UploadProgress.Error(relpath, err, isIgnored)
|
defer cp.UploadProgress.Error(relpath, err, isIgnored)
|
||||||
|
|
||||||
cp.errs.Add(clues.Wrap(err, "kopia reported error").
|
cp.errs.Add(clues.Wrap(err, "kopia reported error").
|
||||||
WithAll("is_ignored", isIgnored, "relative_path", relpath))
|
With("is_ignored", isIgnored, "relative_path", relpath))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cp *corsoProgress) put(k string, v *itemDetails) {
|
func (cp *corsoProgress) put(k string, v *itemDetails) {
|
||||||
|
|||||||
@ -149,7 +149,7 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) {
|
|||||||
|
|
||||||
op.Results.BackupID = model.StableID(uuid.NewString())
|
op.Results.BackupID = model.StableID(uuid.NewString())
|
||||||
|
|
||||||
ctx = clues.AddAll(
|
ctx = clues.Add(
|
||||||
ctx,
|
ctx,
|
||||||
"tenant_id", op.account.ID(), // TODO: pii
|
"tenant_id", op.account.ID(), // TODO: pii
|
||||||
"resource_owner", op.ResourceOwner, // TODO: pii
|
"resource_owner", op.ResourceOwner, // TODO: pii
|
||||||
@ -609,7 +609,7 @@ func mergeDetails(
|
|||||||
if addedEntries != len(shortRefsFromPrevBackup) {
|
if addedEntries != len(shortRefsFromPrevBackup) {
|
||||||
return clues.New("incomplete migration of backup details").
|
return clues.New("incomplete migration of backup details").
|
||||||
WithClues(ctx).
|
WithClues(ctx).
|
||||||
WithAll("item_count", addedEntries, "expected_item_count", len(shortRefsFromPrevBackup))
|
With("item_count", addedEntries, "expected_item_count", len(shortRefsFromPrevBackup))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -204,7 +204,7 @@ func collectMetadata(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.
|
return nil, clues.
|
||||||
Wrap(err, "building metadata path").
|
Wrap(err, "building metadata path").
|
||||||
WithAll("metadata_file", fn, "category", reason.Category)
|
With("metadata_file", fn, "category", reason.Category)
|
||||||
}
|
}
|
||||||
|
|
||||||
paths = append(paths, p)
|
paths = append(paths, p)
|
||||||
|
|||||||
@ -150,7 +150,7 @@ func (op *RestoreOperation) Run(ctx context.Context) (restoreDetails *details.De
|
|||||||
observe.Complete()
|
observe.Complete()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
ctx = clues.AddAll(
|
ctx = clues.Add(
|
||||||
ctx,
|
ctx,
|
||||||
"tenant_id", op.account.ID(), // TODO: pii
|
"tenant_id", op.account.ID(), // TODO: pii
|
||||||
"backup_id", op.BackupID,
|
"backup_id", op.BackupID,
|
||||||
@ -208,7 +208,7 @@ func (op *RestoreOperation) do(
|
|||||||
return nil, errors.Wrap(err, "formatting paths from details")
|
return nil, errors.Wrap(err, "formatting paths from details")
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = clues.AddAll(
|
ctx = clues.Add(
|
||||||
ctx,
|
ctx,
|
||||||
"resource_owner", bup.Selector.DiscreteOwner,
|
"resource_owner", bup.Selector.DiscreteOwner,
|
||||||
"details_paths", len(paths))
|
"details_paths", len(paths))
|
||||||
|
|||||||
@ -144,7 +144,7 @@ func validateServiceAndCategory(service ServiceType, category CategoryType) erro
|
|||||||
|
|
||||||
if _, ok := cats[category]; !ok {
|
if _, ok := cats[category]; !ok {
|
||||||
return clues.New("unknown service/category combination").
|
return clues.New("unknown service/category combination").
|
||||||
WithAll("service", fmt.Sprintf("%q", service), "category", fmt.Sprintf("%q", category))
|
With("service", fmt.Sprintf("%q", service), "category", fmt.Sprintf("%q", category))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -89,7 +89,7 @@ func Initialize(
|
|||||||
s storage.Storage,
|
s storage.Storage,
|
||||||
opts control.Options,
|
opts control.Options,
|
||||||
) (Repository, error) {
|
) (Repository, error) {
|
||||||
ctx = clues.AddAll(
|
ctx = clues.Add(
|
||||||
ctx,
|
ctx,
|
||||||
"acct_provider", acct.Provider.String(),
|
"acct_provider", acct.Provider.String(),
|
||||||
"acct_id", acct.ID(), // TODO: pii
|
"acct_id", acct.ID(), // TODO: pii
|
||||||
@ -157,7 +157,7 @@ func Connect(
|
|||||||
s storage.Storage,
|
s storage.Storage,
|
||||||
opts control.Options,
|
opts control.Options,
|
||||||
) (Repository, error) {
|
) (Repository, error) {
|
||||||
ctx = clues.AddAll(
|
ctx = clues.Add(
|
||||||
ctx,
|
ctx,
|
||||||
"acct_provider", acct.Provider.String(),
|
"acct_provider", acct.Provider.String(),
|
||||||
"acct_id", acct.ID(), // TODO: pii
|
"acct_id", acct.ID(), // TODO: pii
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user