diff --git a/.changelog/000.txt b/.changelog/0.txt similarity index 100% rename from .changelog/000.txt rename to .changelog/0.txt diff --git a/.changelog/3.txt b/.changelog/3.txt new file mode 100644 index 0000000..9ac498b --- /dev/null +++ b/.changelog/3.txt @@ -0,0 +1,19 @@ +```release-note:feature +`publicip` - Add List, Create, Delete operations for publicip. +``` + +```release-note:feature +`s3` - Add List, Create, Delete operations for s3. +``` + +```release-note:feature +`vdc` - Add List, Create, Delete operations for vdc. +``` + +```release-note:feature +`edgegateway` - Add List, Create, Delete operations for edgegateway. +``` + +```release-note:dependency +deps: bumps orange-cloudavenue/cloudavenue-sdk-go from 0.5.5 to 0.5.6 +``` \ No newline at end of file diff --git a/cmd/edgegateway.go b/cmd/edgegateway.go index 40bb0bf..edafa8c 100644 --- a/cmd/edgegateway.go +++ b/cmd/edgegateway.go @@ -5,7 +5,6 @@ package cmd import ( "fmt" - "log" jsontmpl "github.com/orange-cloudavenue/cloudavenue-cli/pkg/templates/json" "github.com/spf13/cobra" @@ -34,11 +33,11 @@ func init() { gwCreateCmd.PersistentFlags().String("vdc", "", "vdc name") gwCreateCmd.PersistentFlags().String("t0", "", "t0 name") if err := gwCreateCmd.MarkPersistentFlagRequired("vdc"); err != nil { - log.Default().Println("Error from Flag VDC, is require.", err) + fmt.Println("Error from Flag VDC, is require.", err) return } if err := gwCreateCmd.MarkPersistentFlagRequired("t0"); err != nil { - log.Default().Println("Error from Flag T0, is require.", err) + fmt.Println("Error from Flag T0, is require.", err) return } } @@ -51,7 +50,7 @@ var gwListCmd = &cobra.Command{ edgeGateways, err := c.V1.EdgeGateway.List() if err != nil { - log.Default().Println("Error from EdgeGateway", err) + fmt.Println("Error from EdgeGateway", err) } jsontmpl.Format(jsontmpl.JsonTemplate{ @@ -76,22 +75,22 @@ var gwDelCmd = &cobra.Command{ if err != nil { gw, err = c.V1.EdgeGateway.GetByID(arg) if err != nil { - log.Default().Println("Unable to find EdgeGateway ID or Name", err) + fmt.Println("Unable to find EdgeGateway ID or Name", err) return } } job, err := gw.Delete() if err != nil { - log.Default().Println("Unable to delete EdgeGateway", err) + fmt.Println("Unable to delete EdgeGateway", err) return } err = job.Wait(15, 300) if err != nil { - log.Default().Println("Error during EdgeGateway Deletion !!", err) + fmt.Println("Error during EdgeGateway Deletion !!", err) return } - fmt.Println("EdgeGateway resource deleted " + arg + " successfully !!\n") - fmt.Println("EdgeGateway resource list after deletion:") + fmt.Println("EdgeGateway resource deleted " + arg + " successfully !!") + fmt.Println("\nEdgeGateway resource list after deletion:") gwListCmd.Run(cmd, []string{}) } @@ -109,14 +108,14 @@ var gwCreateCmd = &cobra.Command{ // Get the vdc name from the command line vdc, err := cmd.Flags().GetString("vdc") if err != nil { - log.Default().Println("Error from VDC", err) + fmt.Println("Error from VDC", err) return } // Get the t0 name from the command line t0, err := cmd.Flags().GetString("t0") if err != nil { - log.Default().Println("Error from T0", err) + fmt.Println("Error from T0", err) return } @@ -126,12 +125,12 @@ var gwCreateCmd = &cobra.Command{ fmt.Println("t0 name: " + t0) job, err := c.V1.EdgeGateway.New(vdc, t0) if err != nil { - log.Default().Println("Error from EdgeGateway", err) + fmt.Println("Error from EdgeGateway", err) return } err = job.Wait(15, 300) if err != nil { - log.Default().Println("Error during EdgeGateway Creation !!", err) + fmt.Println("Error during EdgeGateway Creation !!", err) return } fmt.Println("EdgeGateway resource created successfully !") diff --git a/cmd/publicip.go b/cmd/publicip.go index ec9fafb..d096928 100644 --- a/cmd/publicip.go +++ b/cmd/publicip.go @@ -5,7 +5,6 @@ package cmd import ( "fmt" - "log" jsontmpl "github.com/orange-cloudavenue/cloudavenue-cli/pkg/templates/json" "github.com/spf13/cobra" @@ -31,9 +30,9 @@ func init() { // ? Create command publicipCmd.AddCommand(publicipCreateCmd) - publicipCreateCmd.PersistentFlags().String("name", "", "vdc name") + publicipCreateCmd.PersistentFlags().String("name", "", "edge gateway name") if err := publicipCreateCmd.MarkPersistentFlagRequired("name"); err != nil { - log.Default().Println("Error from Flag name, is require.", err) + fmt.Println("Error from Flag name, is require.", err) return } } @@ -47,7 +46,7 @@ var publicipListCmd = &cobra.Command{ // Get the list of vdc ips, err := c.V1.PublicIP.GetIPs() if err != nil { - log.Default().Println("Error from IP List", err) + fmt.Println("Error from IP List", err) return } @@ -80,7 +79,7 @@ var publicipListCmd = &cobra.Command{ // deleteCmd represents the delete command var publicipDelCmd = &cobra.Command{ Use: "delete", - Example: "publicip delete [] [] ...", + Example: "publicip delete [] [] ...", Short: "Delete publicip resource(s)", Run: func(cmd *cobra.Command, args []string) { @@ -89,21 +88,21 @@ var publicipDelCmd = &cobra.Command{ fmt.Println("delete publicip resource " + arg) ip, err := c.V1.PublicIP.GetIP(arg) if err != nil { - log.Default().Println("Error from ip", err) + fmt.Println("Error from ip: ", err) return } job, err := ip.Delete() if err != nil { - log.Default().Println("Unable to delete ip", err) + fmt.Println("Unable to delete ip: ", err) return } err = job.Wait(15, 300) if err != nil { - log.Default().Println("Error during ip Deletion !!", err) + fmt.Println("Error during ip Deletion !!", err) return } - fmt.Println("ip resource deleted " + arg + " successfully !!\n") - fmt.Println("ip resource list after deletion:") + fmt.Println("ip resource deleted " + arg + " successfully !!") + fmt.Println("\nip resource list after deletion:") publicipListCmd.Run(cmd, []string{}) } @@ -121,49 +120,26 @@ var publicipCreateCmd = &cobra.Command{ // Get the name from the command line gwName, err := cmd.Flags().GetString("name") if err != nil { - log.Default().Println("Malformed EdgeGateway Name ", err) + fmt.Println("Malformed argument EdgeGateway Name ", err) return } - // // Get EdgeGateway from name - // gw, err := c.V1.EdgeGateway.GetByName(gwName) - // if err != nil { - // log.Default().Println("EdgeGateway not found", err) - // return - // } - - // Create the vdc + // Create a public ip fmt.Println("create public ip resource") fmt.Println("for EdgeGateway name: " + gwName) - // c.V1.EdgeGateway. - - // _, err = c.V1.VDC.New(&v1.CAVVirtualDataCenter{Vdc: v1.CAVVirtualDataCenterVDC{ - // Name: vdcName, - // ServiceClass: "STD", - // BillingModel: "PAYG", - // CPUAllocated: 22000, - // VcpuInMhz2: 2200, - // Description: "vdc created by cloudavenue-cli", - // MemoryAllocated: 30, - // DisponibilityClass: "ONE-ROOM", - // StorageBillingModel: "PAYG", - // StorageProfiles: []v1.VDCStrorageProfile{ - // v1.VDCStrorageProfile{ //nolint - // Class: "gold", - // Limit: 500, - // Default: true, - // }, - // }, - // }}) - + job, err := c.V1.PublicIP.New(gwName) if err != nil { - log.Default().Println("Error from vdc", err) + fmt.Println("Unable to create public ip", err) return } - - fmt.Println("vdc resource created successfully !") - fmt.Println("\nvdc resource list after creation:") + err = job.Wait(5, 300) + if err != nil { + fmt.Println("Error during public ip creation !!", err) + return + } + fmt.Println("public ip resource created successfully !") + fmt.Println("\npublic ip resource list after creation:") publicipListCmd.Run(cmd, []string{}) }, diff --git a/cmd/s3.go b/cmd/s3.go index 6271d11..8d6ffd9 100644 --- a/cmd/s3.go +++ b/cmd/s3.go @@ -5,7 +5,6 @@ package cmd import ( "fmt" - "log" "github.com/aws/aws-sdk-go/service/s3" jsontmpl "github.com/orange-cloudavenue/cloudavenue-cli/pkg/templates/json" @@ -35,7 +34,7 @@ func init() { s3Cmd.AddCommand(s3CreateCmd) s3CreateCmd.PersistentFlags().String("name", "", "s3 bucket name") if err := s3CreateCmd.MarkPersistentFlagRequired("name"); err != nil { - log.Default().Println("Error from Flag name, is require.", err) + fmt.Println("Error from Flag name, is require.", err) return } } @@ -52,7 +51,7 @@ var s3ListCmd = &cobra.Command{ // Get the list of buckets output, err := s3Client.ListBuckets(&s3.ListBucketsInput{}) if err != nil { - log.Default().Println("Error from S3 List", err) + fmt.Println("Error from S3 List", err) return } @@ -96,11 +95,11 @@ var s3DelCmd = &cobra.Command{ // Del the bucket _, err := s3Client.DeleteBucket(&s3.DeleteBucketInput{Bucket: &args[i]}) if err != nil { - log.Default().Println("Error from S3 Delete", err) + fmt.Println("Error from S3 Delete", err) return } - fmt.Println("Bucket resource deleted " + arg + " successfully !!\n") - fmt.Println("Bucket resource list after deletion:") + fmt.Println("Bucket resource deleted " + arg + " successfully !!") + fmt.Println("\nBucket resource list after deletion:") } s3ListCmd.Run(cmd, []string{}) @@ -120,7 +119,7 @@ var s3CreateCmd = &cobra.Command{ bucketName, err := cmd.Flags().GetString("name") if err != nil { - log.Default().Println("Unknow bucket name ", err) + fmt.Println("Malformed bucket name ", err) return } @@ -130,7 +129,7 @@ var s3CreateCmd = &cobra.Command{ _, err = s3Client.CreateBucket(&s3.CreateBucketInput{Bucket: &bucketName}) if err != nil { - log.Default().Println("Error from S3 Create", err) + fmt.Println("Error from S3 Create", err) return } diff --git a/cmd/vdc.go b/cmd/vdc.go index 149e483..1f61920 100644 --- a/cmd/vdc.go +++ b/cmd/vdc.go @@ -5,7 +5,6 @@ package cmd import ( "fmt" - "log" jsontmpl "github.com/orange-cloudavenue/cloudavenue-cli/pkg/templates/json" v1 "github.com/orange-cloudavenue/cloudavenue-sdk-go/v1" @@ -34,7 +33,7 @@ func init() { vdcCmd.AddCommand(vdcCreateCmd) vdcCreateCmd.PersistentFlags().String("name", "", "vdc name") if err := vdcCreateCmd.MarkPersistentFlagRequired("name"); err != nil { - log.Default().Println("Error from Flag name, is require.", err) + fmt.Println("Error from Flag name, is require.", err) return } } @@ -48,7 +47,7 @@ var vdcListCmd = &cobra.Command{ // Get the list of vdc vdcs, err := c.V1.VDC.List() if err != nil { - log.Default().Println("Error from VDC List", err) + fmt.Println("Error from VDC List", err) return } @@ -96,21 +95,21 @@ var vdcDelCmd = &cobra.Command{ fmt.Println("delete vdc resource " + arg) vdc, err := c.V1.VDC.Get(arg) if err != nil { - log.Default().Println("Error from vdc", err) + fmt.Println("Error from vdc", err) return } job, err := vdc.Delete() if err != nil { - log.Default().Println("Unable to delete vdc", err) + fmt.Println("Unable to delete vdc", err) return } err = job.Wait(15, 300) if err != nil { - log.Default().Println("Error during vdc Deletion !!", err) + fmt.Println("Error during vdc Deletion !!", err) return } - fmt.Println("vdc resource deleted " + arg + " successfully !!\n") - fmt.Println("vdc resource list after deletion:") + fmt.Println("vdc resource deleted " + arg + " successfully !!") + fmt.Println("\nvdc resource list after deletion:") vdcListCmd.Run(cmd, []string{}) } @@ -128,7 +127,7 @@ var vdcCreateCmd = &cobra.Command{ // Get the vdc name from the command line vdcName, err := cmd.Flags().GetString("vdc") if err != nil { - log.Default().Println("Malformed VDC name", err) + fmt.Println("Malformed VDC name", err) return } @@ -156,7 +155,7 @@ var vdcCreateCmd = &cobra.Command{ }}) if err != nil { - log.Default().Println("Error from vdc", err) + fmt.Println("Error from vdc", err) return } diff --git a/go.mod b/go.mod index b62f6f1..0a0a0f6 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21.3 require ( github.com/aws/aws-sdk-go v1.47.9 github.com/fbiville/markdown-table-formatter v0.3.0 - github.com/orange-cloudavenue/cloudavenue-sdk-go v0.5.5 + github.com/orange-cloudavenue/cloudavenue-sdk-go v0.5.6 github.com/spf13/cobra v1.8.0 ) diff --git a/go.sum b/go.sum index ff4f601..23ab43b 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,8 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/orange-cloudavenue/cloudavenue-sdk-go v0.5.5 h1:/GzeWP+RPyiRBNsvnswq1HfMDWu12Ta1l5fnrRG/AMU= -github.com/orange-cloudavenue/cloudavenue-sdk-go v0.5.5/go.mod h1:cWQdAHu+UlpulY0Vv4i+yPG17PUp8ZhK06VOR5Oq8iM= +github.com/orange-cloudavenue/cloudavenue-sdk-go v0.5.6 h1:S2miIutUXVRB4UTY0zOXa3xZujKLtOqLUCAOYzweoDw= +github.com/orange-cloudavenue/cloudavenue-sdk-go v0.5.6/go.mod h1:cWQdAHu+UlpulY0Vv4i+yPG17PUp8ZhK06VOR5Oq8iM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/release-ci b/release-ci index ec11fde..d23903b 160000 --- a/release-ci +++ b/release-ci @@ -1 +1 @@ -Subproject commit ec11fdea8b52e5aa2f980b59fa29db51c001ae0e +Subproject commit d23903b2681fbebe57c3e410c43a8ccca2884c76