Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

events.CodeCommitReference has missing Deleted field #528

Closed
praveenk007 opened this issue Nov 1, 2023 · 2 comments
Closed

events.CodeCommitReference has missing Deleted field #528

praveenk007 opened this issue Nov 1, 2023 · 2 comments
Labels
type/events issue or feature request related to the events package

Comments

@praveenk007
Copy link
Contributor

praveenk007 commented Nov 1, 2023

Is your feature request related to a problem? Please describe.
The field Deleted is missing within events.CodeCommitReference struct.
Due to the lack of this field, our lambda function is unable to identify if the event was of a ref deletion or not.

Describe the solution you'd like
Add the field in below struct

type CodeCommitReference struct {
	Commit  string `json:"commit"`
	Ref     string `json:"ref"`
	Created bool   `json:"created,omitempty"`
        Deleted bool   `json:"deleted,omitempty"`
}

and modify String() function as below

func (r CodeCommitReference) String() string {
	return fmt.Sprintf(
      "{commit: %v, ref: %v, created: %v, deleted: %v}", r.Commit, r.Ref, r.Created, r.Deleted)
}

Describe alternatives you've considered
We have been provided a patch by AWS team for now with the same above changes which we are using in our local env and CI/CD.

Additional context
Here is the event received by lambda function upon tag deletion.

{
    "Records": [
        {
            "awsRegion": "us-east-2",
            "codecommit": {
                "references": [
                    {
                        "commit": "f76677c0a0bc68567bb1d629dcbc6f753c1ae993",
                        "deleted": true,
                        "ref": "refs/tags/1.0.0"
                    }
                ]
            },
            "customData": null,
            "eventId": "f46608e0-077d-455d-978b-61bfbb34c533",
            "eventName": "ReferenceChanges",
            "eventPartNumber": 1,
            "eventSource": "aws:codecommit",
            "eventSourceARN": "***redacted",
            "eventTime": "2023-05-08T05:24:10.997+0000",
            "eventTotalParts": 1,
            "eventTriggerConfigId": "b5d6b7e6-0275-4250-b296-db33d2b880ce",
            "eventTriggerName": "MyNotification",
            "eventVersion": "1.0",
            "userIdentityARN": "***redacted"
        }
    ]
}

The deleted field from above json doesn't get mapped due to missing field in the struct.

@praveenk007 praveenk007 changed the title events.CodeCommitReference within aws-lambda-go sdk has missing Deleted field events.CodeCommitReference has missing Deleted field Nov 1, 2023
@bmoffatt bmoffatt added the type/events issue or feature request related to the events package label Nov 1, 2023
@bmoffatt
Copy link
Collaborator

bmoffatt commented Nov 1, 2023

Do you have a reference handy to the AWS documentation for this field?

@praveenk007
Copy link
Contributor Author

praveenk007 commented Nov 2, 2023

@bmoffatt There isn't any as the field itself is missing. I have updated Additional Context above with an example event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/events issue or feature request related to the events package
Projects
None yet
Development

No branches or pull requests

2 participants