-
Notifications
You must be signed in to change notification settings - Fork 192
feat: region expansion #1333
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
feat: region expansion #1333
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
1b9897d
add user profile sub command with mock profiles
evanliu048 d5b0511
checkpoint
chaynabors 3914f68
modify protos and add handlers
chaynabors 2a7f4a8
Merge remote-tracking branch 'origin/main' into feature/region-expansion
chaynabors 0244372
Merge remote-tracking branch 'origin/feature/region-expansion' into r…
evanliu048 3ba8797
coorprate with real response
evanliu048 a5b958f
remove unused code
chaynabors a809843
add profile in whoami
evanliu048 0c5f454
Merge branch 'feature/region-expansion' of github.com:aws/amazon-q-de…
evanliu048 1df40e0
hi yifan
chaynabors 1a60fe6
byebye ctrlc handler
chaynabors 4f3593c
hi chay (add profile_arn)
evanliu048 d0144a3
remove nonstreaming q client
chaynabors 64f2e76
add profile telemetry
evanliu048 20213e4
Merge branch 'feature/region-expansion' of github.com:aws/amazon-q-de…
evanliu048 5333084
add profile selector in dashboard
chaynabors 37275c5
cleanup
chaynabors 0d430c4
Merge remote-tracking branch 'origin/main' into feature/region-expansion
chaynabors 53713bf
revise whoami flag in login&profile command flow
evanliu048 b845ad2
add amazonq_profileState
evanliu048 9f063cc
finish up major tasks
chaynabors 6300b5c
finish up final tasks
chaynabors c042381
fix lints
chaynabors 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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
mod client; | ||
mod shared; | ||
pub(crate) mod shared; | ||
mod streaming_client; | ||
|
||
pub use client::{ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use serde::{ | ||
Deserialize, | ||
Serialize, | ||
}; | ||
|
||
use crate::Client; | ||
use crate::endpoints::Endpoint; | ||
|
||
#[derive(Debug, Deserialize, Serialize)] | ||
pub struct Profile { | ||
pub arn: String, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Creating an |
||
pub profile_name: String, | ||
} | ||
|
||
impl From<amzn_codewhisperer_client::types::Profile> for Profile { | ||
fn from(profile: amzn_codewhisperer_client::types::Profile) -> Self { | ||
Self { | ||
arn: profile.arn, | ||
profile_name: profile.profile_name, | ||
} | ||
} | ||
} | ||
|
||
pub async fn list_available_profiles() -> Vec<Profile> { | ||
let mut profiles = vec![]; | ||
for endpoint in Endpoint::CODEWHISPERER_ENDPOINTS { | ||
let client = Client::new_codewhisperer_client(&endpoint).await; | ||
match client.list_available_profiles().await { | ||
Ok(mut p) => profiles.append(&mut p), | ||
Err(e) => tracing::warn!("Failed to list profiles from endpoint {:?}: {:?}", endpoint, e), | ||
} | ||
} | ||
|
||
profiles | ||
} |
Empty file.
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,26 @@ | ||
use serde::{ | ||
Deserialize, | ||
Serialize, | ||
}; | ||
|
||
#[derive(Debug, Deserialize, Serialize)] | ||
pub struct Profile { | ||
pub arn: String, | ||
pub profile_name: String, | ||
} | ||
|
||
impl From<amzn_codewhisperer_client::types::Profile> for Profile { | ||
fn from(profile: amzn_codewhisperer_client::types::Profile) -> Self { | ||
Self { | ||
arn: profile.arn, | ||
profile_name: profile.profile_name, | ||
} | ||
} | ||
} | ||
|
||
pub fn set_profile(profile: Profile) -> Result<(), Error> { | ||
Ok(fig_settings::state::set_value( | ||
"api.codewhisperer.service", | ||
serde_json::to_string(&profile)?, | ||
)?) | ||
} | ||
evanliu048 marked this conversation as resolved.
Show resolved
Hide resolved
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
use fig_api_client::profile::Profile; | ||
use fig_proto::fig::{ | ||
ListAvailableProfilesRequest, | ||
ListAvailableProfilesResponse, | ||
SetProfileRequest, | ||
}; | ||
|
||
use super::{ | ||
RequestResult, | ||
RequestResultImpl, | ||
ServerOriginatedSubMessage, | ||
}; | ||
|
||
pub fn set_profile(request: SetProfileRequest) -> RequestResult { | ||
let Some(profile) = request.profile else { | ||
return RequestResult::error("Profile was not provided."); | ||
}; | ||
|
||
let profile = Profile { | ||
arn: profile.arn, | ||
profile_name: profile.profile_name, | ||
}; | ||
|
||
let profile = match serde_json::to_string(&profile) { | ||
Ok(profile) => profile, | ||
Err(err) => return RequestResult::error(err.to_string()), | ||
}; | ||
|
||
if let Err(err) = fig_settings::state::set_value("api.codewhisperer.profile", profile) { | ||
return RequestResult::error(err.to_string()); | ||
} | ||
|
||
RequestResult::success() | ||
} | ||
|
||
pub async fn list_available_profiles(_request: ListAvailableProfilesRequest) -> RequestResult { | ||
Ok( | ||
ServerOriginatedSubMessage::ListAvailableProfilesResponse(ListAvailableProfilesResponse { | ||
profiles: fig_api_client::profile::list_available_profiles() | ||
.await | ||
.iter() | ||
.map(|profile| fig_proto::fig::Profile { | ||
arn: profile.arn.clone(), | ||
profile_name: profile.profile_name.clone(), | ||
}) | ||
.collect(), | ||
}) | ||
.into(), | ||
) | ||
} |
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.
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.
nit - use a valid arn format for these