Skip to content

Commit

Permalink
Merge branch 'dev' into update-cmd-device
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickMenoti committed Apr 25, 2023
2 parents 5409d16 + ebd9b2e commit 8b236eb
Show file tree
Hide file tree
Showing 17 changed files with 397 additions and 59 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Imagem base com Go 1.20
FROM golang:1.20
# Imagem base com Go 1.17
FROM golang:1.17

# Crie um diretório de trabalho dentro do container
WORKDIR /go/src/app
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/MaxwelMazur/tablecli v0.0.0-20230208145104-c9458b902b58
github.com/aziontech/azionapi-go-sdk v0.37.0
github.com/fatih/color v1.13.0
github.com/go-faker/faker/v4 v4.1.0
github.com/go-git/go-git/v5 v5.4.2
github.com/spf13/cobra v1.6.1
github.com/spf13/viper v1.14.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbS
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/go-faker/faker/v4 v4.1.0 h1:ffuWmpDrducIUOO0QSKSF5Q2dxAht+dhsT9FvVHhPEI=
github.com/go-faker/faker/v4 v4.1.0/go.mod h1:uuNc0PSRxF8nMgjGrrrU4Nw5cF30Jc6Kd0/FUTTYbhg=
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
Expand Down
7 changes: 6 additions & 1 deletion messages/device_groups/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ import (
var (
ErrorMissingApplicationIDArgument = errors.New("A mandatory flag is missing. You must provide a application-id as an argument or path to import the file. Run the command 'azioncli domains <subcommand> --help' to display more information and try again")
ErrorGetDeviceGroups = errors.New("Failed to describe the device groups: %s. Check your settings and try again. If the error persists, contact Azion support.")
ErrorListDeviceGroups = errors.New("Failed to list your rules in Rules Engine: %s. Check your settings and try again. If the error persists, contact Azion support.")
ErrorMandatoryFlags = errors.New("One or more required flags are missing. You must provide the --application-id and --group-id flags. Run the command 'azioncli rules_engine <subcommand> --help' to display more information and try again.")
ErrorFailToDelete = errors.New("Failed to delete the rule in Rules Engine: %s. Check your settings and try again. If the error persists, contact Azion support.")

ErrorMandatoryFlagsUpdate = errors.New("One or more required flags are missing. You must provide the --application-id and --group-id flags when --in flag is not sent. Run the command 'azioncli device_groups <subcommand> --help' to display more information and try again.")
ErrorUpdateDeviceGroups = errors.New("Failed to update the Device Group: %s. Check your settings and try again. If the error persists, contact Azion support")

ErrorMandatoryCreateFlags = errors.New("Required flags are missing. You must provide application-id, name, user-agent flags when the --application-id and --in flag are not provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorCreateDeviceGroups = errors.New("Failed to create the Device groups: %s. Check your settings and try again. If the error persists, contact Azion support.")
ErrorListDeviceGroups = errors.New("Failed to list your rules in Rules Engine: %s. Check your settings and try again. If the error persists, contact Azion support.")

)
16 changes: 13 additions & 3 deletions messages/device_groups/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@ var (
DeviceGroupsDeleteOutputSuccess = "Device Group %d was successfully deleted\n"
DeviceGroupsDeleteHelpFlag = "Displays more information about the delete subcommand"

//describe cmd
// describe cmd
DeviceGroupsDescribeUsage = "describe --application-id <application_id> --group-id <group_id> [flags]"
DeviceGroupsDescribeShortDescription = "Returns the information related to the Device Group"
DeviceGroupsDescribeLongDescription = "Returns the information related to the Device Group, informed through the flag '--group-id' in detail"
DeviceGroupsDescribeFlagOut = "Exports the output of the subcommand 'describe' to the given file path <file_path/file_name.ext>"
DeviceGroupsDescribeFlagFormat = "Changes the output format passing the json value to the flag. Example '--format json'"
DeviceGroupsDescribeHelpFlag = "Displays more information about the describe subcommand"
DeviceGroupsFileWritten = "File successfully written to: %s\n"

//update command

DeviceGroupsUpdateUsage = "update [flags]"
DeviceGroupsUpdateShortDescription = "Updates a device group"
DeviceGroupsUpdateLongDescription = "Updates a device group based on given attributes to be used in edge applications"
Expand All @@ -40,6 +39,17 @@ var (
DeviceGroupsUpdateFlagIn = "Path to a JSON file containing the attributes of the device group that will be created; you can use - for reading from stdin"
DeviceGroupsUpdateOutputSuccess = "Device Group %d was updated updated\n"

// [ create ]
DeviceGroupsCreateUsage = "create [flags]"
DeviceGroupsCreateShortDescription = "Creates a new device groups"
DeviceGroupsCreateLongDescription = "Creates an device groups based on given attributes to be used in edge applications"
DeviceGroupsCreateFlagEdgeApplicationId = "Unique identifier for an edge application"
DeviceGroupsCreateFlagName = "The device group name"
DeviceGroupsCreateFlagUserAgent = "the device group flag user agent"
DeviceGroupsCreateFlagIn = "Path to a JSON file containing the attributes of the device group that will be created; you can use - for reading from stdin"
DeviceGroupsCreateOutputSuccess = "Created device group with ID %d\n"
DeviceGroupsCreateHelpFlag = "Displays more information about the create subcommand"

ApplicationFlagId = "Unique identifier for the edge application that implements this Device Group. The '--application-id' flag is required"
DeviceGroupFlagId = "Unique identifier for a Device Group. The '--group-id' flag is required"
)
20 changes: 10 additions & 10 deletions messages/edge_functions_instances/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package edge_functions_instances
import "errors"

var (
ErrorGetFunctions = errors.New("failed to get the Edge Functions Instances: %s. Check your settings and try again. If the error persists, contact Azion support")
ErrorGetFunctions = errors.New("Failed to get the edge functions instances: %s. Check your settings and try again. If the error persists, contact Azion support")
ErrorMissingArgumentsDelete = errors.New("Required flags are missing. You must supply application-id and instance-id as arguments. Run 'azioncli <command> <subcommand> --help' command to display more information and try again")
ErrorFailToDeleteFuncInst = errors.New("Failed to delete the Edge Function Instance: %s. Check your settings and try again. If the error persists, contact Azion support")
ErrorMandatoryCreateFlags = errors.New("Required flags are missing. You must provide application-id, edge-function-id and name flags when the --application-id and --in flag are not provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorMandatoryListFlags = errors.New("Required flag are missing. You must provide application-id. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorCreate = errors.New("Failed to create the Edge Function Instances: %s. Check your settings and try again. If the error persists, contact Azion support.")
ErrorMandatoryFlags = errors.New("One or more required flags are missing. You must provide the --application-id and --instance-id flags. Run the command 'azioncli describe <subcommand> --help' to display more information and try again.")
ErrorGetEdgeFuncInstances = errors.New("Failed to describe the Edge Function Instance: %s. Check your settings and try again. If the error persists, contact Azion support.")
ErrorUpdateFuncInstance = errors.New("Failed to update the Edge Function Instance: %s. Check your settings and try again. If the error persists, contact Azion support.")
ErrorMandatoryUpdateFlags = errors.New("Required flags are missing. You must provide application-id, instance-id and function-id flags when the --in flag is not provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorMandatoryUpdateFlagsIn = errors.New("Required flags are missing. You must provide application-id and instance-id flags when the --in flag is provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorFailToDeleteFuncInst = errors.New("Failed to delete the edge functions instance: %s. Check your settings and try again. If the error persists, contact Azion support")
ErrorMandatoryCreateFlags = errors.New("Required flags are missing. You must provide the application-id, edge-function-id, and name flags when the --application-id and --in flag are not provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorMandatoryListFlags = errors.New("A required flag is missing. You must provide application-id. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorCreate = errors.New("Failed to create the edge functions instances: %s. Check your settings and try again. If the error persists, contact Azion support.")
ErrorMandatoryFlags = errors.New("One or more required flags are missing. You must provide the --application-id and --instance-id flags. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorGetEdgeFuncInstances = errors.New("Failed to describe the edge functions instance: %s. Check your settings and try again. If the error persists, contact Azion support.")
ErrorUpdateFuncInstance = errors.New("Failed to update the edge functions instance: %s. Check your settings and try again. If the error persists, contact Azion support.")
ErrorMandatoryUpdateFlags = errors.New("Required flags are missing. You must provide the application-id, instance-id, and function-id flags when the --in flag is not provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorMandatoryUpdateFlagsIn = errors.New("Required flags are missing. You must provide the application-id and instance-id flags when the --in flag is provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
)
65 changes: 33 additions & 32 deletions messages/edge_functions_instances/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,52 @@ package edge_functions_instances
var (
// [ EdgeFunctionsInstances ]
EdgeFunctionsInstancesUsage = "edge_functions_instances"
EdgeFunctionsInstancesShortDescription = "edge functions instances is the original source of data."
EdgeFunctionsInstancesLongDescription = "EdgeFunctionsInstances is the original source of data on edge platforms, where data is fetched when cache is not available."
EdgeFunctionsInstancesShortDescription = "Edge Functions Instances allows you to instantiate serverless functions in your edge applications at Azion."
EdgeFunctionsInstancesLongDescription = "Edge Functions Instances allows you to instantiate serverless functions in your edge applications at Azion, as well as set up conditions for their execution."
EdgeFunctionsInstancesFlagHelp = "Displays more information about the edge functions instances command"

// [ list ]
EdgeFunctionsInstancesListUsage = "list [flags]"
EdgeFunctionsInstancesListShortDescription = "Displays your edge functions instances"
EdgeFunctionsInstancesListLongDescription = "Displays all edge functions instances related to your applications"
EdgeFunctionsInstancesListShortDescription = "Displays your edge functions instances."
EdgeFunctionsInstancesListLongDescription = "Displays all edge functions instances related to a specific edge application."
EdgeFunctionsInstancesListHelpFlag = "Displays more information about the list subcommand"
EdgeFunctionsInstancesListFlagEdgeApplicationID = "Unique identifier for an edge application."

// [ flags ]
EdgeApplicationFlagId = "Unique identifier of the Edge Application"
EdgeFunctionsInstancesFlagId = "Unique identifier of the Edge Functions Instances"
EdgeApplicationFlagId = "Unique identifier for an edge application"
EdgeFunctionsInstancesFlagId = "Unique identifier for an edge functions instance"

//Edge Functions Instances cmd
EdgeFuncInstanceUsage = "edge_functions_instances"
EdgeFuncInstanceShortDescription = "Create Edge Functions Instances for edges on Azion's platform"
EdgeFuncInstanceLongDescription = "Create Edge Functions Instances for edges on Azion's platform"
EdgeFuncInstanceFlagHelp = "Displays more information about the edge_functions_instances command"
EdgeFuncInstanceFlagId = "Unique identifier of the Edge Function Instance"
ApplicationFlagId = "Unique identifier for an edge application used by this domain.. The '--application-id' flag is mandatory"
EdgeFuncInstanceShortDescription = "Edge Functions Instances allows you to instantiate serverless functions in your edge applications at Azion."
EdgeFuncInstanceLongDescription = "Edge Functions Instances allows you to instantiate serverless functions in your edge applications at Azion, as well as set up conditions for their execution."
EdgeFuncInstanceFlagHelp = "Displays more information about the edge functions instances command"
EdgeFuncInstanceFlagId = "Unique identifier for an edge functions instance"
ApplicationFlagId = "Unique identifier for the edge application related to an edge functions instance. The '--application-id' flag is required"

//delete cmd
EdgeFuncInstanceDeleteUsage = "delete --application-id <application_id> --function-id <function_id> [flags]"
EdgeFuncInstanceDeleteShortDescription = "Removes an Edge Function Instance"
EdgeFuncInstanceDeleteLongDescription = "Removes an Edge Function Instance from the Domains library based on its given ID"
EdgeFuncInstanceDeleteOutputSuccess = "Edge Function Instance %s was successfully deleted\n"
EdgeFuncInstanceDeleteUsage = "delete --application-id <application_id> --instance-id <instance-id>"
EdgeFuncInstanceDeleteShortDescription = "Removes an edge functions instance"
EdgeFuncInstanceDeleteLongDescription = "Removes an edge functions instance, instantiated in a specific edge application, based on the given flags."
EdgeFuncInstanceDeleteOutputSuccess = "Edge functions instance %s was successfully deleted\n"
EdgeFuncInstanceDeleteHelpFlag = "Displays more information about the delete subcommand"

// [ create ]
EdgeFuncInstanceCreateUsage = "create [flags]"
EdgeFuncInstanceCreateShortDescription = "Creates a new Function Instances"
EdgeFuncInstanceCreateLongDescription = "Creates an Function Instances based on given attributes to be used in edge applications"
EdgeFuncInstanceCreateShortDescription = "Creates a new edge functions instance"
EdgeFuncInstanceCreateLongDescription = "Creates a new edge functions instance based on given attributes to be used in an edge application"
EdgeFuncInstanceCreateFlagEdgeApplicationId = "Unique identifier for an edge application"
EdgeFuncInstanceCreateFlagEdgeFunctionID = "Unique identifier for an Edge Function Instances"
EdgeFuncInstanceCreateFlagName = "The Function Instances name"
EdgeFuncInstanceCreateFlagArgs = "The args name"
EdgeFuncInstanceCreateFlagIn = "Path to a JSON file containing the attributes of the origin that will be created; you can use - for reading from stdin"
EdgeFuncInstanceCreateFlagEdgeFunctionID = "Unique identifier for an edge functions instance"
EdgeFuncInstanceCreateFlagName = "The edge functions instance name"
EdgeFuncInstanceCreateFlagArgs = "The JSON args related to the edge functions instance being created"
EdgeFuncInstanceCreateFlagIn = "Path to a JSON file containing the attributes of the edge functions instance being created; you can use - for reading from stdin"
EdgeFuncInstanceCreateOutputSuccess = "Created Function Instances with ID %d\n"
EdgeFuncInstanceCreateHelpFlag = "Displays more information about the create subcommand"

//describe cmd
EdgeFuncInstanceDescribeUsage = "describe --application-id <application_id> --instance-id <instance_id> [flags]"
EdgeFuncInstanceDescribeShortDescription = "Returns the information related to the Edge Function Instance"
EdgeFuncInstanceDescribeLongDescription = "Returns the information related to the Edge Function Instance, informed through the flag '--instance-id' in detail"
EdgeFuncInstanceDescribeShortDescription = "Returns the information related to the edge functions instance"
EdgeFuncInstanceDescribeLongDescription = "Returns the information related to the edge functions instance, informed through the flag '--instance-id' in detail"
EdgeFuncInstanceDescribeFlagOut = "Exports the output of the subcommand 'describe' to the given file path <file_path/file_name.ext>"
EdgeFuncInstanceDescribeFlagFormat = "Changes the output format passing the json value to the flag. Example '--format json'"
EdgeFuncInstanceDescribeHelpFlag = "Displays more information about the describe subcommand"
Expand All @@ -56,14 +57,14 @@ var (

// [ Update ]
EdgeFuncInstanceUpdateUsage = "update --application-id <application_id> --instance-id <instance_id> [flags]"
EdgeFuncInstanceUpdateShortDescription = "Updates an edge function instance"
EdgeFuncInstanceUpdateLongDescription = "Updates an edge function instance based on given attributes to be used in edge applications"
EdgeFuncInstanceUpdateShortDescription = "Updates an edge functions instance"
EdgeFuncInstanceUpdateLongDescription = "Updates an edge functions instance, based on given attributes, to be used in edge applications"
EdgeFuncInstanceUpdateFlagEdgeApplicationId = "Unique identifier for an edge application"
EdgeFuncInstanceUpdateFlagIn = "Path to a JSON file containing the attributes of the rule that will be updated; you can use - for reading from stdin"
EdgeFuncInstanceUpdateFlagName = "Edge Function Instance name"
EdgeFuncInstanceUpdateFlagArgs = "Edge Function Instance args"
EdgeFuncInstanceUpdateFlagInstanceID = "Unique identifier for an edge function instance"
EdgeFuncInstanceUpdateFlagFunctionID = "Edge Function ID to be used in the Edge Function Instance"
EdgeFuncInstanceUpdateOutputSuccess = "Updated edge function instance with ID %d\n"
EdgeFuncInstanceUpdateFlagIn = "Path to a JSON file containing the attributes of the edge functions instance that will be updated; you can use - for reading from stdin"
EdgeFuncInstanceUpdateFlagName = "The edge functions instance name"
EdgeFuncInstanceUpdateFlagArgs = "The JSON args related to the edge functions instance being updated"
EdgeFuncInstanceUpdateFlagInstanceID = "Unique identifier for an edge functions instance"
EdgeFuncInstanceUpdateFlagFunctionID = "Edge function ID to be used in the edge functions instance"
EdgeFuncInstanceUpdateOutputSuccess = "Updated edge functions instance with ID %d\n"
EdgeFuncInstanceUpdateHelpFlag = "Displays more information about the update subcommand"
)
)
Loading

0 comments on commit 8b236eb

Please sign in to comment.