GC: Logging: Expand ItemAttachment object details for coverage (#2366)

## Description
Updates within /internal/connector/exchange package. Adds helper function for displaying the internal object item type that is included as an attachment. This will help overall with supporting additional `ItemAttachment` objects. 
<!-- Insert PR description-->

## Does this PR need a docs update or release note?
- [x]  No 

## Type of change

<!--- Please check the type of change your PR introduces: --->

- [x] 🧹 Tech Debt/Cleanup

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* related to #2353<issue>

## Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
This commit is contained in:
Danny 2023-02-02 12:22:04 -05:00 committed by GitHub
parent 6f44a507b5
commit 844dcae9b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,9 +55,15 @@ func uploadAttachment(
// item Attachments to be skipped until the completion of Issue #2353 // item Attachments to be skipped until the completion of Issue #2353
if attachmentType == models.ITEM_ATTACHMENTTYPE { if attachmentType == models.ITEM_ATTACHMENTTYPE {
name := ""
if attachment.GetName() != nil {
name = *attachment.GetName()
}
logger.Ctx(ctx).Infow("item attachment uploads are not supported ", logger.Ctx(ctx).Infow("item attachment uploads are not supported ",
"attachment_name", *attachment.GetName(), // TODO: Update to support PII protection "attachment_name", name, // TODO: Update to support PII protection
"attachment_type", attachmentType, "attachment_type", attachmentType,
"internal_item_type", getItemAttachmentItemType(attachment),
"attachment_id", *attachment.GetId(), "attachment_id", *attachment.GetId(),
) )
@ -101,3 +107,19 @@ func uploadLargeAttachment(ctx context.Context, uploader attachmentUploadable,
return nil return nil
} }
func getItemAttachmentItemType(query models.Attachmentable) string {
empty := ""
attachment, ok := query.(models.ItemAttachmentable)
if !ok {
return empty
}
item := attachment.GetItem()
if item.GetOdataType() == nil {
return empty
}
return *item.GetOdataType()
}