Skip to content

Commit

Permalink
Use stable routes for deployment settings (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
komalali authored Nov 18, 2023
1 parent 6c88d5c commit e926aff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions provider/pkg/internal/pulumiapi/deployment_setting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestGetDeploymentSettings(t *testing.T) {

c, cleanup := startTestServer(t, testServerConfig{
ExpectedReqMethod: http.MethodGet,
ExpectedReqPath: "/" + path.Join("api", "preview", orgName, projectName, stackName, "deployment", "settings"),
ExpectedReqPath: "/" + path.Join("api", "stacks", orgName, projectName, stackName, "deployments", "settings"),
ResponseCode: 200,
ResponseBody: dsValue,
})
Expand All @@ -44,7 +44,7 @@ func TestGetDeploymentSettings(t *testing.T) {
t.Run("404", func(t *testing.T) {
c, cleanup := startTestServer(t, testServerConfig{
ExpectedReqMethod: http.MethodGet,
ExpectedReqPath: "/" + path.Join("api", "preview", orgName, projectName, stackName, "deployment", "settings"),
ExpectedReqPath: "/" + path.Join("api", "stacks", orgName, projectName, stackName, "deployments", "settings"),
ResponseCode: 404,
ResponseBody: errorResponse{
StatusCode: 404,
Expand Down Expand Up @@ -80,7 +80,7 @@ func TestCreateDeploymentSettings(t *testing.T) {

c, cleanup := startTestServer(t, testServerConfig{
ExpectedReqMethod: http.MethodPost,
ExpectedReqPath: "/" + path.Join("api", "preview", orgName, projectName, stackName, "deployment", "settings"),
ExpectedReqPath: "/" + path.Join("api", "stacks", orgName, projectName, stackName, "deployments", "settings"),
ResponseCode: 201,
ExpectedReqBody: dsValue,
})
Expand Down
6 changes: 3 additions & 3 deletions provider/pkg/internal/pulumiapi/deployment_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type GitHubConfiguration struct {
}

func (c *Client) CreateDeploymentSettings(ctx context.Context, stack StackName, ds DeploymentSettings) error {
apiPath := path.Join("preview", stack.OrgName, stack.ProjectName, stack.StackName, "deployment", "settings")
apiPath := path.Join("stacks", stack.OrgName, stack.ProjectName, stack.StackName, "deployments", "settings")
_, err := c.do(ctx, http.MethodPost, apiPath, ds, nil)
if err != nil {
return fmt.Errorf("failed to create deployment settings for stack (%s): %w", stack.String(), err)
Expand All @@ -82,7 +82,7 @@ func (c *Client) CreateDeploymentSettings(ctx context.Context, stack StackName,

func (c *Client) GetDeploymentSettings(ctx context.Context, stack StackName) (*DeploymentSettings, error) {
apiPath := path.Join(
"preview", stack.OrgName, stack.ProjectName, stack.StackName, "deployment", "settings",
"stacks", stack.OrgName, stack.ProjectName, stack.StackName, "deployments", "settings",
)
var ds DeploymentSettings
_, err := c.do(ctx, http.MethodGet, apiPath, nil, &ds)
Expand All @@ -99,7 +99,7 @@ func (c *Client) GetDeploymentSettings(ctx context.Context, stack StackName) (*D

func (c *Client) DeleteDeploymentSettings(ctx context.Context, stack StackName) error {
apiPath := path.Join(
"preview", stack.OrgName, stack.ProjectName, stack.StackName, "deployment", "settings",
"stacks", stack.OrgName, stack.ProjectName, stack.StackName, "deployments", "settings",
)
_, err := c.do(ctx, http.MethodDelete, apiPath, nil, nil)
if err != nil {
Expand Down

0 comments on commit e926aff

Please sign in to comment.