From 90d3a11df38333d44ac53b4ae30b893627931d6a Mon Sep 17 00:00:00 2001 From: digna-ionos Date: Mon, 11 Nov 2024 13:50:37 +0200 Subject: [PATCH] add kafka cluster resource operations --- commands/kafka/cluster/cluster.go | 34 + commands/kafka/cluster/create.go | 139 +++ commands/kafka/cluster/delete.go | 95 ++ commands/kafka/cluster/get.go | 76 ++ commands/kafka/cluster/list.go | 104 +++ commands/kafka/completer/completer.go | 38 + commands/kafka/kafka.go | 19 + commands/root.go | 4 + docs/subcommands/Kafka/cluster/create.md | 58 ++ docs/subcommands/Kafka/cluster/delete.md | 54 ++ docs/subcommands/Kafka/cluster/get.md | 53 ++ docs/subcommands/Kafka/cluster/list.md | 54 ++ docs/summary.md | 6 + go.mod | 1 + go.sum | 2 + internal/client/model.go | 6 + internal/constants/constants.go | 6 + internal/core/doc/doc.go | 1 + .../printer/json2table/jsonpaths/kafka.go | 12 + .../ionos-cloud/sdk-go-kafka/.gitbook.yaml | 4 + .../ionos-cloud/sdk-go-kafka/.gitignore | 24 + .../ionos-cloud/sdk-go-kafka/.travis.yml | 8 + .../ionos-cloud/sdk-go-kafka/LICENSE | 201 +++++ .../ionos-cloud/sdk-go-kafka/README.md | 148 ++++ .../ionos-cloud/sdk-go-kafka/api_clusters.go | 788 +++++++++++++++++ .../ionos-cloud/sdk-go-kafka/api_topics.go | 823 ++++++++++++++++++ .../ionos-cloud/sdk-go-kafka/api_users.go | 399 +++++++++ .../ionos-cloud/sdk-go-kafka/client.go | 749 ++++++++++++++++ .../ionos-cloud/sdk-go-kafka/configuration.go | 328 +++++++ .../ionos-cloud/sdk-go-kafka/logger.go | 81 ++ .../ionos-cloud/sdk-go-kafka/model_cluster.go | 259 ++++++ .../sdk-go-kafka/model_cluster_create.go | 168 ++++ .../sdk-go-kafka/model_cluster_metadata.go | 536 ++++++++++++ .../model_cluster_metadata_all_of.go | 123 +++ .../sdk-go-kafka/model_cluster_read.go | 303 +++++++ .../sdk-go-kafka/model_cluster_read_list.go | 259 ++++++ .../model_cluster_read_list_all_of.go | 259 ++++++ .../ionos-cloud/sdk-go-kafka/model_error.go | 167 ++++ .../sdk-go-kafka/model_error_messages.go | 167 ++++ .../model_kafka_cluster_connection.go | 215 +++++ .../ionos-cloud/sdk-go-kafka/model_links.go | 211 +++++ .../sdk-go-kafka/model_metadata.go | 402 +++++++++ .../sdk-go-kafka/model_pagination.go | 214 +++++ .../sdk-go-kafka/model_resource_metadata.go | 492 +++++++++++ .../sdk-go-kafka/model_resource_state.go | 169 ++++ .../ionos-cloud/sdk-go-kafka/model_topic.go | 264 ++++++ .../sdk-go-kafka/model_topic_create.go | 168 ++++ .../sdk-go-kafka/model_topic_log_retention.go | 176 ++++ .../sdk-go-kafka/model_topic_read.go | 303 +++++++ .../sdk-go-kafka/model_topic_read_list.go | 259 ++++++ .../model_topic_read_list_all_of.go | 259 ++++++ .../ionos-cloud/sdk-go-kafka/model_user.go | 125 +++ .../model_user_access_metadata.go | 624 +++++++++++++ .../model_user_access_metadata_all_of.go | 211 +++++ .../sdk-go-kafka/model_user_read.go | 303 +++++++ .../sdk-go-kafka/model_user_read_access.go | 303 +++++++ .../sdk-go-kafka/model_user_read_list.go | 259 ++++++ .../model_user_read_list_all_of.go | 259 ++++++ .../ionos-cloud/sdk-go-kafka/response.go | 74 ++ .../sdk-go-kafka/sonar-project.properties | 12 + .../ionos-cloud/sdk-go-kafka/utils.go | 777 +++++++++++++++++ vendor/modules.txt | 3 + 62 files changed, 12638 insertions(+) create mode 100644 commands/kafka/cluster/cluster.go create mode 100644 commands/kafka/cluster/create.go create mode 100644 commands/kafka/cluster/delete.go create mode 100644 commands/kafka/cluster/get.go create mode 100644 commands/kafka/cluster/list.go create mode 100644 commands/kafka/completer/completer.go create mode 100644 commands/kafka/kafka.go create mode 100644 docs/subcommands/Kafka/cluster/create.md create mode 100644 docs/subcommands/Kafka/cluster/delete.md create mode 100644 docs/subcommands/Kafka/cluster/get.md create mode 100644 docs/subcommands/Kafka/cluster/list.md create mode 100644 internal/printer/json2table/jsonpaths/kafka.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/.gitbook.yaml create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/.gitignore create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/.travis.yml create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/LICENSE create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/README.md create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/api_clusters.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/api_topics.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/api_users.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/client.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/configuration.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/logger.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_create.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_metadata.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_metadata_all_of.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_read.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_read_list.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_read_list_all_of.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_error.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_error_messages.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_kafka_cluster_connection.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_links.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_metadata.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_pagination.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_resource_metadata.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_resource_state.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_create.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_log_retention.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_read.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_read_list.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_read_list_all_of.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_user.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_access_metadata.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_access_metadata_all_of.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read_access.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read_list.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read_list_all_of.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/response.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/sonar-project.properties create mode 100644 vendor/github.com/ionos-cloud/sdk-go-kafka/utils.go diff --git a/commands/kafka/cluster/cluster.go b/commands/kafka/cluster/cluster.go new file mode 100644 index 000000000..91d5b48a0 --- /dev/null +++ b/commands/kafka/cluster/cluster.go @@ -0,0 +1,34 @@ +package cluster + +import ( + "github.com/ionos-cloud/ionosctl/v6/internal/constants" + "github.com/ionos-cloud/ionosctl/v6/internal/core" + "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" + "github.com/spf13/cobra" +) + +var ( + allCols = []string{"Id", "Name", "Version", "Size", "DatacenterId", "LanId", "BrokerAddresses", "State"} + defaultCols = []string{"Id", "Name", "Version", "Size", "DatacenterId", "LanId", "BrokerAddresses", "State"} +) + +func Command() *core.Command { + cmd := &core.Command{ + Command: &cobra.Command{ + Use: "cluster", + Short: "The sub-commands of 'ionosctl kafka cluster' allow you to manage kafka clusters", + Aliases: []string{"cl"}, + TraverseChildren: true, + }, + } + cmd.Command.PersistentFlags().StringSlice(constants.ArgCols, nil, tabheaders.ColsMessage(allCols)) + _ = cmd.Command.RegisterFlagCompletionFunc(constants.ArgCols, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return allCols, cobra.ShellCompDirectiveNoFileComp + }) + + cmd.AddCommand(List()) + cmd.AddCommand(FindByID()) + cmd.AddCommand(Delete()) + cmd.AddCommand(Create()) + return cmd +} diff --git a/commands/kafka/cluster/create.go b/commands/kafka/cluster/create.go new file mode 100644 index 000000000..466f65ffa --- /dev/null +++ b/commands/kafka/cluster/create.go @@ -0,0 +1,139 @@ +package cluster + +import ( + "context" + "fmt" + "github.com/ionos-cloud/ionosctl/v6/commands/cloudapi-v6/completer" + cloudapiv6completer "github.com/ionos-cloud/ionosctl/v6/commands/cloudapi-v6/completer" + "github.com/ionos-cloud/ionosctl/v6/internal/client" + "github.com/ionos-cloud/ionosctl/v6/internal/constants" + "github.com/ionos-cloud/ionosctl/v6/internal/core" + "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" + "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" + "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" + "github.com/ionos-cloud/ionosctl/v6/pkg/pointer" + kafka "github.com/ionos-cloud/sdk-go-kafka" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +func Create() *core.Command { + cmd := core.NewCommand(context.Background(), nil, core.CommandBuilder{ + Namespace: "kafka", + Resource: "cluster", + Verb: "create", + Aliases: []string{"c", "post"}, + ShortDesc: "Create a kafka cluster. Wiki: https://docs.ionos.com/cloud/data-analytics/kafka/api-howtos/create-kafka", + Example: "ionosctl kafka cl create --name my-cluster --version 1.0 --size S --location de/txl --datacenter-id DATACENTER_ID --lan-id LAN_ID --broker-addresses 127.0.0.1,127.0.0.2", + PreCmdRun: func(c *core.PreCommandConfig) error { + if err := core.CheckRequiredFlags(c.Command, c.NS, + constants.FlagName, constants.FlagVersion, constants.FlagSize, constants.FlagLocation, + constants.FlagDatacenterId, constants.FlagLanId, constants.FlagKafkaBrokerAddresses); err != nil { + return err + } + + return nil + }, + CmdRun: func(c *core.CommandConfig) error { + input := &kafka.Cluster{} + if err := setPropertiesFromFlags(c, input); err != nil { + return err + } + + changeLocation(client.Must().Kafka, viper.GetString(core.GetFlagName(c.NS, constants.FlagLocation))) + res, _, err := client.Must().Kafka.ClustersApi.ClustersPost(context.Background()). + ClusterCreate(kafka.ClusterCreate{ + Properties: input, + }).Execute() + if err != nil { + return err + } + + return printCluster(c, res) + }, + InitClient: true, + }) + + cmd.Command.SilenceUsage = true + cmd.Command.Flags().SortFlags = false + return addClusterCreateFlags(cmd) +} + +func changeLocation(client *kafka.APIClient, location string) { + cfg := client.GetConfig() + cfg.Servers = kafka.ServerConfigurations{ + { + URL: locationToURL[location], + }, + } + return +} + +func addClusterCreateFlags(cmd *core.Command) *core.Command { + cmd.AddStringFlag(constants.FlagName, "", "", "The name of the kafka cluster", core.RequiredFlagOption()) + cmd.AddStringFlag(constants.FlagVersion, "", "", "The version of the kafka cluster", core.RequiredFlagOption()) + cmd.AddSetFlag(constants.FlagSize, "", "", []string{"XS", "S", "M", "L", "XL"}, "The size of the kafka cluster", core.RequiredFlagOption()) + _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagSize, func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return []string{"XS", "S", "M", "L", "XL"}, cobra.ShellCompDirectiveNoFileComp + }) + + cmd.AddStringFlag(constants.FlagLocation, "", "", "The location of the kafka cluster", core.RequiredFlagOption()) + _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagLocation, func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + var locations []string + for k := range locationToURL { + locations = append(locations, k) + } + + return locations, cobra.ShellCompDirectiveNoFileComp + }) + cmd.AddStringFlag(constants.FlagDatacenterId, "", "", "The ID of the datacenter", core.RequiredFlagOption()) + _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagDatacenterId, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return completer.DataCentersIds(), cobra.ShellCompDirectiveNoFileComp + }) + + cmd.AddStringFlag(constants.FlagLanId, "", "", "The ID of the LAN", core.RequiredFlagOption()) + _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagLanId, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return cloudapiv6completer.LansIds(cmd.Flag(constants.FlagDatacenterId).Value.String()), cobra.ShellCompDirectiveNoFileComp + }) + + cmd.AddStringSliceFlag(constants.FlagKafkaBrokerAddresses, "", []string{}, "The list of broker addresses", core.RequiredFlagOption()) + return cmd +} + +func setPropertiesFromFlags(c *core.CommandConfig, p *kafka.Cluster) error { + p.Name = pointer.From(viper.GetString(core.GetFlagName(c.NS, constants.FlagName))) + p.Version = pointer.From(viper.GetString(core.GetFlagName(c.NS, constants.FlagVersion))) + p.Size = pointer.From(viper.GetString(core.GetFlagName(c.NS, constants.FlagSize))) + + p.Connections = &[]kafka.KafkaClusterConnection{{ + DatacenterId: pointer.From(viper.GetString(core.GetFlagName(c.NS, constants.FlagDatacenterId))), + LanId: pointer.From(viper.GetString(core.GetFlagName(c.NS, constants.FlagLanId))), + BrokerAddresses: pointer.From(viper.GetStringSlice(core.GetFlagName(c.NS, constants.FlagKafkaBrokerAddresses))), + }} + + return nil +} + +func printCluster(c *core.CommandConfig, d kafka.ClusterRead) error { + cols, _ := c.Command.Command.Flags().GetStringSlice(constants.ArgCols) + out, err := jsontabwriter.GenerateOutput("", jsonpaths.KafkaCluster, d, + tabheaders.GetHeadersAllDefault(defaultCols, cols)) + if err != nil { + return err + } + + fmt.Fprintf(c.Command.Command.OutOrStdout(), out) + return nil +} + +var locationToURL = map[string]string{ + "de/fra": "https://kafka.de-fra.ionos.com", + "de/txl": "https://kafka.de-txl.ionos.com", + // other locations not yet available. will be added in the future. + // "es/vit": "https://kafka.es-vit.ionos.com", + // "gb/lhr": "https://kafka.gb-lhr.ionos.com", + // "us/ewr": "https://kafka.us-ewr.ionos.com", + // "us/las": "https://kafka.us-las.ionos.com", + // "us/mci": "https://kafka.us-mci.ionos.com", + // "fr/par": "https://kafka.fr-par.ionos.com", +} diff --git a/commands/kafka/cluster/delete.go b/commands/kafka/cluster/delete.go new file mode 100644 index 000000000..465d03d85 --- /dev/null +++ b/commands/kafka/cluster/delete.go @@ -0,0 +1,95 @@ +package cluster + +import ( + "context" + "fmt" + "github.com/ionos-cloud/ionosctl/v6/commands/kafka/completer" + "github.com/ionos-cloud/ionosctl/v6/internal/client" + "github.com/ionos-cloud/ionosctl/v6/internal/constants" + "github.com/ionos-cloud/ionosctl/v6/pkg/confirm" + "github.com/ionos-cloud/ionosctl/v6/pkg/functional" + kafka "github.com/ionos-cloud/sdk-go-kafka" + "github.com/spf13/cobra" + "github.com/spf13/viper" + + "github.com/ionos-cloud/ionosctl/v6/internal/core" +) + +func Delete() *core.Command { + cmd := core.NewCommand(context.Background(), nil, core.CommandBuilder{ + Namespace: "kafka", + Resource: "cluster", + Verb: "delete", + Aliases: []string{"del", "d"}, + ShortDesc: "Delete a cluster", + Example: `ionosctl kafka cl delete --cluster-id ID`, + PreCmdRun: func(c *core.PreCommandConfig) error { + if err := core.CheckRequiredFlagsSets(c.Command, c.NS, + []string{constants.FlagClusterId, constants.FlagLocation}, []string{constants.ArgAll, constants.FlagLocation}); err != nil { + return err + } + + return nil + }, + CmdRun: func(c *core.CommandConfig) error { + changeLocation(client.Must().Kafka, viper.GetString(core.GetFlagName(c.NS, constants.FlagLocation))) + if all := viper.GetBool(core.GetFlagName(c.NS, constants.ArgAll)); all { + return deleteAll(c) + } + + return deleteSingle(c, viper.GetString(core.GetFlagName(c.NS, constants.FlagClusterId))) + }, + InitClient: true, + }) + + cmd.AddStringFlag(constants.FlagClusterId, constants.FlagIdShort, "", "The ID of the cluster you want to retrieve", core.RequiredFlagOption()) + _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagClusterId, func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + changeLocation(client.Must().Kafka, viper.GetString(core.GetFlagName(cmd.NS, constants.FlagLocation))) + return completer.ClustersProperty(func(r kafka.ClusterRead) string { + return *r.Id + }), cobra.ShellCompDirectiveNoFileComp + }) + + cmd.AddStringFlag(constants.FlagLocation, "", "", "The datacenter location", core.RequiredFlagOption()) + _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagLocation, func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + var locations []string + for k := range locationToURL { + locations = append(locations, k) + } + + return locations, cobra.ShellCompDirectiveNoFileComp + }) + cmd.AddBoolFlag(constants.ArgAll, constants.ArgAllShort, false, "Delete all records if set", core.RequiredFlagOption()) + + cmd.Command.SilenceUsage = true + cmd.Command.Flags().SortFlags = false + + return cmd +} + +func deleteAll(c *core.CommandConfig) error { + records, err := completer.Clusters() + if err != nil { + return fmt.Errorf("failed getting all clusters: %w", err) + } + + return functional.ApplyAndAggregateErrors(*records.GetItems(), func(d kafka.ClusterRead) error { + return deleteSingle(c, *d.Id) + }) +} + +func deleteSingle(c *core.CommandConfig, id string) error { + d, _, err := client.Must().Kafka.ClustersApi.ClustersFindById(context.Background(), id).Execute() + if err != nil { + return fmt.Errorf("cluster not found: %w", err) + } + + yes := confirm.FAsk(c.Command.Command.InOrStdin(), fmt.Sprintf("Are you sure you want to delete cluster %s with name %s", *d.Id, *d.Properties.Name), + viper.GetBool(constants.ArgForce)) + if !yes { + return fmt.Errorf("user cancelled deletion") + } + + _, err = client.Must().Kafka.ClustersApi.ClustersDelete(context.Background(), *d.Id).Execute() + return err +} diff --git a/commands/kafka/cluster/get.go b/commands/kafka/cluster/get.go new file mode 100644 index 000000000..724c8ee8f --- /dev/null +++ b/commands/kafka/cluster/get.go @@ -0,0 +1,76 @@ +package cluster + +import ( + "context" + "fmt" + "github.com/ionos-cloud/ionosctl/v6/commands/kafka/completer" + "github.com/ionos-cloud/ionosctl/v6/internal/client" + "github.com/ionos-cloud/ionosctl/v6/internal/constants" + "github.com/ionos-cloud/ionosctl/v6/internal/core" + "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" + "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" + "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" + kafka "github.com/ionos-cloud/sdk-go-kafka" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +func FindByID() *core.Command { + cmd := core.NewCommand(context.Background(), nil, core.CommandBuilder{ + Namespace: "kafka", + Resource: "cluster", + Verb: "get", + Aliases: []string{"g"}, + ShortDesc: "Retrieve a cluster", + Example: "ionosctl kafka cl get --cluster-id ID", + PreCmdRun: func(c *core.PreCommandConfig) error { + if err := core.CheckRequiredFlags(c.Command, c.NS, constants.FlagClusterId, constants.FlagLocation); err != nil { + return err + } + + return nil + }, + CmdRun: func(c *core.CommandConfig) error { + changeLocation(client.Must().Kafka, viper.GetString(core.GetFlagName(c.NS, constants.FlagLocation))) + clusterID := viper.GetString(core.GetFlagName(c.NS, constants.FlagClusterId)) + r, _, err := client.Must().Kafka.ClustersApi.ClustersFindById(context.Background(), + clusterID, + ).Execute() + if err != nil { + return err + } + + cols, _ := c.Command.Command.Flags().GetStringSlice(constants.ArgCols) + out, err := jsontabwriter.GenerateOutput("", jsonpaths.KafkaCluster, r, + tabheaders.GetHeadersAllDefault(defaultCols, cols)) + if err != nil { + return err + } + + fmt.Fprintf(c.Command.Command.OutOrStdout(), out) + return nil + }, + InitClient: true, + }) + cmd.AddStringFlag(constants.FlagClusterId, constants.FlagIdShort, "", "The ID of the cluster you want to retrieve", core.RequiredFlagOption()) + _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagClusterId, func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + changeLocation(client.Must().Kafka, viper.GetString(core.GetFlagName(cmd.NS, constants.FlagLocation))) + return completer.ClustersProperty(func(r kafka.ClusterRead) string { + return *r.Id + }), cobra.ShellCompDirectiveNoFileComp + }) + + cmd.AddStringFlag(constants.FlagLocation, "", "", "The datacenter location", core.RequiredFlagOption()) + _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagLocation, func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + var locations []string + for k := range locationToURL { + locations = append(locations, k) + } + + return locations, cobra.ShellCompDirectiveNoFileComp + }) + + cmd.Command.SilenceUsage = true + cmd.Command.Flags().SortFlags = false + return cmd +} diff --git a/commands/kafka/cluster/list.go b/commands/kafka/cluster/list.go new file mode 100644 index 000000000..7043887c6 --- /dev/null +++ b/commands/kafka/cluster/list.go @@ -0,0 +1,104 @@ +package cluster + +import ( + "context" + "fmt" + "github.com/ionos-cloud/ionosctl/v6/commands/kafka/completer" + "github.com/ionos-cloud/ionosctl/v6/internal/client" + "github.com/ionos-cloud/ionosctl/v6/internal/constants" + "github.com/ionos-cloud/ionosctl/v6/internal/core" + "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table" + "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" + "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" + "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" + kafka "github.com/ionos-cloud/sdk-go-kafka" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +func List() *core.Command { + cmd := core.NewCommand( + context.Background(), nil, core.CommandBuilder{ + Namespace: "kafka", + Resource: "cluster", + Verb: "list", + Aliases: []string{"ls"}, + ShortDesc: "Retrieve all clusters using pagination and optional filters", + Example: `ionosctl kafka c list --location de/txl`, + PreCmdRun: func(c *core.PreCommandConfig) error { + if err := core.CheckRequiredFlags(c.Command, c.NS, constants.FlagLocation); err != nil { + return err + } + + return nil + }, + CmdRun: func(c *core.CommandConfig) error { + return listClusters(c) + }, + InitClient: true, + }, + ) + + cmd.AddStringFlag(constants.FlagFilterName, "", "", "Filter used to fetch only the records that contain specified name.") + cmd.AddSetFlag(constants.FlagFilterState, "", "", []string{"AVAILABLE", "BUSY", "DEPLOYING", "UPDATING", "FAILED_UPDATING", "FAILED", "DESTROYING"}, "Filter used to fetch only the records that contain specified state.") + _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagFilterState, func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return []string{"AVAILABLE", "BUSY", "DEPLOYING", "UPDATING", "FAILED_UPDATING", "FAILED", "DESTROYING"}, cobra.ShellCompDirectiveNoFileComp + }) + + cmd.AddStringFlag(constants.FlagLocation, "", "", "The datacenter location", core.RequiredFlagOption()) + _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagLocation, func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + var locations []string + for k := range locationToURL { + locations = append(locations, k) + } + + return locations, cobra.ShellCompDirectiveNoFileComp + }) + + cmd.Command.PersistentFlags().StringSlice( + constants.ArgCols, nil, + fmt.Sprintf( + "Set of columns to be printed on output \nAvailable columns: %v", + allCols, + ), + ) + + return cmd +} + +func listClusters(c *core.CommandConfig) error { + changeLocation(client.Must().Kafka, viper.GetString(core.GetFlagName(c.NS, constants.FlagLocation))) + ls, err := completer.Clusters( + func(req kafka.ApiClustersGetRequest) (kafka.ApiClustersGetRequest, error) { + if fn := core.GetFlagName(c.NS, constants.FlagFilterState); viper.IsSet(fn) { + req = req.FilterState(viper.GetString(fn)) + } + if fn := core.GetFlagName(c.NS, constants.FlagFilterName); viper.IsSet(fn) { + req = req.FilterName(viper.GetString(fn)) + } + return req, nil + }, + ) + if err != nil { + return fmt.Errorf("failed listing kafka clusters: %w", err) + } + + items, ok := ls.GetItemsOk() + if !ok || items == nil { + return fmt.Errorf("could not retrieve clusters") + } + + convertedItems, err := json2table.ConvertJSONToTable("", jsonpaths.KafkaCluster, *items) + if err != nil { + return fmt.Errorf("could not convert from JSON to Table format: %w", err) + } + + cols, _ := c.Command.Command.Flags().GetStringSlice(constants.ArgCols) + out, err := jsontabwriter.GenerateOutputPreconverted(ls, convertedItems, tabheaders.GetHeaders(allCols, defaultCols, cols)) + if err != nil { + return err + } + + fmt.Fprintf(c.Command.Command.OutOrStdout(), out) + return nil +} diff --git a/commands/kafka/completer/completer.go b/commands/kafka/completer/completer.go new file mode 100644 index 000000000..5896fafa5 --- /dev/null +++ b/commands/kafka/completer/completer.go @@ -0,0 +1,38 @@ +package completer + +import ( + "context" + "github.com/ionos-cloud/ionosctl/v6/internal/client" + "github.com/ionos-cloud/ionosctl/v6/pkg/functional" + kafka "github.com/ionos-cloud/sdk-go-kafka" +) + +// ClustersProperty returns a list of properties of all clusters matching the given filters +func ClustersProperty[V any](f func(read kafka.ClusterRead) V, fs ...Filter) []V { + recs, err := Clusters(fs...) + if err != nil { + return nil + } + return functional.Map(*recs.Items, f) +} + +// Clusters returns all clusters matching the given filters +func Clusters(fs ...Filter) (kafka.ClusterReadList, error) { + req := client.Must().Kafka.ClustersApi.ClustersGet(context.Background()) + for _, f := range fs { + var err error + req, err = f(req) + if err != nil { + return kafka.ClusterReadList{}, err + } + } + + ls, _, err := req.Execute() + if err != nil { + return kafka.ClusterReadList{}, err + } + + return ls, nil +} + +type Filter func(request kafka.ApiClustersGetRequest) (kafka.ApiClustersGetRequest, error) diff --git a/commands/kafka/kafka.go b/commands/kafka/kafka.go new file mode 100644 index 000000000..ac220f240 --- /dev/null +++ b/commands/kafka/kafka.go @@ -0,0 +1,19 @@ +package kafka + +import ( + "github.com/ionos-cloud/ionosctl/v6/commands/kafka/cluster" + "github.com/ionos-cloud/ionosctl/v6/internal/core" + "github.com/spf13/cobra" +) + +func Command() *core.Command { + cmd := &core.Command{ + Command: &cobra.Command{ + Use: "kafka", + Short: "The sub-commands of the 'kafka' resource help manage kafka clusters", + TraverseChildren: true, + }, + } + cmd.AddCommand(cluster.Command()) + return cmd +} diff --git a/commands/root.go b/commands/root.go index 686090116..710c1a067 100644 --- a/commands/root.go +++ b/commands/root.go @@ -3,6 +3,7 @@ package commands import ( "fmt" "github.com/ionos-cloud/ionosctl/v6/commands/cdn" + "github.com/ionos-cloud/ionosctl/v6/commands/kafka" "os" "strings" @@ -253,6 +254,9 @@ func addCommands() { // CDN rootCmd.AddCommand(cdn.Command()) + + // Kafka + rootCmd.AddCommand(kafka.Command()) } const ( diff --git a/docs/subcommands/Kafka/cluster/create.md b/docs/subcommands/Kafka/cluster/create.md new file mode 100644 index 000000000..6c19526b0 --- /dev/null +++ b/docs/subcommands/Kafka/cluster/create.md @@ -0,0 +1,58 @@ +--- +description: "Create a kafka cluster. Wiki: https://docs.ionos.com/cloud/data-analytics/kafka/api-howtos/create-kafka" +--- + +# KafkaClusterCreate + +## Usage + +```text +ionosctl kafka cluster create [flags] +``` + +## Aliases + +For `cluster` command: + +```text +[cl] +``` + +For `create` command: + +```text +[c post] +``` + +## Description + +Create a kafka cluster. Wiki: https://docs.ionos.com/cloud/data-analytics/kafka/api-howtos/create-kafka + +## Options + +```text + -u, --api-url string Override default host url (default "https://api.ionos.com") + --broker-addresses strings The list of broker addresses (required) + --cols strings Set of columns to be printed on output + Available columns: [Id Name Version Size DatacenterId LanId BrokerAddresses State] + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + --datacenter-id string The ID of the datacenter (required) + -f, --force Force command to execute without user input + -h, --help Print usage + --lan-id string The ID of the LAN (required) + --location string The location of the kafka cluster (required) + --name string The name of the kafka cluster (required) + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + --size string The size of the kafka cluster. Can be one of: XS, S, M, L, XL (required) + -v, --verbose Print step-by-step process when running command + --version string The version of the kafka cluster (required) +``` + +## Examples + +```text +ionosctl kafka cl create --name my-cluster --version 1.0 --size S --location de/txl --datacenter-id DATACENTER_ID --lan-id LAN_ID --broker-addresses 127.0.0.1,127.0.0.2 +``` + diff --git a/docs/subcommands/Kafka/cluster/delete.md b/docs/subcommands/Kafka/cluster/delete.md new file mode 100644 index 000000000..abf9763ad --- /dev/null +++ b/docs/subcommands/Kafka/cluster/delete.md @@ -0,0 +1,54 @@ +--- +description: "Delete a cluster" +--- + +# KafkaClusterDelete + +## Usage + +```text +ionosctl kafka cluster delete [flags] +``` + +## Aliases + +For `cluster` command: + +```text +[cl] +``` + +For `delete` command: + +```text +[del d] +``` + +## Description + +Delete a cluster + +## Options + +```text + -a, --all Delete all records if set (required) + -u, --api-url string Override default host url (default "https://api.ionos.com") + -i, --cluster-id string The ID of the cluster you want to retrieve (required) + --cols strings Set of columns to be printed on output + Available columns: [Id Name Version Size DatacenterId LanId BrokerAddresses State] + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + --location string The datacenter location (required) + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + -v, --verbose Print step-by-step process when running command +``` + +## Examples + +```text +ionosctl kafka cl delete --cluster-id ID +``` + diff --git a/docs/subcommands/Kafka/cluster/get.md b/docs/subcommands/Kafka/cluster/get.md new file mode 100644 index 000000000..81c14605e --- /dev/null +++ b/docs/subcommands/Kafka/cluster/get.md @@ -0,0 +1,53 @@ +--- +description: "Retrieve a cluster" +--- + +# KafkaClusterGet + +## Usage + +```text +ionosctl kafka cluster get [flags] +``` + +## Aliases + +For `cluster` command: + +```text +[cl] +``` + +For `get` command: + +```text +[g] +``` + +## Description + +Retrieve a cluster + +## Options + +```text + -u, --api-url string Override default host url (default "https://api.ionos.com") + -i, --cluster-id string The ID of the cluster you want to retrieve (required) + --cols strings Set of columns to be printed on output + Available columns: [Id Name Version Size DatacenterId LanId BrokerAddresses State] + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + --location string The datacenter location (required) + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + -v, --verbose Print step-by-step process when running command +``` + +## Examples + +```text +ionosctl kafka cl get --cluster-id ID +``` + diff --git a/docs/subcommands/Kafka/cluster/list.md b/docs/subcommands/Kafka/cluster/list.md new file mode 100644 index 000000000..bc87cd476 --- /dev/null +++ b/docs/subcommands/Kafka/cluster/list.md @@ -0,0 +1,54 @@ +--- +description: "Retrieve all clusters using pagination and optional filters" +--- + +# KafkaClusterList + +## Usage + +```text +ionosctl kafka cluster list [flags] +``` + +## Aliases + +For `cluster` command: + +```text +[cl] +``` + +For `list` command: + +```text +[ls] +``` + +## Description + +Retrieve all clusters using pagination and optional filters + +## Options + +```text + -u, --api-url string Override default host url (default "https://api.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id Name Version Size DatacenterId LanId BrokerAddresses State] + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + --location string The datacenter location (required) + --name string Filter used to fetch only the records that contain specified name. + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + --state string Filter used to fetch only the records that contain specified state.. Can be one of: AVAILABLE, BUSY, DEPLOYING, UPDATING, FAILED_UPDATING, FAILED, DESTROYING + -v, --verbose Print step-by-step process when running command +``` + +## Examples + +```text +ionosctl kafka c list --location de/txl +``` + diff --git a/docs/summary.md b/docs/summary.md index 7252e9f94..18e11acde 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -354,6 +354,12 @@ * [list](subcommands%2FDatabase-as-a-Service%2Fpostgres%2Fversion%2Flist.md) * Interactive Shell * [shell](subcommands%2FInteractive%20Shell%2Fshell.md) +* Kafka + * cluster + * [create](subcommands%2FKafka%2Fcluster%2Fcreate.md) + * [delete](subcommands%2FKafka%2Fcluster%2Fdelete.md) + * [get](subcommands%2FKafka%2Fcluster%2Fget.md) + * [list](subcommands%2FKafka%2Fcluster%2Flist.md) * Logging Service * logs * [add](subcommands%2FLogging-Service%2Flogs%2Fadd.md) diff --git a/go.mod b/go.mod index c9555dcf4..18d10bbc5 100644 --- a/go.mod +++ b/go.mod @@ -42,6 +42,7 @@ require ( github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4 github.com/ionos-cloud/sdk-go-cdn v1.1.0 github.com/ionos-cloud/sdk-go-dbaas-mariadb v1.0.0 + github.com/ionos-cloud/sdk-go-kafka v1.1.0 ) require ( diff --git a/go.sum b/go.sum index eeb357ab5..e51bfccf4 100644 --- a/go.sum +++ b/go.sum @@ -262,6 +262,8 @@ github.com/ionos-cloud/sdk-go-dbaas-postgres v1.1.2 h1:AaKbci+kVS6/k43VwJwmXxCJ7 github.com/ionos-cloud/sdk-go-dbaas-postgres v1.1.2/go.mod h1:nmJEwuRX65A5/PxwvdFW0XrV+N6WFYnMV1TiIafAwz4= github.com/ionos-cloud/sdk-go-dns v1.2.0 h1:1b/iFupP6ge+IzLeUyaoJwEssVgSwIjmFfwjUf1a4T8= github.com/ionos-cloud/sdk-go-dns v1.2.0/go.mod h1:l9gYdwtUshlBOiIi4nHn3RCX81XlV3VoNvLJrO2VfHg= +github.com/ionos-cloud/sdk-go-kafka v1.1.0 h1:9vm2iyCJdo2VFconoNWMoYvQNsjzU2fFEusV2gkiV4g= +github.com/ionos-cloud/sdk-go-kafka v1.1.0/go.mod h1:TfGSquLvfwlnc0Yt0t8OzUEmKHG+2TqoKsV+JZSnM6w= github.com/ionos-cloud/sdk-go-logging v1.0.1 h1:MB9jPoBUL3mZ+ois7kXYy67x0FopAw2aihMGdr2wu1k= github.com/ionos-cloud/sdk-go-logging v1.0.1/go.mod h1:P2JQJpUgH3ZyfyJmv6jMwcB1NJIVVZSL+/bllhWpwc8= github.com/ionos-cloud/sdk-go-vm-autoscaling v1.0.1 h1:KABL25MC7DrIHn9lQzKSPkwXhqvRkPYtFd+1HEogmAE= diff --git a/internal/client/model.go b/internal/client/model.go index b46ac7228..0886f0a62 100644 --- a/internal/client/model.go +++ b/internal/client/model.go @@ -3,6 +3,7 @@ package client import ( "fmt" cdn "github.com/ionos-cloud/sdk-go-cdn" + kafka "github.com/ionos-cloud/sdk-go-kafka" "github.com/ionos-cloud/ionosctl/v6/internal/constants" sdkgoauth "github.com/ionos-cloud/sdk-go-auth" @@ -73,6 +74,7 @@ type Client struct { MongoClient *mongo.APIClient MariaClient *maria.APIClient CDNClient *cdn.APIClient + Kafka *kafka.APIClient } func appendUserAgent(userAgent string) string { @@ -118,6 +120,9 @@ func newClient(name, pwd, token, hostUrl string, usedLayer *Layer) *Client { cdnConfig := cdn.NewConfiguration(name, pwd, token, hostUrl) cdnConfig.UserAgent = appendUserAgent(cdnConfig.UserAgent) + kafkaConfig := kafka.NewConfiguration(name, pwd, token, hostUrl) + kafkaConfig.UserAgent = appendUserAgent(kafkaConfig.UserAgent) + return &Client{ CloudClient: cloudv6.NewAPIClient(clientConfig), AuthClient: sdkgoauth.NewAPIClient(authConfig), @@ -132,6 +137,7 @@ func newClient(name, pwd, token, hostUrl string, usedLayer *Layer) *Client { MongoClient: mongo.NewAPIClient(mongoConfig), MariaClient: maria.NewAPIClient(mariaConfig), CDNClient: cdn.NewAPIClient(cdnConfig), + Kafka: kafka.NewAPIClient(kafkaConfig), usedLayer: usedLayer, } diff --git a/internal/constants/constants.go b/internal/constants/constants.go index 3accd89d7..fe9706bef 100644 --- a/internal/constants/constants.go +++ b/internal/constants/constants.go @@ -53,6 +53,7 @@ Within each layer, a token takes precedence over a username and password combina FlagAnnotations = "annotations" FlagAnnotationsShort = "A" FlagVersion = "version" + FlagSize = "size" FlagZone = "zone" FlagZoneShort = "z" @@ -86,6 +87,11 @@ Within each layer, a token takes precedence over a username and password combina FlagCDNDistributionRoutingRules = "routing-rules" FlagCDNDistributionRoutingRulesExample = "routing-rules-example" + FlagFilterName = "name" + FlagFilterState = "state" + + FlagKafkaBrokerAddresses = "broker-addresses" + FlagGroupId = "group-id" FlagServerId = "server-id" FlagActionId = "action-id" diff --git a/internal/core/doc/doc.go b/internal/core/doc/doc.go index d91c76ad2..969411f75 100644 --- a/internal/core/doc/doc.go +++ b/internal/core/doc/doc.go @@ -37,6 +37,7 @@ var nonComputeNamespaces = map[string]string{ "user": "User-Management", "dns": "DNS", "cdn": "CDN", + "kafka": "Kafka", "config": "CLI Setup", "vm-autoscaling": "VM Autoscaling", "logging-service": "Logging-Service", diff --git a/internal/printer/json2table/jsonpaths/kafka.go b/internal/printer/json2table/jsonpaths/kafka.go new file mode 100644 index 000000000..1e25bfab1 --- /dev/null +++ b/internal/printer/json2table/jsonpaths/kafka.go @@ -0,0 +1,12 @@ +package jsonpaths + +var KafkaCluster = map[string]string{ + "Id": "id", + "Name": "properties.name", + "Version": "properties.version", + "Size": "properties.size", + "DatacenterId": "properties.connections.0.datacenterId", + "LanId": "properties.connections.0.lanId", + "BrokerAddresses": "properties.connections.0.brokers", + "State": "metadata.state", +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/.gitbook.yaml b/vendor/github.com/ionos-cloud/sdk-go-kafka/.gitbook.yaml new file mode 100644 index 000000000..6c8fbd82b --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/.gitbook.yaml @@ -0,0 +1,4 @@ +root: docs +structure: + readme: README.md + summary: summary.md diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/.gitignore b/vendor/github.com/ionos-cloud/sdk-go-kafka/.gitignore new file mode 100644 index 000000000..daf913b1b --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/.travis.yml b/vendor/github.com/ionos-cloud/sdk-go-kafka/.travis.yml new file mode 100644 index 000000000..f5cb2ce9a --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/LICENSE b/vendor/github.com/ionos-cloud/sdk-go-kafka/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/README.md b/vendor/github.com/ionos-cloud/sdk-go-kafka/README.md new file mode 100644 index 000000000..a9415e0f7 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/README.md @@ -0,0 +1,148 @@ +# Go API client for ionoscloud + +An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, +allowing large volumes of data to be ingested, stored, and processed in real-time. By +distributing data across multiple brokers, Kafka achieves high throughput and low +latency, making it suitable for applications requiring real-time data processing and +analytics. + + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 1.7.1 +- Package version: 1.1.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen +For more information, please visit [https://docs.ionos.com/support/general-information/contact-information](https://docs.ionos.com/support/general-information/contact-information) + +## Installation + +Install the following dependencies: + +```shell +go get github.com/stretchr/testify/assert +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```golang +import ionoscloud "github.com/ionos-cloud/sdk-go-kafka" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```golang +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") +``` + +## Configuration of Server URL + +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. + +```golang +ctx := context.WithValue(context.Background(), ionoscloud.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. + +```golang +ctx := context.WithValue(context.Background(), ionoscloud.ContextServerVariables, map[string]string{ + "basePath": "v2", +}) +``` + +Note, enum values are always validated and all unused variables are silently ignored. + +## Documentation for API Endpoints + +All URIs are relative to *https://kafka.de-fra.ionos.com* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*ClustersApi* | [**ClustersDelete**](docs/api/ClustersApi.md#clustersdelete) | **Delete** /clusters/{clusterId} | Delete Cluster +*ClustersApi* | [**ClustersFindById**](docs/api/ClustersApi.md#clustersfindbyid) | **Get** /clusters/{clusterId} | Retrieve Cluster +*ClustersApi* | [**ClustersGet**](docs/api/ClustersApi.md#clustersget) | **Get** /clusters | Retrieve all Clusters +*ClustersApi* | [**ClustersPost**](docs/api/ClustersApi.md#clusterspost) | **Post** /clusters | Create Cluster +*TopicsApi* | [**ClustersTopicsDelete**](docs/api/TopicsApi.md#clusterstopicsdelete) | **Delete** /clusters/{clusterId}/topics/{topicId} | Delete Topic +*TopicsApi* | [**ClustersTopicsFindById**](docs/api/TopicsApi.md#clusterstopicsfindbyid) | **Get** /clusters/{clusterId}/topics/{topicId} | Retrieve Topic +*TopicsApi* | [**ClustersTopicsGet**](docs/api/TopicsApi.md#clusterstopicsget) | **Get** /clusters/{clusterId}/topics | Retrieve all Topics +*TopicsApi* | [**ClustersTopicsPost**](docs/api/TopicsApi.md#clusterstopicspost) | **Post** /clusters/{clusterId}/topics | Create Topic +*UsersApi* | [**ClustersUsersAccessGet**](docs/api/UsersApi.md#clustersusersaccessget) | **Get** /clusters/{clusterId}/users/{userId}/access | Retrieve Kafka User with credentials. +*UsersApi* | [**ClustersUsersGet**](docs/api/UsersApi.md#clustersusersget) | **Get** /clusters/{clusterId}/users | Retrieve all Users + + +## Documentation For Models + + - [Cluster](docs/models/Cluster.md) + - [ClusterCreate](docs/models/ClusterCreate.md) + - [ClusterMetadata](docs/models/ClusterMetadata.md) + - [ClusterMetadataAllOf](docs/models/ClusterMetadataAllOf.md) + - [ClusterRead](docs/models/ClusterRead.md) + - [ClusterReadList](docs/models/ClusterReadList.md) + - [ClusterReadListAllOf](docs/models/ClusterReadListAllOf.md) + - [Error](docs/models/Error.md) + - [ErrorMessages](docs/models/ErrorMessages.md) + - [KafkaClusterConnection](docs/models/KafkaClusterConnection.md) + - [Links](docs/models/Links.md) + - [Metadata](docs/models/Metadata.md) + - [Pagination](docs/models/Pagination.md) + - [ResourceMetadata](docs/models/ResourceMetadata.md) + - [ResourceState](docs/models/ResourceState.md) + - [Topic](docs/models/Topic.md) + - [TopicCreate](docs/models/TopicCreate.md) + - [TopicLogRetention](docs/models/TopicLogRetention.md) + - [TopicRead](docs/models/TopicRead.md) + - [TopicReadList](docs/models/TopicReadList.md) + - [TopicReadListAllOf](docs/models/TopicReadListAllOf.md) + - [User](docs/models/User.md) + - [UserAccessMetadata](docs/models/UserAccessMetadata.md) + - [UserAccessMetadataAllOf](docs/models/UserAccessMetadataAllOf.md) + - [UserRead](docs/models/UserRead.md) + - [UserReadAccess](docs/models/UserReadAccess.md) + - [UserReadList](docs/models/UserReadList.md) + - [UserReadListAllOf](docs/models/UserReadListAllOf.md) + + +## Documentation For Authorization + + +Authentication schemes defined for the API: +### tokenAuth + +- **Type**: HTTP Bearer token authentication + +Example + +```golang +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING") +r, err := client.Service.Operation(auth, args) +``` + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + +support@cloud.ionos.com + diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/api_clusters.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/api_clusters.go new file mode 100644 index 000000000..3d9e766c5 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/api_clusters.go @@ -0,0 +1,788 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + _context "context" + "fmt" + "io" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// ClustersApiService ClustersApi service +type ClustersApiService service + +type ApiClustersDeleteRequest struct { + ctx _context.Context + ApiService *ClustersApiService + clusterId string +} + +func (r ApiClustersDeleteRequest) Execute() (*APIResponse, error) { + return r.ApiService.ClustersDeleteExecute(r) +} + +/* + * ClustersDelete Delete Cluster + * Deletes the specified Cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param clusterId The ID (UUID) of the Cluster. + * @return ApiClustersDeleteRequest + */ +func (a *ClustersApiService) ClustersDelete(ctx _context.Context, clusterId string) ApiClustersDeleteRequest { + return ApiClustersDeleteRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +/* + * Execute executes the request + */ +func (a *ClustersApiService) ClustersDeleteExecute(r ApiClustersDeleteRequest) (*APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClustersApiService.ClustersDelete") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", _neturl.PathEscape(parameterToString(r.clusterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "ClustersDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + return localVarAPIResponse, newErr + } + + return localVarAPIResponse, nil +} + +type ApiClustersFindByIdRequest struct { + ctx _context.Context + ApiService *ClustersApiService + clusterId string +} + +func (r ApiClustersFindByIdRequest) Execute() (ClusterRead, *APIResponse, error) { + return r.ApiService.ClustersFindByIdExecute(r) +} + +/* + * ClustersFindById Retrieve Cluster + * Returns the Cluster by ID. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param clusterId The ID (UUID) of the Cluster. + * @return ApiClustersFindByIdRequest + */ +func (a *ClustersApiService) ClustersFindById(ctx _context.Context, clusterId string) ApiClustersFindByIdRequest { + return ApiClustersFindByIdRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +/* + * Execute executes the request + * @return ClusterRead + */ +func (a *ClustersApiService) ClustersFindByIdExecute(r ApiClustersFindByIdRequest) (ClusterRead, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ClusterRead + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClustersApiService.ClustersFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", _neturl.PathEscape(parameterToString(r.clusterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "ClustersFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiClustersGetRequest struct { + ctx _context.Context + ApiService *ClustersApiService + filterName *string + filterState *string +} + +func (r ApiClustersGetRequest) FilterName(filterName string) ApiClustersGetRequest { + r.filterName = &filterName + return r +} +func (r ApiClustersGetRequest) FilterState(filterState string) ApiClustersGetRequest { + r.filterState = &filterState + return r +} + +func (r ApiClustersGetRequest) Execute() (ClusterReadList, *APIResponse, error) { + return r.ApiService.ClustersGetExecute(r) +} + +/* + - ClustersGet Retrieve all Clusters + - This endpoint enables retrieving all Clusters using + +pagination and optional filters. + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @return ApiClustersGetRequest +*/ +func (a *ClustersApiService) ClustersGet(ctx _context.Context) ApiClustersGetRequest { + return ApiClustersGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return ClusterReadList + */ +func (a *ClustersApiService) ClustersGetExecute(r ApiClustersGetRequest) (ClusterReadList, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ClusterReadList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClustersApiService.ClustersGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.filterName != nil { + localVarQueryParams.Add("filter.name", parameterToString(*r.filterName, "")) + } + if r.filterState != nil { + localVarQueryParams.Add("filter.state", parameterToString(*r.filterState, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "ClustersGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiClustersPostRequest struct { + ctx _context.Context + ApiService *ClustersApiService + clusterCreate *ClusterCreate +} + +func (r ApiClustersPostRequest) ClusterCreate(clusterCreate ClusterCreate) ApiClustersPostRequest { + r.clusterCreate = &clusterCreate + return r +} + +func (r ApiClustersPostRequest) Execute() (ClusterRead, *APIResponse, error) { + return r.ApiService.ClustersPostExecute(r) +} + +/* + - ClustersPost Create Cluster + - Creates a new Cluster. + +The full Cluster needs to be provided to create the object. +Optional data will be filled with defaults or left empty. + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @return ApiClustersPostRequest +*/ +func (a *ClustersApiService) ClustersPost(ctx _context.Context) ApiClustersPostRequest { + return ApiClustersPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return ClusterRead + */ +func (a *ClustersApiService) ClustersPostExecute(r ApiClustersPostRequest) (ClusterRead, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ClusterRead + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClustersApiService.ClustersPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.clusterCreate == nil { + return localVarReturnValue, nil, reportError("clusterCreate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.clusterCreate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "ClustersPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 415 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/api_topics.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/api_topics.go new file mode 100644 index 000000000..584df51d4 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/api_topics.go @@ -0,0 +1,823 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + _context "context" + "fmt" + "io" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// TopicsApiService TopicsApi service +type TopicsApiService service + +type ApiClustersTopicsDeleteRequest struct { + ctx _context.Context + ApiService *TopicsApiService + clusterId string + topicId string +} + +func (r ApiClustersTopicsDeleteRequest) Execute() (*APIResponse, error) { + return r.ApiService.ClustersTopicsDeleteExecute(r) +} + +/* + * ClustersTopicsDelete Delete Topic + * Deletes the specified Topic. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param clusterId The ID (UUID) of the Cluster. + * @param topicId The ID (UUID) of the Topic. + * @return ApiClustersTopicsDeleteRequest + */ +func (a *TopicsApiService) ClustersTopicsDelete(ctx _context.Context, clusterId string, topicId string) ApiClustersTopicsDeleteRequest { + return ApiClustersTopicsDeleteRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + topicId: topicId, + } +} + +/* + * Execute executes the request + */ +func (a *TopicsApiService) ClustersTopicsDeleteExecute(r ApiClustersTopicsDeleteRequest) (*APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TopicsApiService.ClustersTopicsDelete") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/topics/{topicId}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", _neturl.PathEscape(parameterToString(r.clusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"topicId"+"}", _neturl.PathEscape(parameterToString(r.topicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "ClustersTopicsDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + return localVarAPIResponse, newErr + } + + return localVarAPIResponse, nil +} + +type ApiClustersTopicsFindByIdRequest struct { + ctx _context.Context + ApiService *TopicsApiService + clusterId string + topicId string +} + +func (r ApiClustersTopicsFindByIdRequest) Execute() (TopicRead, *APIResponse, error) { + return r.ApiService.ClustersTopicsFindByIdExecute(r) +} + +/* + * ClustersTopicsFindById Retrieve Topic + * Returns the Topic by ID. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param clusterId The ID (UUID) of the Cluster. + * @param topicId The ID (UUID) of the Topic. + * @return ApiClustersTopicsFindByIdRequest + */ +func (a *TopicsApiService) ClustersTopicsFindById(ctx _context.Context, clusterId string, topicId string) ApiClustersTopicsFindByIdRequest { + return ApiClustersTopicsFindByIdRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + topicId: topicId, + } +} + +/* + * Execute executes the request + * @return TopicRead + */ +func (a *TopicsApiService) ClustersTopicsFindByIdExecute(r ApiClustersTopicsFindByIdRequest) (TopicRead, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TopicRead + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TopicsApiService.ClustersTopicsFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/topics/{topicId}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", _neturl.PathEscape(parameterToString(r.clusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"topicId"+"}", _neturl.PathEscape(parameterToString(r.topicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "ClustersTopicsFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiClustersTopicsGetRequest struct { + ctx _context.Context + ApiService *TopicsApiService + clusterId string +} + +func (r ApiClustersTopicsGetRequest) Execute() (TopicReadList, *APIResponse, error) { + return r.ApiService.ClustersTopicsGetExecute(r) +} + +/* + - ClustersTopicsGet Retrieve all Topics + - This endpoint enables retrieving all Topics using + +pagination and optional filters. + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param clusterId The ID (UUID) of the Cluster. + - @return ApiClustersTopicsGetRequest +*/ +func (a *TopicsApiService) ClustersTopicsGet(ctx _context.Context, clusterId string) ApiClustersTopicsGetRequest { + return ApiClustersTopicsGetRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +/* + * Execute executes the request + * @return TopicReadList + */ +func (a *TopicsApiService) ClustersTopicsGetExecute(r ApiClustersTopicsGetRequest) (TopicReadList, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TopicReadList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TopicsApiService.ClustersTopicsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/topics" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", _neturl.PathEscape(parameterToString(r.clusterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "ClustersTopicsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiClustersTopicsPostRequest struct { + ctx _context.Context + ApiService *TopicsApiService + clusterId string + topicCreate *TopicCreate +} + +func (r ApiClustersTopicsPostRequest) TopicCreate(topicCreate TopicCreate) ApiClustersTopicsPostRequest { + r.topicCreate = &topicCreate + return r +} + +func (r ApiClustersTopicsPostRequest) Execute() (TopicRead, *APIResponse, error) { + return r.ApiService.ClustersTopicsPostExecute(r) +} + +/* + - ClustersTopicsPost Create Topic + - Creates a new Topic. + +The full Topic needs to be provided to create the object. +Optional data will be filled with defaults or left empty. + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param clusterId The ID (UUID) of the Cluster. + - @return ApiClustersTopicsPostRequest +*/ +func (a *TopicsApiService) ClustersTopicsPost(ctx _context.Context, clusterId string) ApiClustersTopicsPostRequest { + return ApiClustersTopicsPostRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +/* + * Execute executes the request + * @return TopicRead + */ +func (a *TopicsApiService) ClustersTopicsPostExecute(r ApiClustersTopicsPostRequest) (TopicRead, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TopicRead + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TopicsApiService.ClustersTopicsPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/topics" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", _neturl.PathEscape(parameterToString(r.clusterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.topicCreate == nil { + return localVarReturnValue, nil, reportError("topicCreate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.topicCreate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "ClustersTopicsPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 415 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/api_users.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/api_users.go new file mode 100644 index 000000000..2960c386a --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/api_users.go @@ -0,0 +1,399 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + _context "context" + "fmt" + "io" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// UsersApiService UsersApi service +type UsersApiService service + +type ApiClustersUsersAccessGetRequest struct { + ctx _context.Context + ApiService *UsersApiService + clusterId string + userId string +} + +func (r ApiClustersUsersAccessGetRequest) Execute() (UserReadAccess, *APIResponse, error) { + return r.ApiService.ClustersUsersAccessGetExecute(r) +} + +/* + * ClustersUsersAccessGet Retrieve Kafka User with credentials. + * Returns the User by ID containing its access certificates in the metadata. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param clusterId The ID (UUID) of the Cluster. + * @param userId The ID (UUID) of the User. + * @return ApiClustersUsersAccessGetRequest + */ +func (a *UsersApiService) ClustersUsersAccessGet(ctx _context.Context, clusterId string, userId string) ApiClustersUsersAccessGetRequest { + return ApiClustersUsersAccessGetRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + userId: userId, + } +} + +/* + * Execute executes the request + * @return UserReadAccess + */ +func (a *UsersApiService) ClustersUsersAccessGetExecute(r ApiClustersUsersAccessGetRequest) (UserReadAccess, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue UserReadAccess + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.ClustersUsersAccessGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/users/{userId}/access" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", _neturl.PathEscape(parameterToString(r.clusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "ClustersUsersAccessGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiClustersUsersGetRequest struct { + ctx _context.Context + ApiService *UsersApiService + clusterId string +} + +func (r ApiClustersUsersGetRequest) Execute() (UserReadList, *APIResponse, error) { + return r.ApiService.ClustersUsersGetExecute(r) +} + +/* + - ClustersUsersGet Retrieve all Users + - This endpoint enables retrieving all Users using + +pagination and optional filters. + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param clusterId The ID (UUID) of the Cluster. + - @return ApiClustersUsersGetRequest +*/ +func (a *UsersApiService) ClustersUsersGet(ctx _context.Context, clusterId string) ApiClustersUsersGetRequest { + return ApiClustersUsersGetRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +/* + * Execute executes the request + * @return UserReadList + */ +func (a *UsersApiService) ClustersUsersGetExecute(r ApiClustersUsersGetRequest) (UserReadList, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue UserReadList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.ClustersUsersGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/users" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", _neturl.PathEscape(parameterToString(r.clusterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "ClustersUsersGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/client.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/client.go new file mode 100644 index 000000000..6297860fa --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/client.go @@ -0,0 +1,749 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "bytes" + "context" + "crypto/sha256" + "crypto/tls" + "crypto/x509" + "encoding/hex" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "mime/multipart" + "net" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)\/(?:vnd\.[^;]+|problem\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) +) + +const ( + RequestStatusQueued = "QUEUED" + RequestStatusRunning = "RUNNING" + RequestStatusFailed = "FAILED" + RequestStatusDone = "DONE" + + Version = "1.1.0" +) + +// APIClient manages communication with the Kafka as a Service API API v1.7.1 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + ClustersApi *ClustersApiService + + TopicsApi *TopicsApiService + + UsersApi *UsersApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + //enable certificate pinning if the env variable is set + pkFingerprint := os.Getenv(IonosPinnedCertEnvVar) + if pkFingerprint != "" { + httpTransport := &http.Transport{} + AddPinnedCert(httpTransport, pkFingerprint) + cfg.HTTPClient.Transport = httpTransport + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.ClustersApi = (*ClustersApiService)(&c.common) + c.TopicsApi = (*TopicsApiService)(&c.common) + c.UsersApi = (*UsersApiService)(&c.common) + + return c +} + +// AddPinnedCert - enables pinning of the sha256 public fingerprint to the http client's transport +func AddPinnedCert(transport *http.Transport, pkFingerprint string) { + if pkFingerprint != "" { + transport.DialTLSContext = addPinnedCertVerification([]byte(pkFingerprint), new(tls.Config)) + } +} + +// TLSDial can be assigned to a http.Transport's DialTLS field. +type TLSDial func(ctx context.Context, network, addr string) (net.Conn, error) + +// addPinnedCertVerification returns a TLSDial function which checks that +// the remote server provides a certificate whose SHA256 fingerprint matches +// the provided value. +// +// The returned dialer function can be plugged into a http.Transport's DialTLS +// field to allow for certificate pinning. +func addPinnedCertVerification(fingerprint []byte, tlsConfig *tls.Config) TLSDial { + return func(ctx context.Context, network, addr string) (net.Conn, error) { + //fingerprints can be added with ':', we need to trim + fingerprint = bytes.ReplaceAll(fingerprint, []byte(":"), []byte("")) + fingerprint = bytes.ReplaceAll(fingerprint, []byte(" "), []byte("")) + //we are manually checking a certificate, so we need to enable insecure + tlsConfig.InsecureSkipVerify = true + + // Dial the connection to get certificates to check + conn, err := tls.Dial(network, addr, tlsConfig) + if err != nil { + return nil, err + } + + if err := verifyPinnedCert(fingerprint, conn.ConnectionState().PeerCertificates); err != nil { + _ = conn.Close() + return nil, err + } + + return conn, nil + } +} + +// verifyPinnedCert iterates the list of peer certificates and attempts to +// locate a certificate that is not a CA and whose public key fingerprint matches pkFingerprint. +func verifyPinnedCert(pkFingerprint []byte, peerCerts []*x509.Certificate) error { + for _, cert := range peerCerts { + fingerprint := sha256.Sum256(cert.Raw) + + var bytesFingerPrint = make([]byte, hex.EncodedLen(len(fingerprint[:]))) + hex.Encode(bytesFingerPrint, fingerprint[:]) + + // we have a match, and it's not an authority certificate + if cert.IsCA == false && bytes.EqualFold(bytesFingerPrint, pkFingerprint) { + return nil + } + } + + return fmt.Errorf("remote server presented a certificate which does not match the provided fingerprint") +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } else if t, ok := obj.(time.Time); ok { + return t.Format(time.RFC3339) + } + + return fmt.Sprintf("%v", obj) +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, time.Duration, error) { + retryCount := 0 + + var resp *http.Response + var httpRequestTime time.Duration + var err error + + for { + + retryCount++ + + /* we need to clone the request with every retry time because Body closes after the request */ + var clonedRequest *http.Request = request.Clone(request.Context()) + if request.Body != nil { + clonedRequest.Body, err = request.GetBody() + if err != nil { + return nil, httpRequestTime, err + } + } + + if c.cfg.Debug || c.cfg.LogLevel.Satisfies(Trace) { + dump, err := httputil.DumpRequestOut(clonedRequest, true) + if err == nil { + c.cfg.Logger.Printf(" DumpRequestOut : %s\n", string(dump)) + } else { + c.cfg.Logger.Printf(" DumpRequestOut err: %+v", err) + } + c.cfg.Logger.Printf("\n try no: %d\n", retryCount) + } + + httpRequestStartTime := time.Now() + clonedRequest.Close = true + resp, err = c.cfg.HTTPClient.Do(clonedRequest) + httpRequestTime = time.Since(httpRequestStartTime) + if err != nil { + return resp, httpRequestTime, err + } + + if c.cfg.Debug || c.cfg.LogLevel.Satisfies(Trace) { + dump, err := httputil.DumpResponse(resp, true) + if err == nil { + c.cfg.Logger.Printf("\n DumpResponse : %s\n", string(dump)) + } else { + c.cfg.Logger.Printf(" DumpResponse err %+v", err) + } + } + + var backoffTime time.Duration + + switch resp.StatusCode { + case http.StatusServiceUnavailable, + http.StatusGatewayTimeout, + http.StatusBadGateway: + if request.Method == http.MethodPost { + return resp, httpRequestTime, err + } + backoffTime = c.GetConfig().WaitTime + + case http.StatusTooManyRequests: + if retryAfterSeconds := resp.Header.Get("Retry-After"); retryAfterSeconds != "" { + waitTime, err := time.ParseDuration(retryAfterSeconds + "s") + if err != nil { + return resp, httpRequestTime, err + } + backoffTime = waitTime + } else { + backoffTime = c.GetConfig().WaitTime + } + default: + return resp, httpRequestTime, err + + } + + if retryCount >= c.GetConfig().MaxRetries { + if c.cfg.Debug || c.cfg.LogLevel.Satisfies(Debug) { + c.cfg.Logger.Printf(" Number of maximum retries exceeded (%d retries)\n", c.cfg.MaxRetries) + } + break + } else { + c.backOff(request.Context(), backoffTime) + } + } + + return resp, httpRequestTime, err +} + +func (c *APIClient) backOff(ctx context.Context, t time.Duration) { + if t > c.GetConfig().MaxWaitTime { + t = c.GetConfig().MaxWaitTime + } + if c.cfg.Debug || c.cfg.LogLevel.Satisfies(Debug) { + c.cfg.Logger.Printf(" Sleeping %s before retrying request\n", t.String()) + } + if t <= 0 { + return + } + + timer := time.NewTimer(t) + defer timer.Stop() + + select { + case <-ctx.Done(): + case <-timer.C: + } +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFileName string, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile(formFileName, filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + /* adding default query params */ + for k, v := range c.cfg.DefaultQueryParams { + if _, ok := queryParams[k]; !ok { + queryParams[k] = v + } + } + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if c.cfg.Token != "" { + localVarRequest.Header.Add("Authorization", "Bearer "+c.cfg.Token) + } else { + if c.cfg.Username != "" { + localVarRequest.SetBasicAuth(c.cfg.Username, c.cfg.Password) + } + } + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type for content %s", contentType) +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + statusCode int + body []byte + error string + model interface{} +} + +// NewGenericOpenAPIError - constructor for GenericOpenAPIError +func NewGenericOpenAPIError(message string, body []byte, model interface{}, statusCode int) *GenericOpenAPIError { + return &GenericOpenAPIError{ + statusCode: statusCode, + body: body, + error: message, + model: model, + } +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// SetError sets the error string +func (e *GenericOpenAPIError) SetError(error string) { + e.error = error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// SetBody sets the raw body of the error +func (e *GenericOpenAPIError) SetBody(body []byte) { + e.body = body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} + +// SetModel sets the model of the error +func (e *GenericOpenAPIError) SetModel(model interface{}) { + e.model = model +} + +// StatusCode returns the status code of the error +func (e GenericOpenAPIError) StatusCode() int { + return e.statusCode +} + +// SetStatusCode sets the status code of the error +func (e *GenericOpenAPIError) SetStatusCode(statusCode int) { + e.statusCode = statusCode +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/configuration.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/configuration.go new file mode 100644 index 000000000..5a97b11b2 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/configuration.go @@ -0,0 +1,328 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "context" + "fmt" + "net/http" + "net/url" + "os" + "strings" + "time" +) + +const ( + IonosUsernameEnvVar = "IONOS_USERNAME" + IonosPasswordEnvVar = "IONOS_PASSWORD" + IonosTokenEnvVar = "IONOS_TOKEN" + IonosApiUrlEnvVar = "IONOS_API_URL" + IonosPinnedCertEnvVar = "IONOS_PINNED_CERT" + IonosLogLevelEnvVar = "IONOS_LOG_LEVEL" + DefaultIonosServerUrl = "https://kafka.de-fra.ionos.com" + DefaultIonosBasePath = "" + defaultMaxRetries = 3 + defaultWaitTime = time.Duration(100) * time.Millisecond + defaultMaxWaitTime = time.Duration(2000) * time.Millisecond +) + +var ( + IonosServerUrls = []string{ + "https://kafka.de-fra.ionos.com", + "https://kafka.de-txl.ionos.com", + "https://kafka.es-vit.ionos.com", + "https://kafka.gb-lhr.ionos.com", + "https://kafka.us-ewr.ionos.com", + "https://kafka.us-las.ionos.com", + "https://kafka.us-mci.ionos.com", + "https://kafka.fr-par.ionos.com", + } +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. + ContextHttpSignatureAuth = contextKey("httpsignature") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + DefaultQueryParams url.Values `json:"defaultQueryParams,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client + LogLevel LogLevel + Logger Logger + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + Token string `json:"token,omitempty"` + MaxRetries int `json:"maxRetries,omitempty"` + WaitTime time.Duration `json:"waitTime,omitempty"` + MaxWaitTime time.Duration `json:"maxWaitTime,omitempty"` +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration(username, password, token, hostUrl string) *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + DefaultQueryParams: url.Values{}, + UserAgent: "ionos-cloud-sdk-go-kafka/v1.1.0", + Debug: false, + Username: username, + Password: password, + Token: token, + MaxRetries: defaultMaxRetries, + MaxWaitTime: defaultMaxWaitTime, + WaitTime: defaultWaitTime, + Logger: NewDefaultLogger(), + LogLevel: getLogLevelFromEnv(), + Servers: ServerConfigurations{ + { + URL: getServerUrl(hostUrl), + Description: "Production de-fra", + }, + { + URL: getServerUrl(hostUrl), + Description: "Production de-txl", + }, + { + URL: getServerUrl(hostUrl), + Description: "Production es-vit", + }, + { + URL: getServerUrl(hostUrl), + Description: "Production gb-lhr", + }, + { + URL: getServerUrl(hostUrl), + Description: "Production us-ewr", + }, + { + URL: getServerUrl(hostUrl), + Description: "Production us-las", + }, + { + URL: getServerUrl(hostUrl), + Description: "Production us-mci", + }, + { + URL: getServerUrl(hostUrl), + Description: "Production fr-par", + }, + }, + OperationServers: map[string]ServerConfigurations{}, + } + return cfg +} + +func NewConfigurationFromEnv() *Configuration { + return NewConfiguration(os.Getenv(IonosUsernameEnvVar), os.Getenv(IonosPasswordEnvVar), os.Getenv(IonosTokenEnvVar), os.Getenv(IonosApiUrlEnvVar)) +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +func (c *Configuration) AddDefaultQueryParam(key string, value string) { + c.DefaultQueryParams[key] = []string{value} +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +func getServerUrl(serverUrl string) string { + if serverUrl == "" { + return DefaultIonosServerUrl + } + // Support both HTTPS & HTTP schemas + if !strings.HasPrefix(serverUrl, "https://") && !strings.HasPrefix(serverUrl, "http://") { + serverUrl = fmt.Sprintf("https://%s", serverUrl) + } + if !strings.HasSuffix(serverUrl, DefaultIonosBasePath) { + serverUrl = fmt.Sprintf("%s%s", serverUrl, DefaultIonosBasePath) + } + return serverUrl +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/logger.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/logger.go new file mode 100644 index 000000000..42707c4db --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/logger.go @@ -0,0 +1,81 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "log" + "os" + "strings" +) + +type LogLevel uint + +func (l *LogLevel) Get() LogLevel { + if l != nil { + return *l + } + return Off +} + +// Satisfies returns true if this LogLevel is at least high enough for v +func (l *LogLevel) Satisfies(v LogLevel) bool { + return l.Get() >= v +} + +const ( + Off LogLevel = 0x100 * iota + Debug + // Trace We recommend you only set this field for debugging purposes. + // Disable it in your production environments because it can log sensitive data. + // It logs the full request and response without encryption, even for an HTTPS call. + // Verbose request and response logging can also significantly impact your application's performance. + Trace +) + +var LogLevelMap = map[string]LogLevel{ + "off": Off, + "debug": Debug, + "trace": Trace, +} + +// getLogLevelFromEnv - gets LogLevel type from env variable IONOS_LOG_LEVEL +// returns Off if an invalid log level is encountered +func getLogLevelFromEnv() LogLevel { + strLogLevel := "off" + if os.Getenv(IonosLogLevelEnvVar) != "" { + strLogLevel = os.Getenv(IonosLogLevelEnvVar) + } + + logLevel, ok := LogLevelMap[strings.ToLower(strLogLevel)] + if !ok { + log.Printf("Cannot set logLevel for value: %s, setting loglevel to Off", strLogLevel) + } + return logLevel +} + +type Logger interface { + Printf(format string, args ...interface{}) +} + +func NewDefaultLogger() Logger { + return &defaultLogger{ + logger: log.New(os.Stderr, "IONOSLOG ", log.LstdFlags), + } +} + +type defaultLogger struct { + logger *log.Logger +} + +func (l defaultLogger) Printf(format string, args ...interface{}) { + l.logger.Printf(format, args...) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster.go new file mode 100644 index 000000000..6655d7773 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster.go @@ -0,0 +1,259 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// Cluster A Kafka cluster that stores data and serve client requests. Kafka clusters typically have multiple brokers to handle more data and provide high availability. Each broker is identified by a unique ID and manages partitions of different topics. +type Cluster struct { + // The name of your Kafka cluster. Must be 63 characters or less and must begin and end with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between. + Name *string `json:"name"` + // The version of Kafka. Currently only Kafka Version 3.7.0 is supported. + Version *string `json:"version"` + // The size of your Kafka cluster. The size of the Kafka cluster is given in T-shirt sizes. Valid values are: XS, S + Size *string `json:"size"` + Connections *[]KafkaClusterConnection `json:"connections"` +} + +// NewCluster instantiates a new Cluster object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCluster(name string, version string, size string, connections []KafkaClusterConnection) *Cluster { + this := Cluster{} + + this.Name = &name + this.Version = &version + this.Size = &size + this.Connections = &connections + + return &this +} + +// NewClusterWithDefaults instantiates a new Cluster object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewClusterWithDefaults() *Cluster { + this := Cluster{} + return &this +} + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Cluster) GetName() *string { + if o == nil { + return nil + } + + return o.Name + +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Cluster) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Name, true +} + +// SetName sets field value +func (o *Cluster) SetName(v string) { + + o.Name = &v + +} + +// HasName returns a boolean if a field has been set. +func (o *Cluster) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// GetVersion returns the Version field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Cluster) GetVersion() *string { + if o == nil { + return nil + } + + return o.Version + +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Cluster) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Version, true +} + +// SetVersion sets field value +func (o *Cluster) SetVersion(v string) { + + o.Version = &v + +} + +// HasVersion returns a boolean if a field has been set. +func (o *Cluster) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// GetSize returns the Size field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Cluster) GetSize() *string { + if o == nil { + return nil + } + + return o.Size + +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Cluster) GetSizeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Size, true +} + +// SetSize sets field value +func (o *Cluster) SetSize(v string) { + + o.Size = &v + +} + +// HasSize returns a boolean if a field has been set. +func (o *Cluster) HasSize() bool { + if o != nil && o.Size != nil { + return true + } + + return false +} + +// GetConnections returns the Connections field value +// If the value is explicit nil, the zero value for []KafkaClusterConnection will be returned +func (o *Cluster) GetConnections() *[]KafkaClusterConnection { + if o == nil { + return nil + } + + return o.Connections + +} + +// GetConnectionsOk returns a tuple with the Connections field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Cluster) GetConnectionsOk() (*[]KafkaClusterConnection, bool) { + if o == nil { + return nil, false + } + + return o.Connections, true +} + +// SetConnections sets field value +func (o *Cluster) SetConnections(v []KafkaClusterConnection) { + + o.Connections = &v + +} + +// HasConnections returns a boolean if a field has been set. +func (o *Cluster) HasConnections() bool { + if o != nil && o.Connections != nil { + return true + } + + return false +} + +func (o Cluster) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + + if o.Version != nil { + toSerialize["version"] = o.Version + } + + if o.Size != nil { + toSerialize["size"] = o.Size + } + + if o.Connections != nil { + toSerialize["connections"] = o.Connections + } + + return json.Marshal(toSerialize) +} + +type NullableCluster struct { + value *Cluster + isSet bool +} + +func (v NullableCluster) Get() *Cluster { + return v.value +} + +func (v *NullableCluster) Set(val *Cluster) { + v.value = val + v.isSet = true +} + +func (v NullableCluster) IsSet() bool { + return v.isSet +} + +func (v *NullableCluster) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCluster(val *Cluster) *NullableCluster { + return &NullableCluster{value: val, isSet: true} +} + +func (v NullableCluster) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCluster) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_create.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_create.go new file mode 100644 index 000000000..9c693bc4e --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_create.go @@ -0,0 +1,168 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// ClusterCreate struct for ClusterCreate +type ClusterCreate struct { + // Metadata + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Properties *Cluster `json:"properties"` +} + +// NewClusterCreate instantiates a new ClusterCreate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewClusterCreate(properties Cluster) *ClusterCreate { + this := ClusterCreate{} + + this.Properties = &properties + + return &this +} + +// NewClusterCreateWithDefaults instantiates a new ClusterCreate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewClusterCreateWithDefaults() *ClusterCreate { + this := ClusterCreate{} + return &this +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for map[string]interface{} will be returned +func (o *ClusterCreate) GetMetadata() *map[string]interface{} { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterCreate) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *ClusterCreate) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *ClusterCreate) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for Cluster will be returned +func (o *ClusterCreate) GetProperties() *Cluster { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterCreate) GetPropertiesOk() (*Cluster, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *ClusterCreate) SetProperties(v Cluster) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *ClusterCreate) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o ClusterCreate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableClusterCreate struct { + value *ClusterCreate + isSet bool +} + +func (v NullableClusterCreate) Get() *ClusterCreate { + return v.value +} + +func (v *NullableClusterCreate) Set(val *ClusterCreate) { + v.value = val + v.isSet = true +} + +func (v NullableClusterCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableClusterCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClusterCreate(val *ClusterCreate) *NullableClusterCreate { + return &NullableClusterCreate{value: val, isSet: true} +} + +func (v NullableClusterCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClusterCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_metadata.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_metadata.go new file mode 100644 index 000000000..8bf6b5d32 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_metadata.go @@ -0,0 +1,536 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" + "time" +) + +// ClusterMetadata struct for ClusterMetadata +type ClusterMetadata struct { + // The ISO 8601 creation timestamp. + CreatedDate *IonosTime `json:"createdDate,omitempty"` + // Unique name of the identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // Unique id of the identity that created the resource. + CreatedByUserId *string `json:"createdByUserId,omitempty"` + // The ISO 8601 modified timestamp. + LastModifiedDate *IonosTime `json:"lastModifiedDate,omitempty"` + // Unique name of the identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // Unique id of the identity that last modified the resource. + LastModifiedByUserId *string `json:"lastModifiedByUserId,omitempty"` + // Unique name of the resource. + ResourceURN *string `json:"resourceURN,omitempty"` + // State of the resource. Resource states: `AVAILABLE`: There are no pending modification requests for this item. `BUSY`: There is at least one modification request pending and all following requests will be queued. `DEPLOYING`: The resource is being created. `FAILED`: The creation of the resource failed. `UPDATING`: The resource is being updated. `FAILED_UPDATING`: An update to the resource was not successful. `DESTROYING`: A delete command was issued, and the resource is being deleted. + State *string `json:"state"` + // A human readable message describing the current state. In case of an error, the message will contain a detailed error message. + Message *string `json:"message,omitempty"` + // IP addresses and ports of cluster brokers. + BrokerAddresses *[]string `json:"brokerAddresses,omitempty"` +} + +// NewClusterMetadata instantiates a new ClusterMetadata object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewClusterMetadata(state string) *ClusterMetadata { + this := ClusterMetadata{} + + this.State = &state + + return &this +} + +// NewClusterMetadataWithDefaults instantiates a new ClusterMetadata object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewClusterMetadataWithDefaults() *ClusterMetadata { + this := ClusterMetadata{} + return &this +} + +// GetCreatedDate returns the CreatedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *ClusterMetadata) GetCreatedDate() *time.Time { + if o == nil { + return nil + } + + if o.CreatedDate == nil { + return nil + } + return &o.CreatedDate.Time + +} + +// GetCreatedDateOk returns a tuple with the CreatedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterMetadata) GetCreatedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + + if o.CreatedDate == nil { + return nil, false + } + return &o.CreatedDate.Time, true + +} + +// SetCreatedDate sets field value +func (o *ClusterMetadata) SetCreatedDate(v time.Time) { + + o.CreatedDate = &IonosTime{v} + +} + +// HasCreatedDate returns a boolean if a field has been set. +func (o *ClusterMetadata) HasCreatedDate() bool { + if o != nil && o.CreatedDate != nil { + return true + } + + return false +} + +// GetCreatedBy returns the CreatedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterMetadata) GetCreatedBy() *string { + if o == nil { + return nil + } + + return o.CreatedBy + +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterMetadata) GetCreatedByOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CreatedBy, true +} + +// SetCreatedBy sets field value +func (o *ClusterMetadata) SetCreatedBy(v string) { + + o.CreatedBy = &v + +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *ClusterMetadata) HasCreatedBy() bool { + if o != nil && o.CreatedBy != nil { + return true + } + + return false +} + +// GetCreatedByUserId returns the CreatedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterMetadata) GetCreatedByUserId() *string { + if o == nil { + return nil + } + + return o.CreatedByUserId + +} + +// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterMetadata) GetCreatedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CreatedByUserId, true +} + +// SetCreatedByUserId sets field value +func (o *ClusterMetadata) SetCreatedByUserId(v string) { + + o.CreatedByUserId = &v + +} + +// HasCreatedByUserId returns a boolean if a field has been set. +func (o *ClusterMetadata) HasCreatedByUserId() bool { + if o != nil && o.CreatedByUserId != nil { + return true + } + + return false +} + +// GetLastModifiedDate returns the LastModifiedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *ClusterMetadata) GetLastModifiedDate() *time.Time { + if o == nil { + return nil + } + + if o.LastModifiedDate == nil { + return nil + } + return &o.LastModifiedDate.Time + +} + +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterMetadata) GetLastModifiedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + + if o.LastModifiedDate == nil { + return nil, false + } + return &o.LastModifiedDate.Time, true + +} + +// SetLastModifiedDate sets field value +func (o *ClusterMetadata) SetLastModifiedDate(v time.Time) { + + o.LastModifiedDate = &IonosTime{v} + +} + +// HasLastModifiedDate returns a boolean if a field has been set. +func (o *ClusterMetadata) HasLastModifiedDate() bool { + if o != nil && o.LastModifiedDate != nil { + return true + } + + return false +} + +// GetLastModifiedBy returns the LastModifiedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterMetadata) GetLastModifiedBy() *string { + if o == nil { + return nil + } + + return o.LastModifiedBy + +} + +// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterMetadata) GetLastModifiedByOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LastModifiedBy, true +} + +// SetLastModifiedBy sets field value +func (o *ClusterMetadata) SetLastModifiedBy(v string) { + + o.LastModifiedBy = &v + +} + +// HasLastModifiedBy returns a boolean if a field has been set. +func (o *ClusterMetadata) HasLastModifiedBy() bool { + if o != nil && o.LastModifiedBy != nil { + return true + } + + return false +} + +// GetLastModifiedByUserId returns the LastModifiedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterMetadata) GetLastModifiedByUserId() *string { + if o == nil { + return nil + } + + return o.LastModifiedByUserId + +} + +// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterMetadata) GetLastModifiedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LastModifiedByUserId, true +} + +// SetLastModifiedByUserId sets field value +func (o *ClusterMetadata) SetLastModifiedByUserId(v string) { + + o.LastModifiedByUserId = &v + +} + +// HasLastModifiedByUserId returns a boolean if a field has been set. +func (o *ClusterMetadata) HasLastModifiedByUserId() bool { + if o != nil && o.LastModifiedByUserId != nil { + return true + } + + return false +} + +// GetResourceURN returns the ResourceURN field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterMetadata) GetResourceURN() *string { + if o == nil { + return nil + } + + return o.ResourceURN + +} + +// GetResourceURNOk returns a tuple with the ResourceURN field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterMetadata) GetResourceURNOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.ResourceURN, true +} + +// SetResourceURN sets field value +func (o *ClusterMetadata) SetResourceURN(v string) { + + o.ResourceURN = &v + +} + +// HasResourceURN returns a boolean if a field has been set. +func (o *ClusterMetadata) HasResourceURN() bool { + if o != nil && o.ResourceURN != nil { + return true + } + + return false +} + +// GetState returns the State field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterMetadata) GetState() *string { + if o == nil { + return nil + } + + return o.State + +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterMetadata) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.State, true +} + +// SetState sets field value +func (o *ClusterMetadata) SetState(v string) { + + o.State = &v + +} + +// HasState returns a boolean if a field has been set. +func (o *ClusterMetadata) HasState() bool { + if o != nil && o.State != nil { + return true + } + + return false +} + +// GetMessage returns the Message field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterMetadata) GetMessage() *string { + if o == nil { + return nil + } + + return o.Message + +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterMetadata) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Message, true +} + +// SetMessage sets field value +func (o *ClusterMetadata) SetMessage(v string) { + + o.Message = &v + +} + +// HasMessage returns a boolean if a field has been set. +func (o *ClusterMetadata) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// GetBrokerAddresses returns the BrokerAddresses field value +// If the value is explicit nil, the zero value for []string will be returned +func (o *ClusterMetadata) GetBrokerAddresses() *[]string { + if o == nil { + return nil + } + + return o.BrokerAddresses + +} + +// GetBrokerAddressesOk returns a tuple with the BrokerAddresses field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterMetadata) GetBrokerAddressesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + + return o.BrokerAddresses, true +} + +// SetBrokerAddresses sets field value +func (o *ClusterMetadata) SetBrokerAddresses(v []string) { + + o.BrokerAddresses = &v + +} + +// HasBrokerAddresses returns a boolean if a field has been set. +func (o *ClusterMetadata) HasBrokerAddresses() bool { + if o != nil && o.BrokerAddresses != nil { + return true + } + + return false +} + +func (o ClusterMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.CreatedDate != nil { + toSerialize["createdDate"] = o.CreatedDate + } + + if o.CreatedBy != nil { + toSerialize["createdBy"] = o.CreatedBy + } + + if o.CreatedByUserId != nil { + toSerialize["createdByUserId"] = o.CreatedByUserId + } + + if o.LastModifiedDate != nil { + toSerialize["lastModifiedDate"] = o.LastModifiedDate + } + + if o.LastModifiedBy != nil { + toSerialize["lastModifiedBy"] = o.LastModifiedBy + } + + if o.LastModifiedByUserId != nil { + toSerialize["lastModifiedByUserId"] = o.LastModifiedByUserId + } + + if o.ResourceURN != nil { + toSerialize["resourceURN"] = o.ResourceURN + } + + if o.State != nil { + toSerialize["state"] = o.State + } + + if o.Message != nil { + toSerialize["message"] = o.Message + } + + if o.BrokerAddresses != nil { + toSerialize["brokerAddresses"] = o.BrokerAddresses + } + + return json.Marshal(toSerialize) +} + +type NullableClusterMetadata struct { + value *ClusterMetadata + isSet bool +} + +func (v NullableClusterMetadata) Get() *ClusterMetadata { + return v.value +} + +func (v *NullableClusterMetadata) Set(val *ClusterMetadata) { + v.value = val + v.isSet = true +} + +func (v NullableClusterMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableClusterMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClusterMetadata(val *ClusterMetadata) *NullableClusterMetadata { + return &NullableClusterMetadata{value: val, isSet: true} +} + +func (v NullableClusterMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClusterMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_metadata_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_metadata_all_of.go new file mode 100644 index 000000000..e50f3481d --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_metadata_all_of.go @@ -0,0 +1,123 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// ClusterMetadataAllOf struct for ClusterMetadataAllOf +type ClusterMetadataAllOf struct { + // IP addresses and ports of cluster brokers. + BrokerAddresses *[]string `json:"brokerAddresses,omitempty"` +} + +// NewClusterMetadataAllOf instantiates a new ClusterMetadataAllOf object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewClusterMetadataAllOf() *ClusterMetadataAllOf { + this := ClusterMetadataAllOf{} + + return &this +} + +// NewClusterMetadataAllOfWithDefaults instantiates a new ClusterMetadataAllOf object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewClusterMetadataAllOfWithDefaults() *ClusterMetadataAllOf { + this := ClusterMetadataAllOf{} + return &this +} + +// GetBrokerAddresses returns the BrokerAddresses field value +// If the value is explicit nil, the zero value for []string will be returned +func (o *ClusterMetadataAllOf) GetBrokerAddresses() *[]string { + if o == nil { + return nil + } + + return o.BrokerAddresses + +} + +// GetBrokerAddressesOk returns a tuple with the BrokerAddresses field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterMetadataAllOf) GetBrokerAddressesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + + return o.BrokerAddresses, true +} + +// SetBrokerAddresses sets field value +func (o *ClusterMetadataAllOf) SetBrokerAddresses(v []string) { + + o.BrokerAddresses = &v + +} + +// HasBrokerAddresses returns a boolean if a field has been set. +func (o *ClusterMetadataAllOf) HasBrokerAddresses() bool { + if o != nil && o.BrokerAddresses != nil { + return true + } + + return false +} + +func (o ClusterMetadataAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.BrokerAddresses != nil { + toSerialize["brokerAddresses"] = o.BrokerAddresses + } + + return json.Marshal(toSerialize) +} + +type NullableClusterMetadataAllOf struct { + value *ClusterMetadataAllOf + isSet bool +} + +func (v NullableClusterMetadataAllOf) Get() *ClusterMetadataAllOf { + return v.value +} + +func (v *NullableClusterMetadataAllOf) Set(val *ClusterMetadataAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableClusterMetadataAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableClusterMetadataAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClusterMetadataAllOf(val *ClusterMetadataAllOf) *NullableClusterMetadataAllOf { + return &NullableClusterMetadataAllOf{value: val, isSet: true} +} + +func (v NullableClusterMetadataAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClusterMetadataAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_read.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_read.go new file mode 100644 index 000000000..e552f555d --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_read.go @@ -0,0 +1,303 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// ClusterRead struct for ClusterRead +type ClusterRead struct { + // The ID (UUID) of the Cluster. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the Cluster. + Href *string `json:"href"` + Metadata *ClusterMetadata `json:"metadata"` + Properties *Cluster `json:"properties"` +} + +// NewClusterRead instantiates a new ClusterRead object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewClusterRead(id string, type_ string, href string, metadata ClusterMetadata, properties Cluster) *ClusterRead { + this := ClusterRead{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Metadata = &metadata + this.Properties = &properties + + return &this +} + +// NewClusterReadWithDefaults instantiates a new ClusterRead object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewClusterReadWithDefaults() *ClusterRead { + this := ClusterRead{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterRead) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterRead) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *ClusterRead) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *ClusterRead) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterRead) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterRead) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *ClusterRead) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *ClusterRead) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterRead) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterRead) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *ClusterRead) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *ClusterRead) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for ClusterMetadata will be returned +func (o *ClusterRead) GetMetadata() *ClusterMetadata { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterRead) GetMetadataOk() (*ClusterMetadata, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *ClusterRead) SetMetadata(v ClusterMetadata) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *ClusterRead) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for Cluster will be returned +func (o *ClusterRead) GetProperties() *Cluster { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterRead) GetPropertiesOk() (*Cluster, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *ClusterRead) SetProperties(v Cluster) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *ClusterRead) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o ClusterRead) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableClusterRead struct { + value *ClusterRead + isSet bool +} + +func (v NullableClusterRead) Get() *ClusterRead { + return v.value +} + +func (v *NullableClusterRead) Set(val *ClusterRead) { + v.value = val + v.isSet = true +} + +func (v NullableClusterRead) IsSet() bool { + return v.isSet +} + +func (v *NullableClusterRead) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClusterRead(val *ClusterRead) *NullableClusterRead { + return &NullableClusterRead{value: val, isSet: true} +} + +func (v NullableClusterRead) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClusterRead) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_read_list.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_read_list.go new file mode 100644 index 000000000..4d44b2f73 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_read_list.go @@ -0,0 +1,259 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// ClusterReadList struct for ClusterReadList +type ClusterReadList struct { + // ID of the list of Cluster resources. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the list of Cluster resources. + Href *string `json:"href"` + // The list of Cluster resources. + Items *[]ClusterRead `json:"items,omitempty"` +} + +// NewClusterReadList instantiates a new ClusterReadList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewClusterReadList(id string, type_ string, href string) *ClusterReadList { + this := ClusterReadList{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + + return &this +} + +// NewClusterReadListWithDefaults instantiates a new ClusterReadList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewClusterReadListWithDefaults() *ClusterReadList { + this := ClusterReadList{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterReadList) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterReadList) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *ClusterReadList) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *ClusterReadList) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterReadList) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterReadList) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *ClusterReadList) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *ClusterReadList) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterReadList) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterReadList) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *ClusterReadList) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *ClusterReadList) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []ClusterRead will be returned +func (o *ClusterReadList) GetItems() *[]ClusterRead { + if o == nil { + return nil + } + + return o.Items + +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterReadList) GetItemsOk() (*[]ClusterRead, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *ClusterReadList) SetItems(v []ClusterRead) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *ClusterReadList) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +func (o ClusterReadList) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableClusterReadList struct { + value *ClusterReadList + isSet bool +} + +func (v NullableClusterReadList) Get() *ClusterReadList { + return v.value +} + +func (v *NullableClusterReadList) Set(val *ClusterReadList) { + v.value = val + v.isSet = true +} + +func (v NullableClusterReadList) IsSet() bool { + return v.isSet +} + +func (v *NullableClusterReadList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClusterReadList(val *ClusterReadList) *NullableClusterReadList { + return &NullableClusterReadList{value: val, isSet: true} +} + +func (v NullableClusterReadList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClusterReadList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_read_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_read_list_all_of.go new file mode 100644 index 000000000..1e79ddd91 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_cluster_read_list_all_of.go @@ -0,0 +1,259 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// ClusterReadListAllOf struct for ClusterReadListAllOf +type ClusterReadListAllOf struct { + // ID of the list of Cluster resources. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the list of Cluster resources. + Href *string `json:"href"` + // The list of Cluster resources. + Items *[]ClusterRead `json:"items,omitempty"` +} + +// NewClusterReadListAllOf instantiates a new ClusterReadListAllOf object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewClusterReadListAllOf(id string, type_ string, href string) *ClusterReadListAllOf { + this := ClusterReadListAllOf{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + + return &this +} + +// NewClusterReadListAllOfWithDefaults instantiates a new ClusterReadListAllOf object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewClusterReadListAllOfWithDefaults() *ClusterReadListAllOf { + this := ClusterReadListAllOf{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterReadListAllOf) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterReadListAllOf) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *ClusterReadListAllOf) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *ClusterReadListAllOf) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterReadListAllOf) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterReadListAllOf) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *ClusterReadListAllOf) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *ClusterReadListAllOf) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ClusterReadListAllOf) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterReadListAllOf) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *ClusterReadListAllOf) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *ClusterReadListAllOf) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []ClusterRead will be returned +func (o *ClusterReadListAllOf) GetItems() *[]ClusterRead { + if o == nil { + return nil + } + + return o.Items + +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ClusterReadListAllOf) GetItemsOk() (*[]ClusterRead, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *ClusterReadListAllOf) SetItems(v []ClusterRead) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *ClusterReadListAllOf) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +func (o ClusterReadListAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableClusterReadListAllOf struct { + value *ClusterReadListAllOf + isSet bool +} + +func (v NullableClusterReadListAllOf) Get() *ClusterReadListAllOf { + return v.value +} + +func (v *NullableClusterReadListAllOf) Set(val *ClusterReadListAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableClusterReadListAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableClusterReadListAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClusterReadListAllOf(val *ClusterReadListAllOf) *NullableClusterReadListAllOf { + return &NullableClusterReadListAllOf{value: val, isSet: true} +} + +func (v NullableClusterReadListAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClusterReadListAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_error.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_error.go new file mode 100644 index 000000000..71be4a25f --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_error.go @@ -0,0 +1,167 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// Error The Error object is used to represent an error response from the API. +type Error struct { + // The HTTP status code of the operation. + HttpStatus *int32 `json:"httpStatus,omitempty"` + // A list of error messages. + Messages *[]ErrorMessages `json:"messages,omitempty"` +} + +// NewError instantiates a new Error object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewError() *Error { + this := Error{} + + return &this +} + +// NewErrorWithDefaults instantiates a new Error object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorWithDefaults() *Error { + this := Error{} + return &this +} + +// GetHttpStatus returns the HttpStatus field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *Error) GetHttpStatus() *int32 { + if o == nil { + return nil + } + + return o.HttpStatus + +} + +// GetHttpStatusOk returns a tuple with the HttpStatus field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Error) GetHttpStatusOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.HttpStatus, true +} + +// SetHttpStatus sets field value +func (o *Error) SetHttpStatus(v int32) { + + o.HttpStatus = &v + +} + +// HasHttpStatus returns a boolean if a field has been set. +func (o *Error) HasHttpStatus() bool { + if o != nil && o.HttpStatus != nil { + return true + } + + return false +} + +// GetMessages returns the Messages field value +// If the value is explicit nil, the zero value for []ErrorMessages will be returned +func (o *Error) GetMessages() *[]ErrorMessages { + if o == nil { + return nil + } + + return o.Messages + +} + +// GetMessagesOk returns a tuple with the Messages field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Error) GetMessagesOk() (*[]ErrorMessages, bool) { + if o == nil { + return nil, false + } + + return o.Messages, true +} + +// SetMessages sets field value +func (o *Error) SetMessages(v []ErrorMessages) { + + o.Messages = &v + +} + +// HasMessages returns a boolean if a field has been set. +func (o *Error) HasMessages() bool { + if o != nil && o.Messages != nil { + return true + } + + return false +} + +func (o Error) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.HttpStatus != nil { + toSerialize["httpStatus"] = o.HttpStatus + } + + if o.Messages != nil { + toSerialize["messages"] = o.Messages + } + + return json.Marshal(toSerialize) +} + +type NullableError struct { + value *Error + isSet bool +} + +func (v NullableError) Get() *Error { + return v.value +} + +func (v *NullableError) Set(val *Error) { + v.value = val + v.isSet = true +} + +func (v NullableError) IsSet() bool { + return v.isSet +} + +func (v *NullableError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableError(val *Error) *NullableError { + return &NullableError{value: val, isSet: true} +} + +func (v NullableError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_error_messages.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_error_messages.go new file mode 100644 index 000000000..75fe3a0ba --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_error_messages.go @@ -0,0 +1,167 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// ErrorMessages struct for ErrorMessages +type ErrorMessages struct { + // Application internal error code + ErrorCode *string `json:"errorCode,omitempty"` + // A human readable explanation specific to this occurrence of the problem. + Message *string `json:"message,omitempty"` +} + +// NewErrorMessages instantiates a new ErrorMessages object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewErrorMessages() *ErrorMessages { + this := ErrorMessages{} + + return &this +} + +// NewErrorMessagesWithDefaults instantiates a new ErrorMessages object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorMessagesWithDefaults() *ErrorMessages { + this := ErrorMessages{} + return &this +} + +// GetErrorCode returns the ErrorCode field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ErrorMessages) GetErrorCode() *string { + if o == nil { + return nil + } + + return o.ErrorCode + +} + +// GetErrorCodeOk returns a tuple with the ErrorCode field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ErrorMessages) GetErrorCodeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.ErrorCode, true +} + +// SetErrorCode sets field value +func (o *ErrorMessages) SetErrorCode(v string) { + + o.ErrorCode = &v + +} + +// HasErrorCode returns a boolean if a field has been set. +func (o *ErrorMessages) HasErrorCode() bool { + if o != nil && o.ErrorCode != nil { + return true + } + + return false +} + +// GetMessage returns the Message field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ErrorMessages) GetMessage() *string { + if o == nil { + return nil + } + + return o.Message + +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ErrorMessages) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Message, true +} + +// SetMessage sets field value +func (o *ErrorMessages) SetMessage(v string) { + + o.Message = &v + +} + +// HasMessage returns a boolean if a field has been set. +func (o *ErrorMessages) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +func (o ErrorMessages) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ErrorCode != nil { + toSerialize["errorCode"] = o.ErrorCode + } + + if o.Message != nil { + toSerialize["message"] = o.Message + } + + return json.Marshal(toSerialize) +} + +type NullableErrorMessages struct { + value *ErrorMessages + isSet bool +} + +func (v NullableErrorMessages) Get() *ErrorMessages { + return v.value +} + +func (v *NullableErrorMessages) Set(val *ErrorMessages) { + v.value = val + v.isSet = true +} + +func (v NullableErrorMessages) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorMessages) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorMessages(val *ErrorMessages) *NullableErrorMessages { + return &NullableErrorMessages{value: val, isSet: true} +} + +func (v NullableErrorMessages) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorMessages) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_kafka_cluster_connection.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_kafka_cluster_connection.go new file mode 100644 index 000000000..b452d129f --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_kafka_cluster_connection.go @@ -0,0 +1,215 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// KafkaClusterConnection Connection information of the Kafka cluster. +type KafkaClusterConnection struct { + // The datacenter to connect your instance to. + DatacenterId *string `json:"datacenterId"` + // The numeric LAN ID to connect your instance to. + LanId *string `json:"lanId"` + // IP addresses and subnet of cluster brokers. Note the following unavailable IP range: 10.224.0.0/11 + BrokerAddresses *[]string `json:"brokerAddresses"` +} + +// NewKafkaClusterConnection instantiates a new KafkaClusterConnection object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewKafkaClusterConnection(datacenterId string, lanId string, brokerAddresses []string) *KafkaClusterConnection { + this := KafkaClusterConnection{} + + this.DatacenterId = &datacenterId + this.LanId = &lanId + this.BrokerAddresses = &brokerAddresses + + return &this +} + +// NewKafkaClusterConnectionWithDefaults instantiates a new KafkaClusterConnection object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewKafkaClusterConnectionWithDefaults() *KafkaClusterConnection { + this := KafkaClusterConnection{} + return &this +} + +// GetDatacenterId returns the DatacenterId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KafkaClusterConnection) GetDatacenterId() *string { + if o == nil { + return nil + } + + return o.DatacenterId + +} + +// GetDatacenterIdOk returns a tuple with the DatacenterId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KafkaClusterConnection) GetDatacenterIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.DatacenterId, true +} + +// SetDatacenterId sets field value +func (o *KafkaClusterConnection) SetDatacenterId(v string) { + + o.DatacenterId = &v + +} + +// HasDatacenterId returns a boolean if a field has been set. +func (o *KafkaClusterConnection) HasDatacenterId() bool { + if o != nil && o.DatacenterId != nil { + return true + } + + return false +} + +// GetLanId returns the LanId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KafkaClusterConnection) GetLanId() *string { + if o == nil { + return nil + } + + return o.LanId + +} + +// GetLanIdOk returns a tuple with the LanId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KafkaClusterConnection) GetLanIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LanId, true +} + +// SetLanId sets field value +func (o *KafkaClusterConnection) SetLanId(v string) { + + o.LanId = &v + +} + +// HasLanId returns a boolean if a field has been set. +func (o *KafkaClusterConnection) HasLanId() bool { + if o != nil && o.LanId != nil { + return true + } + + return false +} + +// GetBrokerAddresses returns the BrokerAddresses field value +// If the value is explicit nil, the zero value for []string will be returned +func (o *KafkaClusterConnection) GetBrokerAddresses() *[]string { + if o == nil { + return nil + } + + return o.BrokerAddresses + +} + +// GetBrokerAddressesOk returns a tuple with the BrokerAddresses field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KafkaClusterConnection) GetBrokerAddressesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + + return o.BrokerAddresses, true +} + +// SetBrokerAddresses sets field value +func (o *KafkaClusterConnection) SetBrokerAddresses(v []string) { + + o.BrokerAddresses = &v + +} + +// HasBrokerAddresses returns a boolean if a field has been set. +func (o *KafkaClusterConnection) HasBrokerAddresses() bool { + if o != nil && o.BrokerAddresses != nil { + return true + } + + return false +} + +func (o KafkaClusterConnection) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.DatacenterId != nil { + toSerialize["datacenterId"] = o.DatacenterId + } + + if o.LanId != nil { + toSerialize["lanId"] = o.LanId + } + + if o.BrokerAddresses != nil { + toSerialize["brokerAddresses"] = o.BrokerAddresses + } + + return json.Marshal(toSerialize) +} + +type NullableKafkaClusterConnection struct { + value *KafkaClusterConnection + isSet bool +} + +func (v NullableKafkaClusterConnection) Get() *KafkaClusterConnection { + return v.value +} + +func (v *NullableKafkaClusterConnection) Set(val *KafkaClusterConnection) { + v.value = val + v.isSet = true +} + +func (v NullableKafkaClusterConnection) IsSet() bool { + return v.isSet +} + +func (v *NullableKafkaClusterConnection) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKafkaClusterConnection(val *KafkaClusterConnection) *NullableKafkaClusterConnection { + return &NullableKafkaClusterConnection{value: val, isSet: true} +} + +func (v NullableKafkaClusterConnection) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKafkaClusterConnection) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_links.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_links.go new file mode 100644 index 000000000..a445ed2f5 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_links.go @@ -0,0 +1,211 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// Links URLs to navigate the different pages. As of now we always only return a single page. +type Links struct { + // URL (with offset and limit parameters) of the previous page; only present if offset is greater than 0. + Prev *string `json:"prev,omitempty"` + // URL (with offset and limit parameters) of the current page. + Self *string `json:"self,omitempty"` + // URL (with offset and limit parameters) of the next page; only present if offset + limit is less than the total number of elements. + Next *string `json:"next,omitempty"` +} + +// NewLinks instantiates a new Links object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewLinks() *Links { + this := Links{} + + return &this +} + +// NewLinksWithDefaults instantiates a new Links object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewLinksWithDefaults() *Links { + this := Links{} + return &this +} + +// GetPrev returns the Prev field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Links) GetPrev() *string { + if o == nil { + return nil + } + + return o.Prev + +} + +// GetPrevOk returns a tuple with the Prev field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Links) GetPrevOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Prev, true +} + +// SetPrev sets field value +func (o *Links) SetPrev(v string) { + + o.Prev = &v + +} + +// HasPrev returns a boolean if a field has been set. +func (o *Links) HasPrev() bool { + if o != nil && o.Prev != nil { + return true + } + + return false +} + +// GetSelf returns the Self field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Links) GetSelf() *string { + if o == nil { + return nil + } + + return o.Self + +} + +// GetSelfOk returns a tuple with the Self field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Links) GetSelfOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Self, true +} + +// SetSelf sets field value +func (o *Links) SetSelf(v string) { + + o.Self = &v + +} + +// HasSelf returns a boolean if a field has been set. +func (o *Links) HasSelf() bool { + if o != nil && o.Self != nil { + return true + } + + return false +} + +// GetNext returns the Next field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Links) GetNext() *string { + if o == nil { + return nil + } + + return o.Next + +} + +// GetNextOk returns a tuple with the Next field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Links) GetNextOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Next, true +} + +// SetNext sets field value +func (o *Links) SetNext(v string) { + + o.Next = &v + +} + +// HasNext returns a boolean if a field has been set. +func (o *Links) HasNext() bool { + if o != nil && o.Next != nil { + return true + } + + return false +} + +func (o Links) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Prev != nil { + toSerialize["prev"] = o.Prev + } + + if o.Self != nil { + toSerialize["self"] = o.Self + } + + if o.Next != nil { + toSerialize["next"] = o.Next + } + + return json.Marshal(toSerialize) +} + +type NullableLinks struct { + value *Links + isSet bool +} + +func (v NullableLinks) Get() *Links { + return v.value +} + +func (v *NullableLinks) Set(val *Links) { + v.value = val + v.isSet = true +} + +func (v NullableLinks) IsSet() bool { + return v.isSet +} + +func (v *NullableLinks) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLinks(val *Links) *NullableLinks { + return &NullableLinks{value: val, isSet: true} +} + +func (v NullableLinks) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLinks) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_metadata.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_metadata.go new file mode 100644 index 000000000..04fe7163e --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_metadata.go @@ -0,0 +1,402 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" + "time" +) + +// Metadata Metadata of the resource. +type Metadata struct { + // The ISO 8601 creation timestamp. + CreatedDate *IonosTime `json:"createdDate,omitempty"` + // Unique name of the identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // Unique id of the identity that created the resource. + CreatedByUserId *string `json:"createdByUserId,omitempty"` + // The ISO 8601 modified timestamp. + LastModifiedDate *IonosTime `json:"lastModifiedDate,omitempty"` + // Unique name of the identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // Unique id of the identity that last modified the resource. + LastModifiedByUserId *string `json:"lastModifiedByUserId,omitempty"` + // Unique name of the resource. + ResourceURN *string `json:"resourceURN,omitempty"` +} + +// NewMetadata instantiates a new Metadata object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetadata() *Metadata { + this := Metadata{} + + return &this +} + +// NewMetadataWithDefaults instantiates a new Metadata object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetadataWithDefaults() *Metadata { + this := Metadata{} + return &this +} + +// GetCreatedDate returns the CreatedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *Metadata) GetCreatedDate() *time.Time { + if o == nil { + return nil + } + + if o.CreatedDate == nil { + return nil + } + return &o.CreatedDate.Time + +} + +// GetCreatedDateOk returns a tuple with the CreatedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Metadata) GetCreatedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + + if o.CreatedDate == nil { + return nil, false + } + return &o.CreatedDate.Time, true + +} + +// SetCreatedDate sets field value +func (o *Metadata) SetCreatedDate(v time.Time) { + + o.CreatedDate = &IonosTime{v} + +} + +// HasCreatedDate returns a boolean if a field has been set. +func (o *Metadata) HasCreatedDate() bool { + if o != nil && o.CreatedDate != nil { + return true + } + + return false +} + +// GetCreatedBy returns the CreatedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Metadata) GetCreatedBy() *string { + if o == nil { + return nil + } + + return o.CreatedBy + +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Metadata) GetCreatedByOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CreatedBy, true +} + +// SetCreatedBy sets field value +func (o *Metadata) SetCreatedBy(v string) { + + o.CreatedBy = &v + +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *Metadata) HasCreatedBy() bool { + if o != nil && o.CreatedBy != nil { + return true + } + + return false +} + +// GetCreatedByUserId returns the CreatedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Metadata) GetCreatedByUserId() *string { + if o == nil { + return nil + } + + return o.CreatedByUserId + +} + +// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Metadata) GetCreatedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CreatedByUserId, true +} + +// SetCreatedByUserId sets field value +func (o *Metadata) SetCreatedByUserId(v string) { + + o.CreatedByUserId = &v + +} + +// HasCreatedByUserId returns a boolean if a field has been set. +func (o *Metadata) HasCreatedByUserId() bool { + if o != nil && o.CreatedByUserId != nil { + return true + } + + return false +} + +// GetLastModifiedDate returns the LastModifiedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *Metadata) GetLastModifiedDate() *time.Time { + if o == nil { + return nil + } + + if o.LastModifiedDate == nil { + return nil + } + return &o.LastModifiedDate.Time + +} + +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Metadata) GetLastModifiedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + + if o.LastModifiedDate == nil { + return nil, false + } + return &o.LastModifiedDate.Time, true + +} + +// SetLastModifiedDate sets field value +func (o *Metadata) SetLastModifiedDate(v time.Time) { + + o.LastModifiedDate = &IonosTime{v} + +} + +// HasLastModifiedDate returns a boolean if a field has been set. +func (o *Metadata) HasLastModifiedDate() bool { + if o != nil && o.LastModifiedDate != nil { + return true + } + + return false +} + +// GetLastModifiedBy returns the LastModifiedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Metadata) GetLastModifiedBy() *string { + if o == nil { + return nil + } + + return o.LastModifiedBy + +} + +// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Metadata) GetLastModifiedByOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LastModifiedBy, true +} + +// SetLastModifiedBy sets field value +func (o *Metadata) SetLastModifiedBy(v string) { + + o.LastModifiedBy = &v + +} + +// HasLastModifiedBy returns a boolean if a field has been set. +func (o *Metadata) HasLastModifiedBy() bool { + if o != nil && o.LastModifiedBy != nil { + return true + } + + return false +} + +// GetLastModifiedByUserId returns the LastModifiedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Metadata) GetLastModifiedByUserId() *string { + if o == nil { + return nil + } + + return o.LastModifiedByUserId + +} + +// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Metadata) GetLastModifiedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LastModifiedByUserId, true +} + +// SetLastModifiedByUserId sets field value +func (o *Metadata) SetLastModifiedByUserId(v string) { + + o.LastModifiedByUserId = &v + +} + +// HasLastModifiedByUserId returns a boolean if a field has been set. +func (o *Metadata) HasLastModifiedByUserId() bool { + if o != nil && o.LastModifiedByUserId != nil { + return true + } + + return false +} + +// GetResourceURN returns the ResourceURN field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Metadata) GetResourceURN() *string { + if o == nil { + return nil + } + + return o.ResourceURN + +} + +// GetResourceURNOk returns a tuple with the ResourceURN field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Metadata) GetResourceURNOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.ResourceURN, true +} + +// SetResourceURN sets field value +func (o *Metadata) SetResourceURN(v string) { + + o.ResourceURN = &v + +} + +// HasResourceURN returns a boolean if a field has been set. +func (o *Metadata) HasResourceURN() bool { + if o != nil && o.ResourceURN != nil { + return true + } + + return false +} + +func (o Metadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.CreatedDate != nil { + toSerialize["createdDate"] = o.CreatedDate + } + + if o.CreatedBy != nil { + toSerialize["createdBy"] = o.CreatedBy + } + + if o.CreatedByUserId != nil { + toSerialize["createdByUserId"] = o.CreatedByUserId + } + + if o.LastModifiedDate != nil { + toSerialize["lastModifiedDate"] = o.LastModifiedDate + } + + if o.LastModifiedBy != nil { + toSerialize["lastModifiedBy"] = o.LastModifiedBy + } + + if o.LastModifiedByUserId != nil { + toSerialize["lastModifiedByUserId"] = o.LastModifiedByUserId + } + + if o.ResourceURN != nil { + toSerialize["resourceURN"] = o.ResourceURN + } + + return json.Marshal(toSerialize) +} + +type NullableMetadata struct { + value *Metadata + isSet bool +} + +func (v NullableMetadata) Get() *Metadata { + return v.value +} + +func (v *NullableMetadata) Set(val *Metadata) { + v.value = val + v.isSet = true +} + +func (v NullableMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadata(val *Metadata) *NullableMetadata { + return &NullableMetadata{value: val, isSet: true} +} + +func (v NullableMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_pagination.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_pagination.go new file mode 100644 index 000000000..e879b7cc0 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_pagination.go @@ -0,0 +1,214 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// Pagination Pagination information. The offset and limit parameters are used to navigate the list of elements. The _links object contains URLs to navigate the different pages. +type Pagination struct { + // The offset specified in the request (if none was specified, the default offset is 0). + Offset *int32 `json:"offset"` + // The limit specified in the request (if none was specified, use the endpoint's default pagination limit). + Limit *int32 `json:"limit"` + Links *Links `json:"_links"` +} + +// NewPagination instantiates a new Pagination object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPagination(offset int32, limit int32, links Links) *Pagination { + this := Pagination{} + + this.Offset = &offset + this.Limit = &limit + this.Links = &links + + return &this +} + +// NewPaginationWithDefaults instantiates a new Pagination object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPaginationWithDefaults() *Pagination { + this := Pagination{} + return &this +} + +// GetOffset returns the Offset field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *Pagination) GetOffset() *int32 { + if o == nil { + return nil + } + + return o.Offset + +} + +// GetOffsetOk returns a tuple with the Offset field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Pagination) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Offset, true +} + +// SetOffset sets field value +func (o *Pagination) SetOffset(v int32) { + + o.Offset = &v + +} + +// HasOffset returns a boolean if a field has been set. +func (o *Pagination) HasOffset() bool { + if o != nil && o.Offset != nil { + return true + } + + return false +} + +// GetLimit returns the Limit field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *Pagination) GetLimit() *int32 { + if o == nil { + return nil + } + + return o.Limit + +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Pagination) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Limit, true +} + +// SetLimit sets field value +func (o *Pagination) SetLimit(v int32) { + + o.Limit = &v + +} + +// HasLimit returns a boolean if a field has been set. +func (o *Pagination) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// GetLinks returns the Links field value +// If the value is explicit nil, the zero value for Links will be returned +func (o *Pagination) GetLinks() *Links { + if o == nil { + return nil + } + + return o.Links + +} + +// GetLinksOk returns a tuple with the Links field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Pagination) GetLinksOk() (*Links, bool) { + if o == nil { + return nil, false + } + + return o.Links, true +} + +// SetLinks sets field value +func (o *Pagination) SetLinks(v Links) { + + o.Links = &v + +} + +// HasLinks returns a boolean if a field has been set. +func (o *Pagination) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +func (o Pagination) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Offset != nil { + toSerialize["offset"] = o.Offset + } + + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + + if o.Links != nil { + toSerialize["_links"] = o.Links + } + + return json.Marshal(toSerialize) +} + +type NullablePagination struct { + value *Pagination + isSet bool +} + +func (v NullablePagination) Get() *Pagination { + return v.value +} + +func (v *NullablePagination) Set(val *Pagination) { + v.value = val + v.isSet = true +} + +func (v NullablePagination) IsSet() bool { + return v.isSet +} + +func (v *NullablePagination) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePagination(val *Pagination) *NullablePagination { + return &NullablePagination{value: val, isSet: true} +} + +func (v NullablePagination) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePagination) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_resource_metadata.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_resource_metadata.go new file mode 100644 index 000000000..954a27187 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_resource_metadata.go @@ -0,0 +1,492 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" + "time" +) + +// ResourceMetadata struct for ResourceMetadata +type ResourceMetadata struct { + // The ISO 8601 creation timestamp. + CreatedDate *IonosTime `json:"createdDate,omitempty"` + // Unique name of the identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // Unique id of the identity that created the resource. + CreatedByUserId *string `json:"createdByUserId,omitempty"` + // The ISO 8601 modified timestamp. + LastModifiedDate *IonosTime `json:"lastModifiedDate,omitempty"` + // Unique name of the identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // Unique id of the identity that last modified the resource. + LastModifiedByUserId *string `json:"lastModifiedByUserId,omitempty"` + // Unique name of the resource. + ResourceURN *string `json:"resourceURN,omitempty"` + // State of the resource. Resource states: `AVAILABLE`: There are no pending modification requests for this item. `BUSY`: There is at least one modification request pending and all following requests will be queued. `DEPLOYING`: The resource is being created. `FAILED`: The creation of the resource failed. `UPDATING`: The resource is being updated. `FAILED_UPDATING`: An update to the resource was not successful. `DESTROYING`: A delete command was issued, and the resource is being deleted. + State *string `json:"state"` + // A human readable message describing the current state. In case of an error, the message will contain a detailed error message. + Message *string `json:"message,omitempty"` +} + +// NewResourceMetadata instantiates a new ResourceMetadata object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewResourceMetadata(state string) *ResourceMetadata { + this := ResourceMetadata{} + + this.State = &state + + return &this +} + +// NewResourceMetadataWithDefaults instantiates a new ResourceMetadata object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewResourceMetadataWithDefaults() *ResourceMetadata { + this := ResourceMetadata{} + return &this +} + +// GetCreatedDate returns the CreatedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *ResourceMetadata) GetCreatedDate() *time.Time { + if o == nil { + return nil + } + + if o.CreatedDate == nil { + return nil + } + return &o.CreatedDate.Time + +} + +// GetCreatedDateOk returns a tuple with the CreatedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceMetadata) GetCreatedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + + if o.CreatedDate == nil { + return nil, false + } + return &o.CreatedDate.Time, true + +} + +// SetCreatedDate sets field value +func (o *ResourceMetadata) SetCreatedDate(v time.Time) { + + o.CreatedDate = &IonosTime{v} + +} + +// HasCreatedDate returns a boolean if a field has been set. +func (o *ResourceMetadata) HasCreatedDate() bool { + if o != nil && o.CreatedDate != nil { + return true + } + + return false +} + +// GetCreatedBy returns the CreatedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourceMetadata) GetCreatedBy() *string { + if o == nil { + return nil + } + + return o.CreatedBy + +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceMetadata) GetCreatedByOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CreatedBy, true +} + +// SetCreatedBy sets field value +func (o *ResourceMetadata) SetCreatedBy(v string) { + + o.CreatedBy = &v + +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *ResourceMetadata) HasCreatedBy() bool { + if o != nil && o.CreatedBy != nil { + return true + } + + return false +} + +// GetCreatedByUserId returns the CreatedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourceMetadata) GetCreatedByUserId() *string { + if o == nil { + return nil + } + + return o.CreatedByUserId + +} + +// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceMetadata) GetCreatedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CreatedByUserId, true +} + +// SetCreatedByUserId sets field value +func (o *ResourceMetadata) SetCreatedByUserId(v string) { + + o.CreatedByUserId = &v + +} + +// HasCreatedByUserId returns a boolean if a field has been set. +func (o *ResourceMetadata) HasCreatedByUserId() bool { + if o != nil && o.CreatedByUserId != nil { + return true + } + + return false +} + +// GetLastModifiedDate returns the LastModifiedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *ResourceMetadata) GetLastModifiedDate() *time.Time { + if o == nil { + return nil + } + + if o.LastModifiedDate == nil { + return nil + } + return &o.LastModifiedDate.Time + +} + +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceMetadata) GetLastModifiedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + + if o.LastModifiedDate == nil { + return nil, false + } + return &o.LastModifiedDate.Time, true + +} + +// SetLastModifiedDate sets field value +func (o *ResourceMetadata) SetLastModifiedDate(v time.Time) { + + o.LastModifiedDate = &IonosTime{v} + +} + +// HasLastModifiedDate returns a boolean if a field has been set. +func (o *ResourceMetadata) HasLastModifiedDate() bool { + if o != nil && o.LastModifiedDate != nil { + return true + } + + return false +} + +// GetLastModifiedBy returns the LastModifiedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourceMetadata) GetLastModifiedBy() *string { + if o == nil { + return nil + } + + return o.LastModifiedBy + +} + +// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceMetadata) GetLastModifiedByOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LastModifiedBy, true +} + +// SetLastModifiedBy sets field value +func (o *ResourceMetadata) SetLastModifiedBy(v string) { + + o.LastModifiedBy = &v + +} + +// HasLastModifiedBy returns a boolean if a field has been set. +func (o *ResourceMetadata) HasLastModifiedBy() bool { + if o != nil && o.LastModifiedBy != nil { + return true + } + + return false +} + +// GetLastModifiedByUserId returns the LastModifiedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourceMetadata) GetLastModifiedByUserId() *string { + if o == nil { + return nil + } + + return o.LastModifiedByUserId + +} + +// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceMetadata) GetLastModifiedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LastModifiedByUserId, true +} + +// SetLastModifiedByUserId sets field value +func (o *ResourceMetadata) SetLastModifiedByUserId(v string) { + + o.LastModifiedByUserId = &v + +} + +// HasLastModifiedByUserId returns a boolean if a field has been set. +func (o *ResourceMetadata) HasLastModifiedByUserId() bool { + if o != nil && o.LastModifiedByUserId != nil { + return true + } + + return false +} + +// GetResourceURN returns the ResourceURN field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourceMetadata) GetResourceURN() *string { + if o == nil { + return nil + } + + return o.ResourceURN + +} + +// GetResourceURNOk returns a tuple with the ResourceURN field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceMetadata) GetResourceURNOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.ResourceURN, true +} + +// SetResourceURN sets field value +func (o *ResourceMetadata) SetResourceURN(v string) { + + o.ResourceURN = &v + +} + +// HasResourceURN returns a boolean if a field has been set. +func (o *ResourceMetadata) HasResourceURN() bool { + if o != nil && o.ResourceURN != nil { + return true + } + + return false +} + +// GetState returns the State field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourceMetadata) GetState() *string { + if o == nil { + return nil + } + + return o.State + +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceMetadata) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.State, true +} + +// SetState sets field value +func (o *ResourceMetadata) SetState(v string) { + + o.State = &v + +} + +// HasState returns a boolean if a field has been set. +func (o *ResourceMetadata) HasState() bool { + if o != nil && o.State != nil { + return true + } + + return false +} + +// GetMessage returns the Message field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourceMetadata) GetMessage() *string { + if o == nil { + return nil + } + + return o.Message + +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceMetadata) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Message, true +} + +// SetMessage sets field value +func (o *ResourceMetadata) SetMessage(v string) { + + o.Message = &v + +} + +// HasMessage returns a boolean if a field has been set. +func (o *ResourceMetadata) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +func (o ResourceMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.CreatedDate != nil { + toSerialize["createdDate"] = o.CreatedDate + } + + if o.CreatedBy != nil { + toSerialize["createdBy"] = o.CreatedBy + } + + if o.CreatedByUserId != nil { + toSerialize["createdByUserId"] = o.CreatedByUserId + } + + if o.LastModifiedDate != nil { + toSerialize["lastModifiedDate"] = o.LastModifiedDate + } + + if o.LastModifiedBy != nil { + toSerialize["lastModifiedBy"] = o.LastModifiedBy + } + + if o.LastModifiedByUserId != nil { + toSerialize["lastModifiedByUserId"] = o.LastModifiedByUserId + } + + if o.ResourceURN != nil { + toSerialize["resourceURN"] = o.ResourceURN + } + + if o.State != nil { + toSerialize["state"] = o.State + } + + if o.Message != nil { + toSerialize["message"] = o.Message + } + + return json.Marshal(toSerialize) +} + +type NullableResourceMetadata struct { + value *ResourceMetadata + isSet bool +} + +func (v NullableResourceMetadata) Get() *ResourceMetadata { + return v.value +} + +func (v *NullableResourceMetadata) Set(val *ResourceMetadata) { + v.value = val + v.isSet = true +} + +func (v NullableResourceMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableResourceMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResourceMetadata(val *ResourceMetadata) *NullableResourceMetadata { + return &NullableResourceMetadata{value: val, isSet: true} +} + +func (v NullableResourceMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResourceMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_resource_state.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_resource_state.go new file mode 100644 index 000000000..19c6d2512 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_resource_state.go @@ -0,0 +1,169 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// ResourceState The current status of the resource. +type ResourceState struct { + // State of the resource. Resource states: `AVAILABLE`: There are no pending modification requests for this item. `BUSY`: There is at least one modification request pending and all following requests will be queued. `DEPLOYING`: The resource is being created. `FAILED`: The creation of the resource failed. `UPDATING`: The resource is being updated. `FAILED_UPDATING`: An update to the resource was not successful. `DESTROYING`: A delete command was issued, and the resource is being deleted. + State *string `json:"state"` + // A human readable message describing the current state. In case of an error, the message will contain a detailed error message. + Message *string `json:"message,omitempty"` +} + +// NewResourceState instantiates a new ResourceState object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewResourceState(state string) *ResourceState { + this := ResourceState{} + + this.State = &state + + return &this +} + +// NewResourceStateWithDefaults instantiates a new ResourceState object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewResourceStateWithDefaults() *ResourceState { + this := ResourceState{} + return &this +} + +// GetState returns the State field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourceState) GetState() *string { + if o == nil { + return nil + } + + return o.State + +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceState) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.State, true +} + +// SetState sets field value +func (o *ResourceState) SetState(v string) { + + o.State = &v + +} + +// HasState returns a boolean if a field has been set. +func (o *ResourceState) HasState() bool { + if o != nil && o.State != nil { + return true + } + + return false +} + +// GetMessage returns the Message field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourceState) GetMessage() *string { + if o == nil { + return nil + } + + return o.Message + +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceState) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Message, true +} + +// SetMessage sets field value +func (o *ResourceState) SetMessage(v string) { + + o.Message = &v + +} + +// HasMessage returns a boolean if a field has been set. +func (o *ResourceState) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +func (o ResourceState) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.State != nil { + toSerialize["state"] = o.State + } + + if o.Message != nil { + toSerialize["message"] = o.Message + } + + return json.Marshal(toSerialize) +} + +type NullableResourceState struct { + value *ResourceState + isSet bool +} + +func (v NullableResourceState) Get() *ResourceState { + return v.value +} + +func (v *NullableResourceState) Set(val *ResourceState) { + v.value = val + v.isSet = true +} + +func (v NullableResourceState) IsSet() bool { + return v.isSet +} + +func (v *NullableResourceState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResourceState(val *ResourceState) *NullableResourceState { + return &NullableResourceState{value: val, isSet: true} +} + +func (v NullableResourceState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResourceState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic.go new file mode 100644 index 000000000..503348593 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic.go @@ -0,0 +1,264 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// Topic A topic is a category or feed name to which records are published. Topics are the way Kafka organizes messages. They act as logical channels for data streams. Topics are split into partitions, making them scalable and allowing parallelism. +type Topic struct { + // The name of the Kafka cluster topic. Must be 63 characters or less and must begin and end with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between. + Name *string `json:"name"` + // The number of replicas of the topic. The replication factor determines how many copies of the topic are stored on different brokers. The replication factor must be less than or equal to the number of brokers in the Kafka cluster. + ReplicationFactor *int32 `json:"replicationFactor,omitempty"` + // The number of partitions of the topic. Partitions allow for parallel processing of messages. + NumberOfPartitions *int32 `json:"numberOfPartitions,omitempty"` + LogRetention *TopicLogRetention `json:"logRetention,omitempty"` +} + +// NewTopic instantiates a new Topic object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTopic(name string) *Topic { + this := Topic{} + + this.Name = &name + var replicationFactor int32 = 3 + this.ReplicationFactor = &replicationFactor + var numberOfPartitions int32 = 3 + this.NumberOfPartitions = &numberOfPartitions + + return &this +} + +// NewTopicWithDefaults instantiates a new Topic object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTopicWithDefaults() *Topic { + this := Topic{} + var replicationFactor int32 = 3 + this.ReplicationFactor = &replicationFactor + var numberOfPartitions int32 = 3 + this.NumberOfPartitions = &numberOfPartitions + return &this +} + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Topic) GetName() *string { + if o == nil { + return nil + } + + return o.Name + +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Topic) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Name, true +} + +// SetName sets field value +func (o *Topic) SetName(v string) { + + o.Name = &v + +} + +// HasName returns a boolean if a field has been set. +func (o *Topic) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// GetReplicationFactor returns the ReplicationFactor field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *Topic) GetReplicationFactor() *int32 { + if o == nil { + return nil + } + + return o.ReplicationFactor + +} + +// GetReplicationFactorOk returns a tuple with the ReplicationFactor field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Topic) GetReplicationFactorOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.ReplicationFactor, true +} + +// SetReplicationFactor sets field value +func (o *Topic) SetReplicationFactor(v int32) { + + o.ReplicationFactor = &v + +} + +// HasReplicationFactor returns a boolean if a field has been set. +func (o *Topic) HasReplicationFactor() bool { + if o != nil && o.ReplicationFactor != nil { + return true + } + + return false +} + +// GetNumberOfPartitions returns the NumberOfPartitions field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *Topic) GetNumberOfPartitions() *int32 { + if o == nil { + return nil + } + + return o.NumberOfPartitions + +} + +// GetNumberOfPartitionsOk returns a tuple with the NumberOfPartitions field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Topic) GetNumberOfPartitionsOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.NumberOfPartitions, true +} + +// SetNumberOfPartitions sets field value +func (o *Topic) SetNumberOfPartitions(v int32) { + + o.NumberOfPartitions = &v + +} + +// HasNumberOfPartitions returns a boolean if a field has been set. +func (o *Topic) HasNumberOfPartitions() bool { + if o != nil && o.NumberOfPartitions != nil { + return true + } + + return false +} + +// GetLogRetention returns the LogRetention field value +// If the value is explicit nil, the zero value for TopicLogRetention will be returned +func (o *Topic) GetLogRetention() *TopicLogRetention { + if o == nil { + return nil + } + + return o.LogRetention + +} + +// GetLogRetentionOk returns a tuple with the LogRetention field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Topic) GetLogRetentionOk() (*TopicLogRetention, bool) { + if o == nil { + return nil, false + } + + return o.LogRetention, true +} + +// SetLogRetention sets field value +func (o *Topic) SetLogRetention(v TopicLogRetention) { + + o.LogRetention = &v + +} + +// HasLogRetention returns a boolean if a field has been set. +func (o *Topic) HasLogRetention() bool { + if o != nil && o.LogRetention != nil { + return true + } + + return false +} + +func (o Topic) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + + if o.ReplicationFactor != nil { + toSerialize["replicationFactor"] = o.ReplicationFactor + } + + if o.NumberOfPartitions != nil { + toSerialize["numberOfPartitions"] = o.NumberOfPartitions + } + + if o.LogRetention != nil { + toSerialize["logRetention"] = o.LogRetention + } + + return json.Marshal(toSerialize) +} + +type NullableTopic struct { + value *Topic + isSet bool +} + +func (v NullableTopic) Get() *Topic { + return v.value +} + +func (v *NullableTopic) Set(val *Topic) { + v.value = val + v.isSet = true +} + +func (v NullableTopic) IsSet() bool { + return v.isSet +} + +func (v *NullableTopic) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTopic(val *Topic) *NullableTopic { + return &NullableTopic{value: val, isSet: true} +} + +func (v NullableTopic) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTopic) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_create.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_create.go new file mode 100644 index 000000000..f4a4d39d0 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_create.go @@ -0,0 +1,168 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// TopicCreate struct for TopicCreate +type TopicCreate struct { + // Metadata + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Properties *Topic `json:"properties"` +} + +// NewTopicCreate instantiates a new TopicCreate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTopicCreate(properties Topic) *TopicCreate { + this := TopicCreate{} + + this.Properties = &properties + + return &this +} + +// NewTopicCreateWithDefaults instantiates a new TopicCreate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTopicCreateWithDefaults() *TopicCreate { + this := TopicCreate{} + return &this +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for map[string]interface{} will be returned +func (o *TopicCreate) GetMetadata() *map[string]interface{} { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicCreate) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *TopicCreate) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *TopicCreate) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for Topic will be returned +func (o *TopicCreate) GetProperties() *Topic { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicCreate) GetPropertiesOk() (*Topic, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *TopicCreate) SetProperties(v Topic) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *TopicCreate) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o TopicCreate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableTopicCreate struct { + value *TopicCreate + isSet bool +} + +func (v NullableTopicCreate) Get() *TopicCreate { + return v.value +} + +func (v *NullableTopicCreate) Set(val *TopicCreate) { + v.value = val + v.isSet = true +} + +func (v NullableTopicCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableTopicCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTopicCreate(val *TopicCreate) *NullableTopicCreate { + return &NullableTopicCreate{value: val, isSet: true} +} + +func (v NullableTopicCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTopicCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_log_retention.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_log_retention.go new file mode 100644 index 000000000..ff01aecfd --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_log_retention.go @@ -0,0 +1,176 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// TopicLogRetention struct for TopicLogRetention +type TopicLogRetention struct { + // This configuration controls the maximum time we will retain a log before we will discard old log segments to free up space. This represents an SLA on how soon consumers must read their data. If set to -1, no time limit is applied. + RetentionTime *int32 `json:"retentionTime,omitempty"` + // This configuration controls the segment file size for the log. Retention and cleaning is always done a file at a time so a larger segment size means fewer files but less granular control over retention. + SegmentBytes *int32 `json:"segmentBytes,omitempty"` +} + +// NewTopicLogRetention instantiates a new TopicLogRetention object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTopicLogRetention() *TopicLogRetention { + this := TopicLogRetention{} + + var retentionTime int32 = 604800000 + this.RetentionTime = &retentionTime + var segmentBytes int32 = 1073741824 + this.SegmentBytes = &segmentBytes + + return &this +} + +// NewTopicLogRetentionWithDefaults instantiates a new TopicLogRetention object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTopicLogRetentionWithDefaults() *TopicLogRetention { + this := TopicLogRetention{} + var retentionTime int32 = 604800000 + this.RetentionTime = &retentionTime + var segmentBytes int32 = 1073741824 + this.SegmentBytes = &segmentBytes + return &this +} + +// GetRetentionTime returns the RetentionTime field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *TopicLogRetention) GetRetentionTime() *int32 { + if o == nil { + return nil + } + + return o.RetentionTime + +} + +// GetRetentionTimeOk returns a tuple with the RetentionTime field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicLogRetention) GetRetentionTimeOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.RetentionTime, true +} + +// SetRetentionTime sets field value +func (o *TopicLogRetention) SetRetentionTime(v int32) { + + o.RetentionTime = &v + +} + +// HasRetentionTime returns a boolean if a field has been set. +func (o *TopicLogRetention) HasRetentionTime() bool { + if o != nil && o.RetentionTime != nil { + return true + } + + return false +} + +// GetSegmentBytes returns the SegmentBytes field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *TopicLogRetention) GetSegmentBytes() *int32 { + if o == nil { + return nil + } + + return o.SegmentBytes + +} + +// GetSegmentBytesOk returns a tuple with the SegmentBytes field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicLogRetention) GetSegmentBytesOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.SegmentBytes, true +} + +// SetSegmentBytes sets field value +func (o *TopicLogRetention) SetSegmentBytes(v int32) { + + o.SegmentBytes = &v + +} + +// HasSegmentBytes returns a boolean if a field has been set. +func (o *TopicLogRetention) HasSegmentBytes() bool { + if o != nil && o.SegmentBytes != nil { + return true + } + + return false +} + +func (o TopicLogRetention) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.RetentionTime != nil { + toSerialize["retentionTime"] = o.RetentionTime + } + + if o.SegmentBytes != nil { + toSerialize["segmentBytes"] = o.SegmentBytes + } + + return json.Marshal(toSerialize) +} + +type NullableTopicLogRetention struct { + value *TopicLogRetention + isSet bool +} + +func (v NullableTopicLogRetention) Get() *TopicLogRetention { + return v.value +} + +func (v *NullableTopicLogRetention) Set(val *TopicLogRetention) { + v.value = val + v.isSet = true +} + +func (v NullableTopicLogRetention) IsSet() bool { + return v.isSet +} + +func (v *NullableTopicLogRetention) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTopicLogRetention(val *TopicLogRetention) *NullableTopicLogRetention { + return &NullableTopicLogRetention{value: val, isSet: true} +} + +func (v NullableTopicLogRetention) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTopicLogRetention) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_read.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_read.go new file mode 100644 index 000000000..836cbb1cc --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_read.go @@ -0,0 +1,303 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// TopicRead struct for TopicRead +type TopicRead struct { + // The ID (UUID) of the Topic. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the Topic. + Href *string `json:"href"` + Metadata *ResourceMetadata `json:"metadata"` + Properties *Topic `json:"properties"` +} + +// NewTopicRead instantiates a new TopicRead object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTopicRead(id string, type_ string, href string, metadata ResourceMetadata, properties Topic) *TopicRead { + this := TopicRead{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Metadata = &metadata + this.Properties = &properties + + return &this +} + +// NewTopicReadWithDefaults instantiates a new TopicRead object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTopicReadWithDefaults() *TopicRead { + this := TopicRead{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *TopicRead) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicRead) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *TopicRead) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *TopicRead) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *TopicRead) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicRead) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *TopicRead) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *TopicRead) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *TopicRead) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicRead) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *TopicRead) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *TopicRead) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for ResourceMetadata will be returned +func (o *TopicRead) GetMetadata() *ResourceMetadata { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicRead) GetMetadataOk() (*ResourceMetadata, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *TopicRead) SetMetadata(v ResourceMetadata) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *TopicRead) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for Topic will be returned +func (o *TopicRead) GetProperties() *Topic { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicRead) GetPropertiesOk() (*Topic, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *TopicRead) SetProperties(v Topic) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *TopicRead) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o TopicRead) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableTopicRead struct { + value *TopicRead + isSet bool +} + +func (v NullableTopicRead) Get() *TopicRead { + return v.value +} + +func (v *NullableTopicRead) Set(val *TopicRead) { + v.value = val + v.isSet = true +} + +func (v NullableTopicRead) IsSet() bool { + return v.isSet +} + +func (v *NullableTopicRead) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTopicRead(val *TopicRead) *NullableTopicRead { + return &NullableTopicRead{value: val, isSet: true} +} + +func (v NullableTopicRead) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTopicRead) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_read_list.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_read_list.go new file mode 100644 index 000000000..851d6a741 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_read_list.go @@ -0,0 +1,259 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// TopicReadList struct for TopicReadList +type TopicReadList struct { + // ID of the list of Topic resources. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the list of Topic resources. + Href *string `json:"href"` + // The list of Topic resources. + Items *[]TopicRead `json:"items,omitempty"` +} + +// NewTopicReadList instantiates a new TopicReadList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTopicReadList(id string, type_ string, href string) *TopicReadList { + this := TopicReadList{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + + return &this +} + +// NewTopicReadListWithDefaults instantiates a new TopicReadList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTopicReadListWithDefaults() *TopicReadList { + this := TopicReadList{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *TopicReadList) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicReadList) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *TopicReadList) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *TopicReadList) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *TopicReadList) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicReadList) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *TopicReadList) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *TopicReadList) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *TopicReadList) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicReadList) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *TopicReadList) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *TopicReadList) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []TopicRead will be returned +func (o *TopicReadList) GetItems() *[]TopicRead { + if o == nil { + return nil + } + + return o.Items + +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicReadList) GetItemsOk() (*[]TopicRead, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *TopicReadList) SetItems(v []TopicRead) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *TopicReadList) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +func (o TopicReadList) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableTopicReadList struct { + value *TopicReadList + isSet bool +} + +func (v NullableTopicReadList) Get() *TopicReadList { + return v.value +} + +func (v *NullableTopicReadList) Set(val *TopicReadList) { + v.value = val + v.isSet = true +} + +func (v NullableTopicReadList) IsSet() bool { + return v.isSet +} + +func (v *NullableTopicReadList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTopicReadList(val *TopicReadList) *NullableTopicReadList { + return &NullableTopicReadList{value: val, isSet: true} +} + +func (v NullableTopicReadList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTopicReadList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_read_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_read_list_all_of.go new file mode 100644 index 000000000..046be87c8 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_topic_read_list_all_of.go @@ -0,0 +1,259 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// TopicReadListAllOf struct for TopicReadListAllOf +type TopicReadListAllOf struct { + // ID of the list of Topic resources. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the list of Topic resources. + Href *string `json:"href"` + // The list of Topic resources. + Items *[]TopicRead `json:"items,omitempty"` +} + +// NewTopicReadListAllOf instantiates a new TopicReadListAllOf object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTopicReadListAllOf(id string, type_ string, href string) *TopicReadListAllOf { + this := TopicReadListAllOf{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + + return &this +} + +// NewTopicReadListAllOfWithDefaults instantiates a new TopicReadListAllOf object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTopicReadListAllOfWithDefaults() *TopicReadListAllOf { + this := TopicReadListAllOf{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *TopicReadListAllOf) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicReadListAllOf) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *TopicReadListAllOf) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *TopicReadListAllOf) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *TopicReadListAllOf) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicReadListAllOf) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *TopicReadListAllOf) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *TopicReadListAllOf) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *TopicReadListAllOf) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicReadListAllOf) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *TopicReadListAllOf) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *TopicReadListAllOf) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []TopicRead will be returned +func (o *TopicReadListAllOf) GetItems() *[]TopicRead { + if o == nil { + return nil + } + + return o.Items + +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TopicReadListAllOf) GetItemsOk() (*[]TopicRead, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *TopicReadListAllOf) SetItems(v []TopicRead) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *TopicReadListAllOf) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +func (o TopicReadListAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableTopicReadListAllOf struct { + value *TopicReadListAllOf + isSet bool +} + +func (v NullableTopicReadListAllOf) Get() *TopicReadListAllOf { + return v.value +} + +func (v *NullableTopicReadListAllOf) Set(val *TopicReadListAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableTopicReadListAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableTopicReadListAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTopicReadListAllOf(val *TopicReadListAllOf) *NullableTopicReadListAllOf { + return &NullableTopicReadListAllOf{value: val, isSet: true} +} + +func (v NullableTopicReadListAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTopicReadListAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user.go new file mode 100644 index 000000000..5d16b033a --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user.go @@ -0,0 +1,125 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// User The user of the apache cluster. Access is managed by certificates. The certificates are retrieved by the access endpoint. +type User struct { + // The name of the Kafka cluster user. Must be 63 characters or less and must begin and end with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between. + Name *string `json:"name"` +} + +// NewUser instantiates a new User object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUser(name string) *User { + this := User{} + + this.Name = &name + + return &this +} + +// NewUserWithDefaults instantiates a new User object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserWithDefaults() *User { + this := User{} + return &this +} + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *User) GetName() *string { + if o == nil { + return nil + } + + return o.Name + +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *User) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Name, true +} + +// SetName sets field value +func (o *User) SetName(v string) { + + o.Name = &v + +} + +// HasName returns a boolean if a field has been set. +func (o *User) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +func (o User) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + + return json.Marshal(toSerialize) +} + +type NullableUser struct { + value *User + isSet bool +} + +func (v NullableUser) Get() *User { + return v.value +} + +func (v *NullableUser) Set(val *User) { + v.value = val + v.isSet = true +} + +func (v NullableUser) IsSet() bool { + return v.isSet +} + +func (v *NullableUser) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUser(val *User) *NullableUser { + return &NullableUser{value: val, isSet: true} +} + +func (v NullableUser) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUser) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_access_metadata.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_access_metadata.go new file mode 100644 index 000000000..222dc532b --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_access_metadata.go @@ -0,0 +1,624 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" + "time" +) + +// UserAccessMetadata struct for UserAccessMetadata +type UserAccessMetadata struct { + // The ISO 8601 creation timestamp. + CreatedDate *IonosTime `json:"createdDate,omitempty"` + // Unique name of the identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // Unique id of the identity that created the resource. + CreatedByUserId *string `json:"createdByUserId,omitempty"` + // The ISO 8601 modified timestamp. + LastModifiedDate *IonosTime `json:"lastModifiedDate,omitempty"` + // Unique name of the identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // Unique id of the identity that last modified the resource. + LastModifiedByUserId *string `json:"lastModifiedByUserId,omitempty"` + // Unique name of the resource. + ResourceURN *string `json:"resourceURN,omitempty"` + // State of the resource. Resource states: `AVAILABLE`: There are no pending modification requests for this item. `BUSY`: There is at least one modification request pending and all following requests will be queued. `DEPLOYING`: The resource is being created. `FAILED`: The creation of the resource failed. `UPDATING`: The resource is being updated. `FAILED_UPDATING`: An update to the resource was not successful. `DESTROYING`: A delete command was issued, and the resource is being deleted. + State *string `json:"state"` + // A human readable message describing the current state. In case of an error, the message will contain a detailed error message. + Message *string `json:"message,omitempty"` + // PEM for the certificate authority. + CertificateAuthority *string `json:"certificateAuthority,omitempty"` + // PEM for the private key. + PrivateKey *string `json:"privateKey,omitempty"` + // PEM for the certificate. + Certificate *string `json:"certificate,omitempty"` +} + +// NewUserAccessMetadata instantiates a new UserAccessMetadata object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserAccessMetadata(state string) *UserAccessMetadata { + this := UserAccessMetadata{} + + this.State = &state + + return &this +} + +// NewUserAccessMetadataWithDefaults instantiates a new UserAccessMetadata object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserAccessMetadataWithDefaults() *UserAccessMetadata { + this := UserAccessMetadata{} + return &this +} + +// GetCreatedDate returns the CreatedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *UserAccessMetadata) GetCreatedDate() *time.Time { + if o == nil { + return nil + } + + if o.CreatedDate == nil { + return nil + } + return &o.CreatedDate.Time + +} + +// GetCreatedDateOk returns a tuple with the CreatedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadata) GetCreatedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + + if o.CreatedDate == nil { + return nil, false + } + return &o.CreatedDate.Time, true + +} + +// SetCreatedDate sets field value +func (o *UserAccessMetadata) SetCreatedDate(v time.Time) { + + o.CreatedDate = &IonosTime{v} + +} + +// HasCreatedDate returns a boolean if a field has been set. +func (o *UserAccessMetadata) HasCreatedDate() bool { + if o != nil && o.CreatedDate != nil { + return true + } + + return false +} + +// GetCreatedBy returns the CreatedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserAccessMetadata) GetCreatedBy() *string { + if o == nil { + return nil + } + + return o.CreatedBy + +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadata) GetCreatedByOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CreatedBy, true +} + +// SetCreatedBy sets field value +func (o *UserAccessMetadata) SetCreatedBy(v string) { + + o.CreatedBy = &v + +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *UserAccessMetadata) HasCreatedBy() bool { + if o != nil && o.CreatedBy != nil { + return true + } + + return false +} + +// GetCreatedByUserId returns the CreatedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserAccessMetadata) GetCreatedByUserId() *string { + if o == nil { + return nil + } + + return o.CreatedByUserId + +} + +// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadata) GetCreatedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CreatedByUserId, true +} + +// SetCreatedByUserId sets field value +func (o *UserAccessMetadata) SetCreatedByUserId(v string) { + + o.CreatedByUserId = &v + +} + +// HasCreatedByUserId returns a boolean if a field has been set. +func (o *UserAccessMetadata) HasCreatedByUserId() bool { + if o != nil && o.CreatedByUserId != nil { + return true + } + + return false +} + +// GetLastModifiedDate returns the LastModifiedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *UserAccessMetadata) GetLastModifiedDate() *time.Time { + if o == nil { + return nil + } + + if o.LastModifiedDate == nil { + return nil + } + return &o.LastModifiedDate.Time + +} + +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadata) GetLastModifiedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + + if o.LastModifiedDate == nil { + return nil, false + } + return &o.LastModifiedDate.Time, true + +} + +// SetLastModifiedDate sets field value +func (o *UserAccessMetadata) SetLastModifiedDate(v time.Time) { + + o.LastModifiedDate = &IonosTime{v} + +} + +// HasLastModifiedDate returns a boolean if a field has been set. +func (o *UserAccessMetadata) HasLastModifiedDate() bool { + if o != nil && o.LastModifiedDate != nil { + return true + } + + return false +} + +// GetLastModifiedBy returns the LastModifiedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserAccessMetadata) GetLastModifiedBy() *string { + if o == nil { + return nil + } + + return o.LastModifiedBy + +} + +// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadata) GetLastModifiedByOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LastModifiedBy, true +} + +// SetLastModifiedBy sets field value +func (o *UserAccessMetadata) SetLastModifiedBy(v string) { + + o.LastModifiedBy = &v + +} + +// HasLastModifiedBy returns a boolean if a field has been set. +func (o *UserAccessMetadata) HasLastModifiedBy() bool { + if o != nil && o.LastModifiedBy != nil { + return true + } + + return false +} + +// GetLastModifiedByUserId returns the LastModifiedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserAccessMetadata) GetLastModifiedByUserId() *string { + if o == nil { + return nil + } + + return o.LastModifiedByUserId + +} + +// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadata) GetLastModifiedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LastModifiedByUserId, true +} + +// SetLastModifiedByUserId sets field value +func (o *UserAccessMetadata) SetLastModifiedByUserId(v string) { + + o.LastModifiedByUserId = &v + +} + +// HasLastModifiedByUserId returns a boolean if a field has been set. +func (o *UserAccessMetadata) HasLastModifiedByUserId() bool { + if o != nil && o.LastModifiedByUserId != nil { + return true + } + + return false +} + +// GetResourceURN returns the ResourceURN field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserAccessMetadata) GetResourceURN() *string { + if o == nil { + return nil + } + + return o.ResourceURN + +} + +// GetResourceURNOk returns a tuple with the ResourceURN field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadata) GetResourceURNOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.ResourceURN, true +} + +// SetResourceURN sets field value +func (o *UserAccessMetadata) SetResourceURN(v string) { + + o.ResourceURN = &v + +} + +// HasResourceURN returns a boolean if a field has been set. +func (o *UserAccessMetadata) HasResourceURN() bool { + if o != nil && o.ResourceURN != nil { + return true + } + + return false +} + +// GetState returns the State field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserAccessMetadata) GetState() *string { + if o == nil { + return nil + } + + return o.State + +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadata) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.State, true +} + +// SetState sets field value +func (o *UserAccessMetadata) SetState(v string) { + + o.State = &v + +} + +// HasState returns a boolean if a field has been set. +func (o *UserAccessMetadata) HasState() bool { + if o != nil && o.State != nil { + return true + } + + return false +} + +// GetMessage returns the Message field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserAccessMetadata) GetMessage() *string { + if o == nil { + return nil + } + + return o.Message + +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadata) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Message, true +} + +// SetMessage sets field value +func (o *UserAccessMetadata) SetMessage(v string) { + + o.Message = &v + +} + +// HasMessage returns a boolean if a field has been set. +func (o *UserAccessMetadata) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// GetCertificateAuthority returns the CertificateAuthority field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserAccessMetadata) GetCertificateAuthority() *string { + if o == nil { + return nil + } + + return o.CertificateAuthority + +} + +// GetCertificateAuthorityOk returns a tuple with the CertificateAuthority field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadata) GetCertificateAuthorityOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CertificateAuthority, true +} + +// SetCertificateAuthority sets field value +func (o *UserAccessMetadata) SetCertificateAuthority(v string) { + + o.CertificateAuthority = &v + +} + +// HasCertificateAuthority returns a boolean if a field has been set. +func (o *UserAccessMetadata) HasCertificateAuthority() bool { + if o != nil && o.CertificateAuthority != nil { + return true + } + + return false +} + +// GetPrivateKey returns the PrivateKey field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserAccessMetadata) GetPrivateKey() *string { + if o == nil { + return nil + } + + return o.PrivateKey + +} + +// GetPrivateKeyOk returns a tuple with the PrivateKey field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadata) GetPrivateKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.PrivateKey, true +} + +// SetPrivateKey sets field value +func (o *UserAccessMetadata) SetPrivateKey(v string) { + + o.PrivateKey = &v + +} + +// HasPrivateKey returns a boolean if a field has been set. +func (o *UserAccessMetadata) HasPrivateKey() bool { + if o != nil && o.PrivateKey != nil { + return true + } + + return false +} + +// GetCertificate returns the Certificate field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserAccessMetadata) GetCertificate() *string { + if o == nil { + return nil + } + + return o.Certificate + +} + +// GetCertificateOk returns a tuple with the Certificate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadata) GetCertificateOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Certificate, true +} + +// SetCertificate sets field value +func (o *UserAccessMetadata) SetCertificate(v string) { + + o.Certificate = &v + +} + +// HasCertificate returns a boolean if a field has been set. +func (o *UserAccessMetadata) HasCertificate() bool { + if o != nil && o.Certificate != nil { + return true + } + + return false +} + +func (o UserAccessMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.CreatedDate != nil { + toSerialize["createdDate"] = o.CreatedDate + } + + if o.CreatedBy != nil { + toSerialize["createdBy"] = o.CreatedBy + } + + if o.CreatedByUserId != nil { + toSerialize["createdByUserId"] = o.CreatedByUserId + } + + if o.LastModifiedDate != nil { + toSerialize["lastModifiedDate"] = o.LastModifiedDate + } + + if o.LastModifiedBy != nil { + toSerialize["lastModifiedBy"] = o.LastModifiedBy + } + + if o.LastModifiedByUserId != nil { + toSerialize["lastModifiedByUserId"] = o.LastModifiedByUserId + } + + if o.ResourceURN != nil { + toSerialize["resourceURN"] = o.ResourceURN + } + + if o.State != nil { + toSerialize["state"] = o.State + } + + if o.Message != nil { + toSerialize["message"] = o.Message + } + + if o.CertificateAuthority != nil { + toSerialize["certificateAuthority"] = o.CertificateAuthority + } + + if o.PrivateKey != nil { + toSerialize["privateKey"] = o.PrivateKey + } + + if o.Certificate != nil { + toSerialize["certificate"] = o.Certificate + } + + return json.Marshal(toSerialize) +} + +type NullableUserAccessMetadata struct { + value *UserAccessMetadata + isSet bool +} + +func (v NullableUserAccessMetadata) Get() *UserAccessMetadata { + return v.value +} + +func (v *NullableUserAccessMetadata) Set(val *UserAccessMetadata) { + v.value = val + v.isSet = true +} + +func (v NullableUserAccessMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableUserAccessMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserAccessMetadata(val *UserAccessMetadata) *NullableUserAccessMetadata { + return &NullableUserAccessMetadata{value: val, isSet: true} +} + +func (v NullableUserAccessMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserAccessMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_access_metadata_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_access_metadata_all_of.go new file mode 100644 index 000000000..e1f4deb97 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_access_metadata_all_of.go @@ -0,0 +1,211 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// UserAccessMetadataAllOf struct for UserAccessMetadataAllOf +type UserAccessMetadataAllOf struct { + // PEM for the certificate authority. + CertificateAuthority *string `json:"certificateAuthority,omitempty"` + // PEM for the private key. + PrivateKey *string `json:"privateKey,omitempty"` + // PEM for the certificate. + Certificate *string `json:"certificate,omitempty"` +} + +// NewUserAccessMetadataAllOf instantiates a new UserAccessMetadataAllOf object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserAccessMetadataAllOf() *UserAccessMetadataAllOf { + this := UserAccessMetadataAllOf{} + + return &this +} + +// NewUserAccessMetadataAllOfWithDefaults instantiates a new UserAccessMetadataAllOf object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserAccessMetadataAllOfWithDefaults() *UserAccessMetadataAllOf { + this := UserAccessMetadataAllOf{} + return &this +} + +// GetCertificateAuthority returns the CertificateAuthority field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserAccessMetadataAllOf) GetCertificateAuthority() *string { + if o == nil { + return nil + } + + return o.CertificateAuthority + +} + +// GetCertificateAuthorityOk returns a tuple with the CertificateAuthority field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadataAllOf) GetCertificateAuthorityOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CertificateAuthority, true +} + +// SetCertificateAuthority sets field value +func (o *UserAccessMetadataAllOf) SetCertificateAuthority(v string) { + + o.CertificateAuthority = &v + +} + +// HasCertificateAuthority returns a boolean if a field has been set. +func (o *UserAccessMetadataAllOf) HasCertificateAuthority() bool { + if o != nil && o.CertificateAuthority != nil { + return true + } + + return false +} + +// GetPrivateKey returns the PrivateKey field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserAccessMetadataAllOf) GetPrivateKey() *string { + if o == nil { + return nil + } + + return o.PrivateKey + +} + +// GetPrivateKeyOk returns a tuple with the PrivateKey field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadataAllOf) GetPrivateKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.PrivateKey, true +} + +// SetPrivateKey sets field value +func (o *UserAccessMetadataAllOf) SetPrivateKey(v string) { + + o.PrivateKey = &v + +} + +// HasPrivateKey returns a boolean if a field has been set. +func (o *UserAccessMetadataAllOf) HasPrivateKey() bool { + if o != nil && o.PrivateKey != nil { + return true + } + + return false +} + +// GetCertificate returns the Certificate field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserAccessMetadataAllOf) GetCertificate() *string { + if o == nil { + return nil + } + + return o.Certificate + +} + +// GetCertificateOk returns a tuple with the Certificate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserAccessMetadataAllOf) GetCertificateOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Certificate, true +} + +// SetCertificate sets field value +func (o *UserAccessMetadataAllOf) SetCertificate(v string) { + + o.Certificate = &v + +} + +// HasCertificate returns a boolean if a field has been set. +func (o *UserAccessMetadataAllOf) HasCertificate() bool { + if o != nil && o.Certificate != nil { + return true + } + + return false +} + +func (o UserAccessMetadataAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.CertificateAuthority != nil { + toSerialize["certificateAuthority"] = o.CertificateAuthority + } + + if o.PrivateKey != nil { + toSerialize["privateKey"] = o.PrivateKey + } + + if o.Certificate != nil { + toSerialize["certificate"] = o.Certificate + } + + return json.Marshal(toSerialize) +} + +type NullableUserAccessMetadataAllOf struct { + value *UserAccessMetadataAllOf + isSet bool +} + +func (v NullableUserAccessMetadataAllOf) Get() *UserAccessMetadataAllOf { + return v.value +} + +func (v *NullableUserAccessMetadataAllOf) Set(val *UserAccessMetadataAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableUserAccessMetadataAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableUserAccessMetadataAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserAccessMetadataAllOf(val *UserAccessMetadataAllOf) *NullableUserAccessMetadataAllOf { + return &NullableUserAccessMetadataAllOf{value: val, isSet: true} +} + +func (v NullableUserAccessMetadataAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserAccessMetadataAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read.go new file mode 100644 index 000000000..3e6e161e8 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read.go @@ -0,0 +1,303 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// UserRead struct for UserRead +type UserRead struct { + // The ID (UUID) of the User. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the User. + Href *string `json:"href"` + Metadata *ResourceMetadata `json:"metadata"` + Properties *User `json:"properties"` +} + +// NewUserRead instantiates a new UserRead object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserRead(id string, type_ string, href string, metadata ResourceMetadata, properties User) *UserRead { + this := UserRead{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Metadata = &metadata + this.Properties = &properties + + return &this +} + +// NewUserReadWithDefaults instantiates a new UserRead object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserReadWithDefaults() *UserRead { + this := UserRead{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserRead) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserRead) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *UserRead) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *UserRead) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserRead) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserRead) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *UserRead) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *UserRead) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserRead) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserRead) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *UserRead) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *UserRead) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for ResourceMetadata will be returned +func (o *UserRead) GetMetadata() *ResourceMetadata { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserRead) GetMetadataOk() (*ResourceMetadata, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *UserRead) SetMetadata(v ResourceMetadata) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *UserRead) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for User will be returned +func (o *UserRead) GetProperties() *User { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserRead) GetPropertiesOk() (*User, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *UserRead) SetProperties(v User) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *UserRead) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o UserRead) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableUserRead struct { + value *UserRead + isSet bool +} + +func (v NullableUserRead) Get() *UserRead { + return v.value +} + +func (v *NullableUserRead) Set(val *UserRead) { + v.value = val + v.isSet = true +} + +func (v NullableUserRead) IsSet() bool { + return v.isSet +} + +func (v *NullableUserRead) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserRead(val *UserRead) *NullableUserRead { + return &NullableUserRead{value: val, isSet: true} +} + +func (v NullableUserRead) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserRead) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read_access.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read_access.go new file mode 100644 index 000000000..538ae4cb0 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read_access.go @@ -0,0 +1,303 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// UserReadAccess struct for UserReadAccess +type UserReadAccess struct { + // The ID (UUID) of the User. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the User. + Href *string `json:"href"` + Metadata *UserAccessMetadata `json:"metadata"` + Properties *User `json:"properties"` +} + +// NewUserReadAccess instantiates a new UserReadAccess object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserReadAccess(id string, type_ string, href string, metadata UserAccessMetadata, properties User) *UserReadAccess { + this := UserReadAccess{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Metadata = &metadata + this.Properties = &properties + + return &this +} + +// NewUserReadAccessWithDefaults instantiates a new UserReadAccess object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserReadAccessWithDefaults() *UserReadAccess { + this := UserReadAccess{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserReadAccess) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserReadAccess) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *UserReadAccess) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *UserReadAccess) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserReadAccess) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserReadAccess) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *UserReadAccess) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *UserReadAccess) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserReadAccess) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserReadAccess) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *UserReadAccess) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *UserReadAccess) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for UserAccessMetadata will be returned +func (o *UserReadAccess) GetMetadata() *UserAccessMetadata { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserReadAccess) GetMetadataOk() (*UserAccessMetadata, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *UserReadAccess) SetMetadata(v UserAccessMetadata) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *UserReadAccess) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for User will be returned +func (o *UserReadAccess) GetProperties() *User { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserReadAccess) GetPropertiesOk() (*User, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *UserReadAccess) SetProperties(v User) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *UserReadAccess) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o UserReadAccess) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableUserReadAccess struct { + value *UserReadAccess + isSet bool +} + +func (v NullableUserReadAccess) Get() *UserReadAccess { + return v.value +} + +func (v *NullableUserReadAccess) Set(val *UserReadAccess) { + v.value = val + v.isSet = true +} + +func (v NullableUserReadAccess) IsSet() bool { + return v.isSet +} + +func (v *NullableUserReadAccess) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserReadAccess(val *UserReadAccess) *NullableUserReadAccess { + return &NullableUserReadAccess{value: val, isSet: true} +} + +func (v NullableUserReadAccess) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserReadAccess) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read_list.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read_list.go new file mode 100644 index 000000000..ad7fd762d --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read_list.go @@ -0,0 +1,259 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// UserReadList struct for UserReadList +type UserReadList struct { + // ID of the list of User resources. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the list of User resources. + Href *string `json:"href"` + // The list of User resources. + Items *[]UserRead `json:"items,omitempty"` +} + +// NewUserReadList instantiates a new UserReadList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserReadList(id string, type_ string, href string) *UserReadList { + this := UserReadList{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + + return &this +} + +// NewUserReadListWithDefaults instantiates a new UserReadList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserReadListWithDefaults() *UserReadList { + this := UserReadList{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserReadList) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserReadList) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *UserReadList) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *UserReadList) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserReadList) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserReadList) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *UserReadList) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *UserReadList) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserReadList) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserReadList) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *UserReadList) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *UserReadList) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []UserRead will be returned +func (o *UserReadList) GetItems() *[]UserRead { + if o == nil { + return nil + } + + return o.Items + +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserReadList) GetItemsOk() (*[]UserRead, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *UserReadList) SetItems(v []UserRead) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *UserReadList) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +func (o UserReadList) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableUserReadList struct { + value *UserReadList + isSet bool +} + +func (v NullableUserReadList) Get() *UserReadList { + return v.value +} + +func (v *NullableUserReadList) Set(val *UserReadList) { + v.value = val + v.isSet = true +} + +func (v NullableUserReadList) IsSet() bool { + return v.isSet +} + +func (v *NullableUserReadList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserReadList(val *UserReadList) *NullableUserReadList { + return &NullableUserReadList{value: val, isSet: true} +} + +func (v NullableUserReadList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserReadList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read_list_all_of.go new file mode 100644 index 000000000..c997ad0d1 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/model_user_read_list_all_of.go @@ -0,0 +1,259 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// UserReadListAllOf struct for UserReadListAllOf +type UserReadListAllOf struct { + // ID of the list of User resources. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the list of User resources. + Href *string `json:"href"` + // The list of User resources. + Items *[]UserRead `json:"items,omitempty"` +} + +// NewUserReadListAllOf instantiates a new UserReadListAllOf object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserReadListAllOf(id string, type_ string, href string) *UserReadListAllOf { + this := UserReadListAllOf{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + + return &this +} + +// NewUserReadListAllOfWithDefaults instantiates a new UserReadListAllOf object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserReadListAllOfWithDefaults() *UserReadListAllOf { + this := UserReadListAllOf{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserReadListAllOf) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserReadListAllOf) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *UserReadListAllOf) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *UserReadListAllOf) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserReadListAllOf) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserReadListAllOf) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *UserReadListAllOf) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *UserReadListAllOf) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserReadListAllOf) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserReadListAllOf) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *UserReadListAllOf) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *UserReadListAllOf) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []UserRead will be returned +func (o *UserReadListAllOf) GetItems() *[]UserRead { + if o == nil { + return nil + } + + return o.Items + +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserReadListAllOf) GetItemsOk() (*[]UserRead, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *UserReadListAllOf) SetItems(v []UserRead) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *UserReadListAllOf) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +func (o UserReadListAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableUserReadListAllOf struct { + value *UserReadListAllOf + isSet bool +} + +func (v NullableUserReadListAllOf) Get() *UserReadListAllOf { + return v.value +} + +func (v *NullableUserReadListAllOf) Set(val *UserReadListAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableUserReadListAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableUserReadListAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserReadListAllOf(val *UserReadListAllOf) *NullableUserReadListAllOf { + return &NullableUserReadListAllOf{value: val, isSet: true} +} + +func (v NullableUserReadListAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserReadListAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/response.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/response.go new file mode 100644 index 000000000..064debbbe --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/response.go @@ -0,0 +1,74 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "log" + "net/http" + "time" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // RequestTime is the time duration from the moment the APIClient sends + // the HTTP request to the moment it receives an HTTP response. + RequestTime time.Duration `json:"duration,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} + +// HttpNotFound - returns true if a 404 status code was returned +// returns false for nil APIResponse values +func (resp *APIResponse) HttpNotFound() bool { + if resp != nil && resp.Response != nil && resp.StatusCode == http.StatusNotFound { + return true + } + return false +} + +// LogInfo - logs APIResponse values like RequestTime, Operation and StatusCode +// does not print anything for nil APIResponse values +func (resp *APIResponse) LogInfo() { + if resp != nil { + log.Printf("[DEBUG] Request time : %s for operation : %s", + resp.RequestTime, resp.Operation) + if resp.Response != nil { + log.Printf("[DEBUG] response status code : %d\n", resp.StatusCode) + } + } +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/sonar-project.properties b/vendor/github.com/ionos-cloud/sdk-go-kafka/sonar-project.properties new file mode 100644 index 000000000..6b41d7695 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/sonar-project.properties @@ -0,0 +1,12 @@ +sonar.projectKey=ionos-cloud_sdk-go-kafka +sonar.organization=ionos-cloud + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=sdk-go-kafka +#sonar.projectVersion=1.0 + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 diff --git a/vendor/github.com/ionos-cloud/sdk-go-kafka/utils.go b/vendor/github.com/ionos-cloud/sdk-go-kafka/utils.go new file mode 100644 index 000000000..5b147232c --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-kafka/utils.go @@ -0,0 +1,777 @@ +/* + * Kafka as a Service API + * + * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics. + * + * API version: 1.7.1 + * Contact: support@cloud.ionos.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" + "reflect" + "time" +) + +// ToPtr - returns a pointer to the given value. +func ToPtr[T any](v T) *T { + return &v +} + +// ToValue - returns the value of the pointer passed in +func ToValue[T any](ptr *T) T { + return *ptr +} + +// ToValueDefault - returns the value of the pointer passed in, or the default type value if the pointer is nil +func ToValueDefault[T any](ptr *T) T { + var defaultVal T + if ptr == nil { + return defaultVal + } + return *ptr +} + +func SliceToValueDefault[T any](ptrSlice *[]T) []T { + return append([]T{}, *ptrSlice...) +} + +// PtrBool - returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt - returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 - returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 - returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 - returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 - returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString - returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime - returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +// ToBool - returns the value of the bool pointer passed in +func ToBool(ptr *bool) bool { + return *ptr +} + +// ToBoolDefault - returns the value of the bool pointer passed in, or false if the pointer is nil +func ToBoolDefault(ptr *bool) bool { + var defaultVal bool + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToBoolSlice - returns a bool slice of the pointer passed in +func ToBoolSlice(ptrSlice *[]bool) []bool { + valSlice := make([]bool, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToByte - returns the value of the byte pointer passed in +func ToByte(ptr *byte) byte { + return *ptr +} + +// ToByteDefault - returns the value of the byte pointer passed in, or 0 if the pointer is nil +func ToByteDefault(ptr *byte) byte { + var defaultVal byte + if ptr == nil { + return defaultVal + } + + return *ptr +} + +// ToByteSlice - returns a byte slice of the pointer passed in +func ToByteSlice(ptrSlice *[]byte) []byte { + valSlice := make([]byte, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToString - returns the value of the string pointer passed in +func ToString(ptr *string) string { + return *ptr +} + +// ToStringDefault - returns the value of the string pointer passed in, or "" if the pointer is nil +func ToStringDefault(ptr *string) string { + var defaultVal string + if ptr == nil { + return defaultVal + } + + return *ptr +} + +// ToStringSlice - returns a string slice of the pointer passed in +func ToStringSlice(ptrSlice *[]string) []string { + valSlice := make([]string, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToInt - returns the value of the int pointer passed in +func ToInt(ptr *int) int { + return *ptr +} + +// ToIntDefault - returns the value of the int pointer passed in, or 0 if the pointer is nil +func ToIntDefault(ptr *int) int { + var defaultVal int + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToIntSlice - returns a int slice of the pointer passed in +func ToIntSlice(ptrSlice *[]int) []int { + valSlice := make([]int, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToInt8 - returns the value of the int8 pointer passed in +func ToInt8(ptr *int8) int8 { + return *ptr +} + +// ToInt8Default - returns the value of the int8 pointer passed in, or 0 if the pointer is nil +func ToInt8Default(ptr *int8) int8 { + var defaultVal int8 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToInt8Slice - returns a int8 slice of the pointer passed in +func ToInt8Slice(ptrSlice *[]int8) []int8 { + valSlice := make([]int8, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToInt16 - returns the value of the int16 pointer passed in +func ToInt16(ptr *int16) int16 { + return *ptr +} + +// ToInt16Default - returns the value of the int16 pointer passed in, or 0 if the pointer is nil +func ToInt16Default(ptr *int16) int16 { + var defaultVal int16 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToInt16Slice - returns a int16 slice of the pointer passed in +func ToInt16Slice(ptrSlice *[]int16) []int16 { + valSlice := make([]int16, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToInt32 - returns the value of the int32 pointer passed in +func ToInt32(ptr *int32) int32 { + return *ptr +} + +// ToInt32Default - returns the value of the int32 pointer passed in, or 0 if the pointer is nil +func ToInt32Default(ptr *int32) int32 { + var defaultVal int32 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToInt32Slice - returns a int32 slice of the pointer passed in +func ToInt32Slice(ptrSlice *[]int32) []int32 { + valSlice := make([]int32, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToInt64 - returns the value of the int64 pointer passed in +func ToInt64(ptr *int64) int64 { + return *ptr +} + +// ToInt64Default - returns the value of the int64 pointer passed in, or 0 if the pointer is nil +func ToInt64Default(ptr *int64) int64 { + var defaultVal int64 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToInt64Slice - returns a int64 slice of the pointer passed in +func ToInt64Slice(ptrSlice *[]int64) []int64 { + valSlice := make([]int64, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToUint - returns the value of the uint pointer passed in +func ToUint(ptr *uint) uint { + return *ptr +} + +// ToUintDefault - returns the value of the uint pointer passed in, or 0 if the pointer is nil +func ToUintDefault(ptr *uint) uint { + var defaultVal uint + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToUintSlice - returns a uint slice of the pointer passed in +func ToUintSlice(ptrSlice *[]uint) []uint { + valSlice := make([]uint, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToUint8 -returns the value of the uint8 pointer passed in +func ToUint8(ptr *uint8) uint8 { + return *ptr +} + +// ToUint8Default - returns the value of the uint8 pointer passed in, or 0 if the pointer is nil +func ToUint8Default(ptr *uint8) uint8 { + var defaultVal uint8 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToUint8Slice - returns a uint8 slice of the pointer passed in +func ToUint8Slice(ptrSlice *[]uint8) []uint8 { + valSlice := make([]uint8, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToUint16 - returns the value of the uint16 pointer passed in +func ToUint16(ptr *uint16) uint16 { + return *ptr +} + +// ToUint16Default - returns the value of the uint16 pointer passed in, or 0 if the pointer is nil +func ToUint16Default(ptr *uint16) uint16 { + var defaultVal uint16 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToUint16Slice - returns a uint16 slice of the pointer passed in +func ToUint16Slice(ptrSlice *[]uint16) []uint16 { + valSlice := make([]uint16, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToUint32 - returns the value of the uint32 pointer passed in +func ToUint32(ptr *uint32) uint32 { + return *ptr +} + +// ToUint32Default - returns the value of the uint32 pointer passed in, or 0 if the pointer is nil +func ToUint32Default(ptr *uint32) uint32 { + var defaultVal uint32 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToUint32Slice - returns a uint32 slice of the pointer passed in +func ToUint32Slice(ptrSlice *[]uint32) []uint32 { + valSlice := make([]uint32, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToUint64 - returns the value of the uint64 pointer passed in +func ToUint64(ptr *uint64) uint64 { + return *ptr +} + +// ToUint64Default - returns the value of the uint64 pointer passed in, or 0 if the pointer is nil +func ToUint64Default(ptr *uint64) uint64 { + var defaultVal uint64 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToUint64Slice - returns a uint63 slice of the pointer passed in +func ToUint64Slice(ptrSlice *[]uint64) []uint64 { + valSlice := make([]uint64, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToFloat32 - returns the value of the float32 pointer passed in +func ToFloat32(ptr *float32) float32 { + return *ptr +} + +// ToFloat32Default - returns the value of the float32 pointer passed in, or 0 if the pointer is nil +func ToFloat32Default(ptr *float32) float32 { + var defaultVal float32 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToFloat32Slice - returns a float32 slice of the pointer passed in +func ToFloat32Slice(ptrSlice *[]float32) []float32 { + valSlice := make([]float32, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToFloat64 - returns the value of the float64 pointer passed in +func ToFloat64(ptr *float64) float64 { + return *ptr +} + +// ToFloat64Default - returns the value of the float64 pointer passed in, or 0 if the pointer is nil +func ToFloat64Default(ptr *float64) float64 { + var defaultVal float64 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToFloat64Slice - returns a float64 slice of the pointer passed in +func ToFloat64Slice(ptrSlice *[]float64) []float64 { + valSlice := make([]float64, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToTime - returns the value of the Time pointer passed in +func ToTime(ptr *time.Time) time.Time { + return *ptr +} + +// ToTimeDefault - returns the value of the Time pointer passed in, or 0001-01-01 00:00:00 +0000 UTC if the pointer is nil +func ToTimeDefault(ptr *time.Time) time.Time { + var defaultVal time.Time + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToTimeSlice - returns a Time slice of the pointer passed in +func ToTimeSlice(ptrSlice *[]time.Time) []time.Time { + valSlice := make([]time.Time, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type IonosTime struct { + time.Time +} + +func (t *IonosTime) UnmarshalJSON(data []byte) error { + str := string(data) + if strlen(str) == 0 { + t = nil + return nil + } + if str[0] == '"' { + str = str[1:] + } + if str[len(str)-1] == '"' { + str = str[:len(str)-1] + } + tt, err := time.Parse(time.RFC3339, str) + if err != nil { + return err + } + *t = IonosTime{tt} + return nil +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} diff --git a/vendor/modules.txt b/vendor/modules.txt index d2cf3a3f5..605ebf883 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -87,6 +87,9 @@ github.com/ionos-cloud/sdk-go-dbaas-postgres # github.com/ionos-cloud/sdk-go-dns v1.2.0 ## explicit; go 1.18 github.com/ionos-cloud/sdk-go-dns +# github.com/ionos-cloud/sdk-go-kafka v1.1.0 +## explicit; go 1.18 +github.com/ionos-cloud/sdk-go-kafka # github.com/ionos-cloud/sdk-go-logging v1.0.1 ## explicit; go 1.18 github.com/ionos-cloud/sdk-go-logging