diff --git a/cmd/check/main.go b/cmd/check/main.go index 634f40a..bf74040 100644 --- a/cmd/check/main.go +++ b/cmd/check/main.go @@ -10,7 +10,6 @@ type ( version struct { Ref string `json:"ref"` } - // InputJSON ... InputJSON struct { Params map[string]string `json:"params"` Source map[string]string `json:"source"` diff --git a/cmd/in/main.go b/cmd/in/main.go index 634f40a..bf74040 100644 --- a/cmd/in/main.go +++ b/cmd/in/main.go @@ -10,7 +10,6 @@ type ( version struct { Ref string `json:"ref"` } - // InputJSON ... InputJSON struct { Params map[string]string `json:"params"` Source map[string]string `json:"source"` diff --git a/cmd/out/main.go b/cmd/out/main.go index 1035f86..1429d99 100644 --- a/cmd/out/main.go +++ b/cmd/out/main.go @@ -8,13 +8,11 @@ import ( "github.com/telia-oss/appsync-resource/out" ) -// createOutput ... func createOutput(output interface{}, encoder *json.Encoder, logger *log.Logger) error { _, err := json.MarshalIndent(output, "", " ") if err != nil { return err } - // encode output to stdout return encoder.Encode(output) } diff --git a/out/out.go b/out/out.go index 5fca141..f021846 100644 --- a/out/out.go +++ b/out/out.go @@ -14,8 +14,6 @@ var env = os.Getenv("ENV") // Command will update the resource. func Command(input InputJSON, logger *log.Logger) (outOutputJSON, error) { - - // PARSE THE JSON FILE input.json apiID, ok := input.Source["api_id"] if !ok { return outOutputJSON{}, errors.New("api_id not set") @@ -50,7 +48,6 @@ func Command(input InputJSON, logger *log.Logger) (outOutputJSON, error) { var resolverOutput []metadata var schemaOutput []metadata - // AWS creds awsConfig := resource.NewAwsConfig( accessKey, secretKey, @@ -64,7 +61,6 @@ func Command(input InputJSON, logger *log.Logger) (outOutputJSON, error) { return outOutputJSON{}, errors.New("resolversFile and schemaFile both are not set") } - // Create or update schema if schemaFile != "" { var schemaFilePath string if env == "development" { @@ -75,13 +71,11 @@ func Command(input InputJSON, logger *log.Logger) (outOutputJSON, error) { } schema, _ := ioutil.ReadFile(schemaFilePath) - // Start create or update schema error := client.StartSchemaCreationOrUpdate(apiID, schema) if error != nil { logger.Fatalf("failed to create/update the schema: %s", error) } - // get schema creation status creationStatus, creationDetails, err := client.GetSchemaCreationStatus(apiID) if err != nil { logger.Println("Failed to get Schema Creation status, However the Schema creation might be succeeded, check the AWS console and re-tigger the build if the schema not created/updated: %s", err) @@ -90,14 +84,12 @@ func Command(input InputJSON, logger *log.Logger) (outOutputJSON, error) { {Name: "creationDetails", Value: "unknown"}, } } else { - // OUTPUT schemaOutput = []metadata{ {Name: "creationStatus", Value: creationStatus}, {Name: "creationDetails", Value: creationDetails}, } } } - // update Resolvers if resolversFile != "" { var resolversFilePath string if env == "development" { @@ -112,7 +104,6 @@ func Command(input InputJSON, logger *log.Logger) (outOutputJSON, error) { if err != nil { logger.Println("failed to create/update", err) } - // OUTPUT resolverOutput = []metadata{ {Name: "number of resolvers successfully created", Value: nResolversSuccessfullyCreated}, {Name: "number of resolver successfully updated", Value: nResolversSuccessfullyUpdated},