diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index aca9ae7..bfb7bb9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "name": "Daytona Provider Sample", + "name": "Daytona AWS Provider", "image": "ghcr.io/daytonaio/go-devcontainer:main", "containerEnv": { "LOG_LEVEL": "debug" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 886dea3..43438ba 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,11 +4,11 @@ The team at Daytona welcomes contributions from the community. There are many wa ## Provide Feedback -You might find things that can be improved while you are using the Daytona Provider Sample. You can help by [submitting an issue](https://github.com/daytonaio/daytona-provider-sample/issues/new) when: +You might find things that can be improved while you are using the Daytona AWS Provider. You can help by [submitting an issue](https://github.com/daytonaio/daytona-provider-aws/issues/new) when: -* When the Provider Sample crashes or you encounter a bug that can only be resolved by restarting Daytona. +* When the AWS Provider crashes or you encounter a bug that can only be resolved by restarting Daytona. * An error occurs that is unrecoverable, causes workspace integrity problems or loss, or generally prevents you from using a workspace. -* A new feature or an enhancement to an existing feature will improve the utility or usability of the Daytona Provider Sample. +* A new feature or an enhancement to an existing feature will improve the utility or usability of the Daytona AWS Provider. Before creating a new issue, please confirm that an existing issue doesn't already exist. @@ -22,7 +22,7 @@ You can engage with our community by: * Authoring new dev containers and sharing examples ## Contributing Code -You can contribute to the Daytona Provider Sample by: +You can contribute to the Daytona AWS Provider by: * Enhancing current functionality * Fixing bugs @@ -30,7 +30,7 @@ You can contribute to the Daytona Provider Sample by: Before starting your contribution, especially for core features, we encourage you to reach out to us on [Slack](https://join.slack.com/t/daytonacommunity/shared_invite/zt-273yohksh-Q5YSB5V7tnQzX2RoTARr7Q). This allows us to ensure that your proposed feature aligns with the project's roadmap and goals. Developers are the key to making Daytona the best tool it can be, and we value input from the community. -We look forward to working with you to improve Daytona and the Provider Sample, and make development environments as easy as possible for developers everywhere. +We look forward to working with you to improve Daytona and the AWS Provider, and make development environments as easy as possible for developers everywhere. ### Steps to Contribute Code @@ -39,7 +39,7 @@ Follow the following steps to ensure your contribution goes smoothly. 1. Read and follow the steps outlined in the [Daytona Contributing Policy](README.md#contributing). 2. Configure your development environment by either following the guide below. 3. [Fork](https://help.github.com/articles/working-with-forks/) the GitHub Repository allowing you to make the changes in your own copy of the repository. -4. Create a [GitHub issue](https://github.com/daytonaio/daytona-provider-sample/issues) if one doesn't exist already. +4. Create a [GitHub issue](https://github.com/daytonaio/daytona-provider-aws/issues) if one doesn't exist already. 5. [Prepare your changes](/PREPARING_YOUR_CHANGES.md) and ensure your commits are descriptive. The document contains an optional commit template, if desired. 6. Ensure that you sign off on all your commits to comply with the DCO v1.1. We have more details in [Prepare your changes](/PREPARING_YOUR_CHANGES.md). 7. Create a pull request on GitHub. If you're new to GitHub, read about [pull requests](https://help.github.com/articles/about-pull-requests/). You are welcome to submit your pull request for commentary or review before it is complete by creating a [draft pull request](https://help.github.com/en/articles/about-pull-requests#draft-pull-requests). Please include specific questions or items you'd like feedback on. diff --git a/README.md b/README.md index b180e83..473bb6c 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@
[![License](https://img.shields.io/badge/License-MIT-blue)](#license) -[![Go Report Card](https://goreportcard.com/badge/github.com/daytonaio/daytona-provider-sample)](https://goreportcard.com/report/github.com/daytonaio/daytona-provider-sample) -[![Issues - daytona](https://img.shields.io/github/issues/daytonaio/daytona-provider-sample)](https://github.com/daytonaio/daytona-provider-sample/issues) -![GitHub Release](https://img.shields.io/github/v/release/daytonaio/daytona-provider-sample) +[![Go Report Card](https://goreportcard.com/badge/github.com/daytonaio/daytona-provider-aws)](https://goreportcard.com/report/github.com/daytonaio/daytona-provider-aws) +[![Issues - daytona](https://img.shields.io/github/issues/daytonaio/daytona-aws-provider)](https://github.com/daytonaio/daytona-provider-aws/issues) +![GitHub Release](https://img.shields.io/github/v/release/daytonaio/daytona-aws-provider)
-

Daytona Provider Sample

+

Daytona AWS Provider

-This repository is the home of the Daytona Provider Sample. +This repository is the home of the Daytona AWS Provider.

@@ -18,9 +18,9 @@ This repository is the home of the - Report Bug + Report Bug · - Request Feature + Request Feature · Join Our Slack · diff --git a/go.mod b/go.mod index 638c30d..def2af8 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/daytonaio/daytona-provider-sample +module github.com/daytonaio/daytona-provider-aws go 1.22.2 diff --git a/hack/replace-name.sh b/hack/replace-name.sh deleted file mode 100755 index 03ddc39..0000000 --- a/hack/replace-name.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -# Check for macOS using system information -if [[ $(uname -s) == "Darwin" ]]; then - SED_CMD="gsed" - if ! command -v gsed &>/dev/null; then - echo "gsed is not installed. It is required for this script to function properly." - echo "Would you like to install gsed using Homebrew? (y/N)" - read -r response - - if [[ $response =~ ^([Yy])$ ]]; then - # Install gsed with Homebrew (if available) - if command -v brew &>/dev/null; then - brew install gsed - else - echo "Homebrew is not installed. Please install gsed manually or another package manager." - fi - exit 1 - else - echo "Exiting script as gsed is required." - exit 1 - fi - fi - echo "gsed is installed. Proceeding..." -else - SED_CMD="sed" -fi - -# Print and get input for repository name -echo -n "URL of your repository (without https://): " -read -r repositoryUrl - -# Print and get input for provider name -echo -n "Name of the provider (e.g. Docker Provider): " -read -r providerName - -# Replace ocurrences of github.com/daytonaio/daytona-provider-sample with the repository name -find . -type d \( -name "hack" -o -name ".git" \) -prune -o -type f -exec $SED_CMD -i "s|github.com/daytonaio/daytona-provider-sample|$repositoryUrl|g" {} + -echo "Replaced github.com/daytonaio/daytona-provider-sample with $repositoryUrl" - -# Replace occurrences of "provider-sample" with formatted provider name -find . -type d \( -name "hack" -o -name ".git" \) -prune -o -type f -exec $SED_CMD -i "s/provider-sample/$(echo "$providerName" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')/g" {} + -echo "Replaced provider-sample with $(echo "$providerName" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')" - -# Replace ocurrences of "SampleProvider" with the provider name -find . -type d \( -name "hack" -o -name ".git" \) -prune -o -type f -exec $SED_CMD -i "s/SampleProvider/$(echo "$providerName" | tr -d ' ')/g" {} + -echo "Replaced SampleProvider with $(echo "$providerName" | tr -d ' ')" - -# Replace occurrences of "Provider Sample" with the provider name -find . -type d \( -name "hack" -o -name ".git" \) -prune -o -type f -exec $SED_CMD -i "s/Provider Sample/$providerName/g" {} + -echo "Replaced Provider Sample with $providerName" diff --git a/main.go b/main.go index 073cd7e..4b748f2 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/go-hclog" hc_plugin "github.com/hashicorp/go-plugin" - p "github.com/daytonaio/daytona-provider-sample/pkg/provider" + p "github.com/daytonaio/daytona-provider-aws/pkg/provider" ) func main() { @@ -20,7 +20,7 @@ func main() { hc_plugin.Serve(&hc_plugin.ServeConfig{ HandshakeConfig: manager.ProviderHandshakeConfig, Plugins: map[string]hc_plugin.Plugin{ - "provider-sample": &provider.ProviderPlugin{Impl: &p.SampleProvider{}}, + "aws-provider": &provider.ProviderPlugin{Impl: &p.AWSProvider{}}, }, Logger: logger, }) diff --git a/pkg/provider/provider.go b/pkg/provider/provider.go index 2bf3d2a..84b138e 100644 --- a/pkg/provider/provider.go +++ b/pkg/provider/provider.go @@ -4,9 +4,9 @@ import ( "encoding/json" "io" - internal "github.com/daytonaio/daytona-provider-sample/internal" - log_writers "github.com/daytonaio/daytona-provider-sample/internal/log" - provider_types "github.com/daytonaio/daytona-provider-sample/pkg/types" + internal "github.com/daytonaio/daytona-provider-aws/internal" + log_writers "github.com/daytonaio/daytona-provider-aws/internal/log" + provider_types "github.com/daytonaio/daytona-provider-aws/pkg/types" "github.com/daytonaio/daytona/pkg/logs" "github.com/daytonaio/daytona/pkg/provider" @@ -14,7 +14,7 @@ import ( "github.com/daytonaio/daytona/pkg/workspace" ) -type SampleProvider struct { +type AWSProvider struct { BasePath *string DaytonaDownloadUrl *string DaytonaVersion *string @@ -24,12 +24,9 @@ type SampleProvider struct { ApiPort *uint32 ServerPort *uint32 NetworkKey *string - OwnProperty string } -func (p *SampleProvider) Initialize(req provider.InitializeProviderRequest) (*util.Empty, error) { - p.OwnProperty = "my-own-property" - +func (p *AWSProvider) Initialize(req provider.InitializeProviderRequest) (*util.Empty, error) { p.BasePath = &req.BasePath p.DaytonaDownloadUrl = &req.DaytonaDownloadUrl p.DaytonaVersion = &req.DaytonaVersion @@ -43,18 +40,18 @@ func (p *SampleProvider) Initialize(req provider.InitializeProviderRequest) (*ut return new(util.Empty), nil } -func (p SampleProvider) GetInfo() (provider.ProviderInfo, error) { +func (p AWSProvider) GetInfo() (provider.ProviderInfo, error) { return provider.ProviderInfo{ - Name: "provider-sample", + Name: "aws-provider", Version: internal.Version, }, nil } -func (p SampleProvider) GetTargetManifest() (*provider.ProviderTargetManifest, error) { +func (p AWSProvider) GetTargetManifest() (*provider.ProviderTargetManifest, error) { return provider_types.GetTargetManifest(), nil } -func (p SampleProvider) GetDefaultTargets() (*[]provider.ProviderTarget, error) { +func (p AWSProvider) GetDefaultTargets() (*[]provider.ProviderTarget, error) { info, err := p.GetInfo() if err != nil { return nil, err @@ -70,7 +67,7 @@ func (p SampleProvider) GetDefaultTargets() (*[]provider.ProviderTarget, error) return &defaultTargets, nil } -func (p SampleProvider) CreateWorkspace(workspaceReq *provider.WorkspaceRequest) (*util.Empty, error) { +func (p AWSProvider) CreateWorkspace(workspaceReq *provider.WorkspaceRequest) (*util.Empty, error) { logWriter := io.MultiWriter(&log_writers.InfoLogWriter{}) if p.LogsDir != nil { loggerFactory := logs.NewLoggerFactory(*p.LogsDir) @@ -84,19 +81,19 @@ func (p SampleProvider) CreateWorkspace(workspaceReq *provider.WorkspaceRequest) return new(util.Empty), nil } -func (p SampleProvider) StartWorkspace(workspaceReq *provider.WorkspaceRequest) (*util.Empty, error) { +func (p AWSProvider) StartWorkspace(workspaceReq *provider.WorkspaceRequest) (*util.Empty, error) { return new(util.Empty), nil } -func (p SampleProvider) StopWorkspace(workspaceReq *provider.WorkspaceRequest) (*util.Empty, error) { +func (p AWSProvider) StopWorkspace(workspaceReq *provider.WorkspaceRequest) (*util.Empty, error) { return new(util.Empty), nil } -func (p SampleProvider) DestroyWorkspace(workspaceReq *provider.WorkspaceRequest) (*util.Empty, error) { +func (p AWSProvider) DestroyWorkspace(workspaceReq *provider.WorkspaceRequest) (*util.Empty, error) { return new(util.Empty), nil } -func (p SampleProvider) GetWorkspaceInfo(workspaceReq *provider.WorkspaceRequest) (*workspace.WorkspaceInfo, error) { +func (p AWSProvider) GetWorkspaceInfo(workspaceReq *provider.WorkspaceRequest) (*workspace.WorkspaceInfo, error) { providerMetadata, err := p.getWorkspaceMetadata(workspaceReq) if err != nil { return nil, err @@ -123,7 +120,7 @@ func (p SampleProvider) GetWorkspaceInfo(workspaceReq *provider.WorkspaceRequest return workspaceInfo, nil } -func (p SampleProvider) CreateProject(projectReq *provider.ProjectRequest) (*util.Empty, error) { +func (p AWSProvider) CreateProject(projectReq *provider.ProjectRequest) (*util.Empty, error) { logWriter := io.MultiWriter(&log_writers.InfoLogWriter{}) if p.LogsDir != nil { loggerFactory := logs.NewLoggerFactory(*p.LogsDir) @@ -137,19 +134,19 @@ func (p SampleProvider) CreateProject(projectReq *provider.ProjectRequest) (*uti return new(util.Empty), nil } -func (p SampleProvider) StartProject(projectReq *provider.ProjectRequest) (*util.Empty, error) { +func (p AWSProvider) StartProject(projectReq *provider.ProjectRequest) (*util.Empty, error) { return new(util.Empty), nil } -func (p SampleProvider) StopProject(projectReq *provider.ProjectRequest) (*util.Empty, error) { +func (p AWSProvider) StopProject(projectReq *provider.ProjectRequest) (*util.Empty, error) { return new(util.Empty), nil } -func (p SampleProvider) DestroyProject(projectReq *provider.ProjectRequest) (*util.Empty, error) { +func (p AWSProvider) DestroyProject(projectReq *provider.ProjectRequest) (*util.Empty, error) { return new(util.Empty), nil } -func (p SampleProvider) GetProjectInfo(projectReq *provider.ProjectRequest) (*workspace.ProjectInfo, error) { +func (p AWSProvider) GetProjectInfo(projectReq *provider.ProjectRequest) (*workspace.ProjectInfo, error) { providerMetadata := provider_types.ProjectMetadata{ Property: projectReq.Project.Name, } @@ -169,7 +166,7 @@ func (p SampleProvider) GetProjectInfo(projectReq *provider.ProjectRequest) (*wo return projectInfo, nil } -func (p SampleProvider) getWorkspaceMetadata(workspaceReq *provider.WorkspaceRequest) (string, error) { +func (p AWSProvider) getWorkspaceMetadata(workspaceReq *provider.WorkspaceRequest) (string, error) { metadata := provider_types.WorkspaceMetadata{ Property: workspaceReq.Workspace.Id, } diff --git a/pkg/provider/provider_test.go b/pkg/provider/provider_test.go index 69206d3..9ecb0bf 100644 --- a/pkg/provider/provider_test.go +++ b/pkg/provider/provider_test.go @@ -8,11 +8,11 @@ import ( daytona_provider "github.com/daytonaio/daytona/pkg/provider" "github.com/daytonaio/daytona/pkg/workspace" - "github.com/daytonaio/daytona-provider-sample/pkg/provider" - provider_types "github.com/daytonaio/daytona-provider-sample/pkg/types" + "github.com/daytonaio/daytona-provider-aws/pkg/provider" + provider_types "github.com/daytonaio/daytona-provider-aws/pkg/types" ) -var sampleProvider = &provider.SampleProvider{} +var sampleProvider = &provider.AWSProvider{} var targetOptions = &provider_types.TargetOptions{ RequiredString: "default-required-string", }