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

feat: improved secret imports return types #1232

Closed

Conversation

Pierre-Green
Copy link

Description 📣

Fixes #1231

Improved secret imports crud return types for POST, PUT and DELETE.

  1. Get existing imports
    image
  2. Create new import
    image
  3. Updates imports
    image
  4. Delete import
    image

Type ✨

  • Bug fix
  • New feature
  • Breaking change
  • Documentation

Tests 🛠️

Preparation

  • Create a workspace and retrieve its id (we gonna say it's someWorkspaceId)
  • Make sure you have an environment with dev slug
  • Create a random secret in root directory
  • Create a directory hey with a random secret inside
  • Create a directory with path /foo/bar

POST | CREATE

cURL request:

curl --request POST \
  --url http://localhost:8080/api/v1/secret-imports/ \
  --header 'Content-Type: application/json' \
  --data '{
  "directory": "/foo/bar",
  "environment": "dev",
  "secretImport": {
    "environment": "dev",
    "secretPath": "/"
  },
  "workspaceId": "someWorkspaceId"
}'

cURL exemple response:

{
  "secretImport": {
	"workspace": "someWorkspaceId",
	"environment": "dev",
	"folderId": "wRlt56kR7nmv", // ID OF THE /foo/bar
	"imports": [
		{
			"environment": "dev",
			"secretPath": "/",
			"_id": "6577aed23a1e1e42c87c2ae4"
		}
	],
	"_id": "6577aa163a1e1e42c87c2923", // KEEP THIS ID
        ...
  }
}

PUT | UPDATE

cURL exemple request

curl --request PUT \
  --url http://localhost:8080/api/v1/secret-imports/6577aa163a1e1e42c87c2923 \
  --header 'Content-Type: application/json' \
  --data '{
  "secretImports": [
	{
	    "environment": "dev",
    	    "secretPath": "/hey"
	}
    ]
  }'

cURL exemple response:

{
	"secretImport": {
		"_id": "6577aa163a1e1e42c87c2923",
		"workspace": "someWorkspaceId",
		"environment": "dev",
		"folderId": "wRlt56kR7nmv",
		"imports": [
			{
				"environment": "dev",
				"secretPath": "/hey",
				"_id": "6577af163a1e1e42c87c2d95"
			}
		],
                ...
	}
}

DELETE | REMOVE

cURL exemple request

curl --request PUT \
  --url http://localhost:8080/api/v1/secret-imports/6577aa163a1e1e42c87c2923 \
  --header 'Content-Type: application/json' \
  --data '{
      {
	  "secretImportEnv": "dev",
	  "secretImportPath": "/hey"
       }
  }'

cURL exemple response:

{
	"secretImport": {
		"_id": "6577aa163a1e1e42c87c2923",
		"workspace": "someWorkspaceId",
		"environment": "dev",
		"folderId": "wRlt56kR7nmv",
		"imports": [],
                ...
	}
}

@maidul98
Copy link
Collaborator

This PR is now stale. The backend structure has changed completely due to Postgres migration

@maidul98 maidul98 closed this Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENG-337] improve secret imports CRUD resource
2 participants