-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Integrations: AWS OIDC - ListDatabases action #24460
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
230700f
AWSOIDC Integration: ListDatabases
marcoandredinis b557b02
add resource and account ids to DB resource
marcoandredinis 195b139
move api namespaces
marcoandredinis 8d45b7d
use types.Database instead of custom database format
marcoandredinis 6a70b96
add database uri
marcoandredinis babd36b
fix comments and rate limiter
marcoandredinis b2c240f
test name override when converting RDS V2 DBs
marcoandredinis cb5a180
fix webapi database URI field
marcoandredinis 13c2df5
TestClusterDatabasesGet: add parallel
marcoandredinis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
282 changes: 213 additions & 69 deletions
282
api/gen/proto/go/teleport/integration/v1/integration_service.pb.go
Large diffs are not rendered by default.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
api/gen/proto/go/teleport/integration/v1/integration_service_grpc.pb.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| Copyright 2023 Gravitational, Inc. | ||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package types | ||
|
|
||
| import "github.com/gravitational/trace" | ||
|
|
||
| const ( | ||
| // IntegrationAWSOIDCAudience is the client id used to generate the JWT. | ||
| // This value must match the Audience defined in the IAM Identity Provider of the Integration. | ||
| IntegrationAWSOIDCAudience = "discover.teleport" | ||
|
|
||
| // IntegrationAWSOIDCSubject identifies the system that is going to use the token. | ||
| IntegrationAWSOIDCSubject = "system:proxy" | ||
| ) | ||
|
|
||
| // GenerateAWSOIDCTokenRequest are the parameters used to request an AWS OIDC Integration token. | ||
| type GenerateAWSOIDCTokenRequest struct { | ||
| // Issuer is the entity that is signing the JWT. | ||
| // This value must contain the AWS OIDC Integration configured provider (Proxy's Public URL). | ||
| Issuer string `json:"issuer"` | ||
| } | ||
|
|
||
| // CheckAndSetDefaults checks if the required fields are present. | ||
| func (req *GenerateAWSOIDCTokenRequest) CheckAndSetDefaults() error { | ||
| if req.Issuer == "" { | ||
| return trace.BadParameter("issuer is required") | ||
| } | ||
|
|
||
| return nil | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| Copyright 2023 Gravitational, Inc. | ||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package types | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/gravitational/trace" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| // TestGenerateAWSOIDCTokenRequest validates that the required fields are checked. | ||
| func TestGenerateAWSOIDCTokenRequest(t *testing.T) { | ||
| t.Run("error when no issuer is provided", func(t *testing.T) { | ||
| req := GenerateAWSOIDCTokenRequest{} | ||
|
|
||
| err := req.CheckAndSetDefaults() | ||
| require.True(t, trace.IsBadParameter(err), "expected a bad parameter error, got %+v", err) | ||
| }) | ||
|
|
||
| t.Run("success when issuer is provided", func(t *testing.T) { | ||
| req := GenerateAWSOIDCTokenRequest{ | ||
| Issuer: "https://example.com", | ||
| } | ||
|
|
||
| err := req.CheckAndSetDefaults() | ||
| require.NoError(t, err) | ||
| }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm confused why this type is necessary? can't we use the pb type from the get go? this is what i see in other places, so i am not sure which method/pattern to stick with (or what makes this one the exception)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it only to implement the
CheckAndSetDefaultsThe pb type is created here:
api/gen/proto/go/teleport/integration/v1/integration_service.pb.goI was trying to avoid adding custom code close in those auto generated folders.