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

Added Scaleway Shell Plugin #314

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

parthiv11
Copy link
Contributor

@parthiv11 parthiv11 commented Jun 24, 2023

Overview

  • Used previous PR for this Scaleway Shell Plugin code

  • Created a new plugin

Related Issue(s)

How To Test

Changelog

@parthiv11
Copy link
Contributor Author

@arunsathiya please help me to proceed

@AndyTitu AndyTitu added the waiting-on-reviewer signals that a certain PR is waiting for a review from a 1Password team member label Jun 26, 2023
@techcraver
Copy link
Contributor

techcraver commented Jun 26, 2023

Hello! Is this a submission for the 1Password Hackathon with Hashnode? If so, when you're ready, please be sure you write a blog post on Hashnode to make your submission official. Full instructions are on the Hackathon page.

@parthiv11
Copy link
Contributor Author

Thank you for information, I will write blog

But can you please help me in this plugin

@arunsathiya
Copy link
Contributor

Hi Parthiv, thanks for confirming.

Yes, reviewing this PR is on my radar. I'll follow up soon!

@arunsathiya arunsathiya added the hashnode hackathon Ideas and inspiration for the hackathon running from June 1st - June 30th label Jun 26, 2023
@parthiv11 parthiv11 marked this pull request as ready for review June 27, 2023 13:25
@arunsathiya arunsathiya self-requested a review June 28, 2023 15:20
Copy link
Contributor

@AndyTitu AndyTitu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution @parthiv11 . This PR is on the right track. Here's the documentation for the scale way CLI (for other reviewers) which let's us know that these env vars actually work: sdk/schema/credname/names.go

Did a first iteration and left the first suggestions. After you're done with those, feel free to move on to resolving the TODO comments you've added.

plugins/scaleway/api_key.go Show resolved Hide resolved
plugins/scaleway/api_key.go Outdated Show resolved Hide resolved
Copy link
Member

@hculea hculea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly nits, thank you for your contribution! ❤️

plugins/scaleway/api_key.go Outdated Show resolved Hide resolved
plugins/scaleway/api_key.go Outdated Show resolved Hide resolved
plugins/scaleway/api_key.go Outdated Show resolved Hide resolved
plugins/scaleway/api_key.go Outdated Show resolved Hide resolved
Copy link
Member

@hculea hculea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvements! I think there are a few open comments from prior reviews, let's make sure those get addressed as well.

sdk/schema/fieldname/names.go Outdated Show resolved Hide resolved
@hculea hculea requested review from hculea and removed request for arunsathiya July 5, 2023 08:08
Copy link
Member

@hculea hculea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Only a few nits and ready to go IMO 👍

AccessKey string `yaml:"access_key"`
SecretKey string `yaml:"secret_key"`
DefaultOrganizationID string `yaml:"default_organization_id"`
DefaultProjectID string `yaml:"default_project_id"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this attribute used anywhere?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed the same thing. @parthiv11, let's remove this since this is not being used anywhere. But before we do, would you know if the Scaleway CLI needs both the organization ID and the project ID to function?

sdk/schema/fieldname/names.go Outdated Show resolved Hide resolved
plugins/scaleway/api_key_test.go Show resolved Hide resolved
plugins/scaleway/api_key_test.go Show resolved Hide resolved
@hculea hculea self-requested a review July 5, 2023 10:09
@hculea
Copy link
Member

hculea commented Jul 7, 2023

Hey @parthiv11 , I see there hasn't been any activity on this PR in a bit, is there anything that we can help you with?

We'd love to get this to the finish line together! 🚀

@parthiv11
Copy link
Contributor Author

Sorry for delay,
Made changes as suggested

@arunsathiya arunsathiya self-requested a review July 11, 2023 15:00
Copy link
Contributor

@arunsathiya arunsathiya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks 95% done, thanks for your contribution @parthiv11! There's only one major task to complete here: support importing of multiple profiles from the config file. Could you give it a try? We'll be around if you need a hand. 😄

Name: "Scaleway CLI",
Runs: []string{"scw"},
DocsURL: sdk.URL("https://www.scaleway.com/en/cli"),
NeedsAuth: needsauth.IfAll(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's skip for -p as well, because that applies only when the configuration file exists on the computer. So, it's not relevant when a shell plugin is being used.

plugins/scaleway/api_key.go Show resolved Hide resolved
AccessKey string `yaml:"access_key"`
SecretKey string `yaml:"secret_key"`
DefaultOrganizationID string `yaml:"default_organization_id"`
DefaultProjectID string `yaml:"default_project_id"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed the same thing. @parthiv11, let's remove this since this is not being used anywhere. But before we do, would you know if the Scaleway CLI needs both the organization ID and the project ID to function?

plugins/scaleway/api_key_test.go Show resolved Hide resolved
plugins/scaleway/api_key_test.go Show resolved Hide resolved
if config.DefaultZone != "" {
fields[fieldname.DefaultZone] = config.DefaultZone
}
out.AddCandidate(sdk.ImportCandidate{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that Scaleway config file supports the concepts of profiles. Could we import the profile name as a Namehint? You'll need to set up at least two profiles to test the importer. Example:

profiles:
  first:
    access_key: redacted
    secret_key: redacted
    default_organization_id: redacted
    default_project_id: redacted
    default_zone: fr-par-1
    default_region: fr-par
    # api_url: https://api.scaleway.com
    # insecure: false

  second:
    access_key: redacted
    secret_key: redacted
    default_organization_id: redacted
    default_project_id: redacted
    default_zone: fr-par-1
    default_region: fr-par
    # api_url: https://api.scaleway.com
    # insecure: false

There's an example of how to import multiple profiles in the Fastly shell plugin.

@hculea
Copy link
Member

hculea commented Jul 17, 2023

Please have a look over your tests and lint 😄 You can run tests locally using make test, let us know if we can help you get those rolling!

@AndyTitu AndyTitu added the in-progress this PR is being worked on/comments are in the process of being addressed by the contributor label Aug 30, 2023
@AndyTitu
Copy link
Contributor

@parthiv11 is there a way we can help you move this forward?

@AndyTitu AndyTitu removed the waiting-on-reviewer signals that a certain PR is waiting for a review from a 1Password team member label Aug 30, 2023
@parthiv11
Copy link
Contributor Author

@AndyTitu Not able to test it currently as I don't have scaleway account

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashnode hackathon Ideas and inspiration for the hackathon running from June 1st - June 30th in-progress this PR is being worked on/comments are in the process of being addressed by the contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New plugin: Scaleway CLI
5 participants