-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for skipping workflows & pipelines (#9)
- Loading branch information
1 parent
fd2fdda
commit 9f8a197
Showing
6 changed files
with
106 additions
and
51 deletions.
There are no files selected for viewing
This file contains 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,44 @@ | ||
package main | ||
|
||
import ( | ||
"bytes" | ||
"encoding/json" | ||
"errors" | ||
log "github.com/sirupsen/logrus" | ||
"io" | ||
"net/http" | ||
"strconv" | ||
) | ||
|
||
func Post(reqUrl string, auth string, body interface{}) ([]byte, error) { | ||
postBody, _ := json.Marshal(body) | ||
requestBody := bytes.NewBuffer(postBody) | ||
log.WithFields(log.Fields{ | ||
"body": string(postBody), | ||
}).Debug("The request body") | ||
req, err := http.NewRequest("POST", reqUrl, requestBody) | ||
if err != nil { | ||
return nil, err | ||
} | ||
req.Header.Set("Content-Type", "application/json") | ||
req.Header.Set("x-api-key", auth) | ||
client := &http.Client{} | ||
resp, err := client.Do(req) | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer func(Body io.ReadCloser) { | ||
_ = Body.Close() | ||
}(resp.Body) | ||
respBody, err := io.ReadAll(resp.Body) | ||
if err != nil { | ||
return nil, err | ||
} | ||
log.WithFields(log.Fields{ | ||
"body": string(respBody), | ||
}).Debug("The response body") | ||
if resp.StatusCode != 200 { | ||
return nil, errors.New("received non 200 response code. The response code was " + strconv.Itoa(resp.StatusCode)) | ||
} | ||
return respBody, nil | ||
} |
This file contains 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 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 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 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,21 @@ | ||
package main | ||
|
||
import "github.com/urfave/cli/v2" | ||
|
||
func getAccountSummary(*cli.Context) error { | ||
_ = PromptDefaultInputs() | ||
logMigrationDetails() | ||
|
||
_ = GetUrl(migrationReq.Environment, MIGRATOR, "save/v2", migrationReq.Account) | ||
return nil | ||
} | ||
|
||
func getAppSummary(*cli.Context) error { | ||
_ = PromptDefaultInputs() | ||
if len(migrationReq.AppId) == 0 { | ||
migrationReq.AppId = TextInput("Please provide the application ID - ") | ||
} | ||
|
||
_ = GetUrl(migrationReq.Environment, MIGRATOR, "save/v2", migrationReq.Account) | ||
return nil | ||
} |
This file contains 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