From 365d565530af18b00b223d7c3f782156ef9d5db7 Mon Sep 17 00:00:00 2001 From: simisoft-exo Date: Tue, 10 Sep 2024 11:23:49 +0100 Subject: [PATCH] dbaas: datadog integration settings --- cmd/internal/x/x.gen.go | 202 ++- .../exoscale/egoscale/v3/operations.go | 1421 ++++++++++++++++- .../exoscale/egoscale/v3/schemas.go | 229 ++- vendor/modules.txt | 2 +- 4 files changed, 1791 insertions(+), 63 deletions(-) diff --git a/cmd/internal/x/x.gen.go b/cmd/internal/x/x.gen.go index 2a387a6b..356f60ec 100644 --- a/cmd/internal/x/x.gen.go +++ b/cmd/internal/x/x.gen.go @@ -2080,6 +2080,94 @@ func XListDbaasExternalEndpoints(params *viper.Viper) (*gentleman.Response, map[ return resp, decoded, nil } +// XGetDbaasExternalIntegrationSettingsDatadog get-dbaas-external-integration-settings-datadog +func XGetDbaasExternalIntegrationSettingsDatadog(paramIntegrationId string, params *viper.Viper) (*gentleman.Response, map[string]interface{}, error) { + handlerPath := "get-dbaas-external-integration-settings-datadog" + if xSubcommand { + handlerPath = "x " + handlerPath + } + + server := viper.GetString("server") + if server == "" { + server = xServers()[viper.GetInt("server-index")]["url"] + } + + url := server + "/dbaas-external-integration-settings-datadog/{integration-id}" + url = strings.Replace(url, "{integration-id}", paramIntegrationId, 1) + + req := cli.Client.Get().URL(url) + + cli.HandleBefore(handlerPath, params, req) + + resp, err := req.Do() + if err != nil { + return nil, nil, errors.Wrap(err, "Request failed") + } + + var decoded map[string]interface{} + + if resp.StatusCode < 400 { + if err := cli.UnmarshalResponse(resp, &decoded); err != nil { + return nil, nil, errors.Wrap(err, "Unmarshalling response failed") + } + } else { + return nil, nil, errors.Errorf("HTTP %d: %s", resp.StatusCode, resp.String()) + } + + after := cli.HandleAfter(handlerPath, params, resp, decoded) + if after != nil { + decoded = after.(map[string]interface{}) + } + + return resp, decoded, nil +} + +// XUpdateDbaasExternalIntegrationSettingsDatadog update-dbaas-external-integration-settings-datadog +func XUpdateDbaasExternalIntegrationSettingsDatadog(paramIntegrationId string, params *viper.Viper, body string) (*gentleman.Response, map[string]interface{}, error) { + handlerPath := "update-dbaas-external-integration-settings-datadog" + if xSubcommand { + handlerPath = "x " + handlerPath + } + + server := viper.GetString("server") + if server == "" { + server = xServers()[viper.GetInt("server-index")]["url"] + } + + url := server + "/dbaas-external-integration-settings-datadog/{integration-id}" + url = strings.Replace(url, "{integration-id}", paramIntegrationId, 1) + + req := cli.Client.Post().URL(url) + + if body != "" { + req = req.AddHeader("Content-Type", "application/json").BodyString(body) + } + + cli.HandleBefore(handlerPath, params, req) + + resp, err := req.Do() + if err != nil { + return nil, nil, errors.Wrap(err, "Request failed") + } + + var decoded map[string]interface{} + + if resp.StatusCode < 400 { + if err := cli.UnmarshalResponse(resp, &decoded); err != nil { + return nil, nil, errors.Wrap(err, "Unmarshalling response failed") + } + } else { + return nil, nil, errors.Errorf("HTTP %d: %s", resp.StatusCode, resp.String()) + } + + after := cli.HandleAfter(handlerPath, params, resp, decoded) + if after != nil { + decoded = after.(map[string]interface{}) + } + + return resp, decoded, nil +} + // XGetDbaasExternalIntegration get-dbaas-external-integration func XGetDbaasExternalIntegration(paramId string, params *viper.Viper) (*gentleman.Response, map[string]interface{}, error) { handlerPath := "get-dbaas-external-integration" @@ -2476,7 +2564,7 @@ func XRevealDbaasGrafanaUserPassword(paramServiceName string, paramUsername stri return resp, decoded, nil } -// XCreateDbaasIntegration Create a new DBaaS integration between two services +// XCreateDbaasIntegration create-dbaas-integration func XCreateDbaasIntegration(params *viper.Viper, body string) (*gentleman.Response, map[string]interface{}, error) { handlerPath := "create-dbaas-integration" if xSubcommand { @@ -2521,7 +2609,7 @@ func XCreateDbaasIntegration(params *viper.Viper, body string) (*gentleman.Respo return resp, decoded, nil } -// XListDbaasIntegrationSettings Get DBaaS integration settings +// XListDbaasIntegrationSettings list-dbaas-integration-settings func XListDbaasIntegrationSettings(paramIntegrationType string, paramSourceType string, paramDestType string, params *viper.Viper) (*gentleman.Response, map[string]interface{}, error) { handlerPath := "list-dbaas-integration-settings" if xSubcommand { @@ -2565,7 +2653,7 @@ func XListDbaasIntegrationSettings(paramIntegrationType string, paramSourceType return resp, decoded, nil } -// XListDbaasIntegrationTypes Get DBaaS integration types +// XListDbaasIntegrationTypes list-dbaas-integration-types func XListDbaasIntegrationTypes(params *viper.Viper) (*gentleman.Response, map[string]interface{}, error) { handlerPath := "list-dbaas-integration-types" if xSubcommand { @@ -2606,7 +2694,7 @@ func XListDbaasIntegrationTypes(params *viper.Viper) (*gentleman.Response, map[s return resp, decoded, nil } -// XDeleteDbaasIntegration Delete a DBaaS Integration +// XDeleteDbaasIntegration delete-dbaas-integration func XDeleteDbaasIntegration(paramId string, params *viper.Viper) (*gentleman.Response, map[string]interface{}, error) { handlerPath := "delete-dbaas-integration" if xSubcommand { @@ -2648,7 +2736,7 @@ func XDeleteDbaasIntegration(paramId string, params *viper.Viper) (*gentleman.Re return resp, decoded, nil } -// XGetDbaasIntegration Get a DBaaS Integration +// XGetDbaasIntegration get-dbaas-integration func XGetDbaasIntegration(paramId string, params *viper.Viper) (*gentleman.Response, map[string]interface{}, error) { handlerPath := "get-dbaas-integration" if xSubcommand { @@ -2690,7 +2778,7 @@ func XGetDbaasIntegration(paramId string, params *viper.Viper) (*gentleman.Respo return resp, decoded, nil } -// XUpdateDbaasIntegration Update a existing DBaaS integration +// XUpdateDbaasIntegration update-dbaas-integration func XUpdateDbaasIntegration(paramId string, params *viper.Viper, body string) (*gentleman.Response, map[string]interface{}, error) { handlerPath := "update-dbaas-integration" if xSubcommand { @@ -14101,6 +14189,80 @@ func xRegister(subcommand bool) { }() + func() { + params := viper.New() + + var examples string + + cmd := &cobra.Command{ + Use: "get-dbaas-external-integration-settings-datadog integration-id", + Short: "get-dbaas-external-integration-settings-datadog", + Long: cli.Markdown("[BETA] Get Datadog integration settings"), + Example: examples, + Args: cobra.MinimumNArgs(1), + Run: func(cmd *cobra.Command, args []string) { + + _, decoded, err := XGetDbaasExternalIntegrationSettingsDatadog(args[0], params) + if err != nil { + log.Fatal().Err(err).Msg("Error calling operation") + } + + if err := cli.Formatter.Format(decoded); err != nil { + log.Fatal().Err(err).Msg("Formatting failed") + } + + }, + } + + root.AddCommand(cmd) + + cli.SetCustomFlags(cmd) + + if cmd.Flags().HasFlags() { + params.BindPFlags(cmd.Flags()) + } + + }() + + func() { + params := viper.New() + + var examples string + + cmd := &cobra.Command{ + Use: "update-dbaas-external-integration-settings-datadog integration-id", + Short: "update-dbaas-external-integration-settings-datadog", + Long: cli.Markdown("[BETA] Manage Datadog integration settings\n## Request Schema (application/json)\n\nproperties:\n settings:\n $ref: '#/components/schemas/dbaas-integration-settings-datadog'\ntype: object\n"), + Example: examples, + Args: cobra.MinimumNArgs(1), + Run: func(cmd *cobra.Command, args []string) { + body, err := cli.GetBody("application/json", args[1:]) + if err != nil { + log.Fatal().Err(err).Msg("Unable to get body") + } + + _, decoded, err := XUpdateDbaasExternalIntegrationSettingsDatadog(args[0], params, body) + if err != nil { + log.Fatal().Err(err).Msg("Error calling operation") + } + + if err := cli.Formatter.Format(decoded); err != nil { + log.Fatal().Err(err).Msg("Formatting failed") + } + + }, + } + + root.AddCommand(cmd) + + cli.SetCustomFlags(cmd) + + if cmd.Flags().HasFlags() { + params.BindPFlags(cmd.Flags()) + } + + }() + func() { params := viper.New() @@ -14439,8 +14601,8 @@ func xRegister(subcommand bool) { cmd := &cobra.Command{ Use: "create-dbaas-integration", - Short: "Create a new DBaaS integration between two services", - Long: cli.Markdown("Create a new DBaaS integration between two services\n## Request Schema (application/json)\n\nproperties:\n dest-service:\n $ref: '#/components/schemas/dbaas-service-name'\n integration-type:\n $ref: '#/components/schemas/enum-integration-types'\n settings:\n description: Integration settings\n type: object\n source-service:\n $ref: '#/components/schemas/dbaas-service-name'\nrequired:\n- integration-type\n- source-service\n- dest-service\ntype: object\n"), + Short: "create-dbaas-integration", + Long: cli.Markdown("[BETA] Create a new DBaaS integration between two services\n## Request Schema (application/json)\n\nproperties:\n dest-service:\n $ref: '#/components/schemas/dbaas-service-name'\n integration-type:\n $ref: '#/components/schemas/enum-integration-types'\n settings:\n description: Integration settings\n type: object\n source-service:\n $ref: '#/components/schemas/dbaas-service-name'\nrequired:\n- integration-type\n- source-service\n- dest-service\ntype: object\n"), Example: examples, Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { @@ -14478,8 +14640,8 @@ func xRegister(subcommand bool) { cmd := &cobra.Command{ Use: "list-dbaas-integration-settings integration-type source-type dest-type", - Short: "Get DBaaS integration settings", - Long: cli.Markdown("Get DBaaS integration settings"), + Short: "list-dbaas-integration-settings", + Long: cli.Markdown("[BETA] Get DBaaS integration settings"), Example: examples, Args: cobra.MinimumNArgs(3), Run: func(cmd *cobra.Command, args []string) { @@ -14513,8 +14675,8 @@ func xRegister(subcommand bool) { cmd := &cobra.Command{ Use: "list-dbaas-integration-types", - Short: "Get DBaaS integration types", - Long: cli.Markdown("Get DBaaS integration types"), + Short: "list-dbaas-integration-types", + Long: cli.Markdown("[BETA] Get DBaaS integration types"), Example: examples, Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { @@ -14548,8 +14710,8 @@ func xRegister(subcommand bool) { cmd := &cobra.Command{ Use: "delete-dbaas-integration id", - Short: "Delete a DBaaS Integration", - Long: cli.Markdown("Delete a DBaaS Integration"), + Short: "delete-dbaas-integration", + Long: cli.Markdown("[BETA] Delete a DBaaS Integration"), Example: examples, Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { @@ -14583,8 +14745,8 @@ func xRegister(subcommand bool) { cmd := &cobra.Command{ Use: "get-dbaas-integration id", - Short: "Get a DBaaS Integration", - Long: cli.Markdown("Get a DBaaS Integration"), + Short: "get-dbaas-integration", + Long: cli.Markdown("[BETA] Get a DBaaS Integration"), Example: examples, Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { @@ -14618,8 +14780,8 @@ func xRegister(subcommand bool) { cmd := &cobra.Command{ Use: "update-dbaas-integration id", - Short: "Update a existing DBaaS integration", - Long: cli.Markdown("Update a existing DBaaS integration\n## Request Schema (application/json)\n\nproperties:\n settings:\n description: Integration settings\n type: object\nrequired:\n- settings\ntype: object\n"), + Short: "update-dbaas-integration", + Long: cli.Markdown("[BETA] Update a existing DBaaS integration\n## Request Schema (application/json)\n\nproperties:\n settings:\n description: Integration settings\n type: object\nrequired:\n- settings\ntype: object\n"), Example: examples, Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { @@ -21605,7 +21767,7 @@ func xRegister(subcommand bool) { cmd := &cobra.Command{ Use: "create-sks-nodepool id", Short: "Create a new SKS Nodepool", - Long: cli.Markdown("\n## Request Schema (application/json)\n\nproperties:\n addons:\n description: Nodepool addons\n items:\n enum:\n - storage-lvm\n type: string\n type: array\n uniqueItems: true\n anti-affinity-groups:\n description: Nodepool Anti-affinity Groups\n items:\n $ref: '#/components/schemas/anti-affinity-group'\n type: array\n uniqueItems: true\n deploy-target:\n $ref: '#/components/schemas/deploy-target'\n description:\n description: Nodepool description\n maxLength: 255\n type: string\n disk-size:\n description: Nodepool instances disk size in GiB\n format: int64\n maximum: 51200\n minimum: 20\n type: integer\n instance-prefix:\n description: 'Prefix to apply to instances names (default: pool)'\n maxLength: 30\n minLength: 1\n type: string\n instance-type:\n $ref: '#/components/schemas/instance-type'\n kubelet-image-gc:\n $ref: '#/components/schemas/kubelet-image-gc'\n labels:\n $ref: '#/components/schemas/labels'\n name:\n description: Nodepool name\n maxLength: 255\n minLength: 1\n type: string\n private-networks:\n description: Nodepool Private Networks\n items:\n $ref: '#/components/schemas/private-network'\n type: array\n uniqueItems: true\n public-ip-assignment:\n description: |-\n Configures public IP assignment of the Instances with:\n\n * IPv4 (`inet4`) addressing only (default);\n * both IPv4 and IPv6 (`dual`) addressing.\n enum:\n - inet4\n - dual\n type: string\n security-groups:\n description: Nodepool Security Groups\n items:\n $ref: '#/components/schemas/security-group'\n type: array\n uniqueItems: true\n size:\n description: Number of instances\n exclusiveMinimum: true\n format: int64\n minimum: 0\n type: integer\n taints:\n $ref: '#/components/schemas/sks-nodepool-taints'\nrequired:\n- name\n- size\n- disk-size\n- instance-type\ntype: object\n"), + Long: cli.Markdown("\n## Request Schema (application/json)\n\nproperties:\n addons:\n description: Nodepool addons\n items:\n enum:\n - storage-lvm\n type: string\n type: array\n uniqueItems: true\n anti-affinity-groups:\n description: Nodepool Anti-affinity Groups\n items:\n $ref: '#/components/schemas/anti-affinity-group'\n type: array\n uniqueItems: true\n deploy-target:\n $ref: '#/components/schemas/deploy-target'\n description:\n description: Nodepool description\n maxLength: 255\n type: string\n disk-size:\n description: Nodepool instances disk size in GiB\n format: int64\n maximum: 51200\n minimum: 20\n type: integer\n instance-prefix:\n description: 'Prefix to apply to instances names (default: pool), lowercase only'\n maxLength: 30\n minLength: 1\n type: string\n instance-type:\n $ref: '#/components/schemas/instance-type'\n kubelet-image-gc:\n $ref: '#/components/schemas/kubelet-image-gc'\n labels:\n $ref: '#/components/schemas/labels'\n name:\n description: Nodepool name, lowercase only\n maxLength: 255\n minLength: 1\n type: string\n private-networks:\n description: Nodepool Private Networks\n items:\n $ref: '#/components/schemas/private-network'\n type: array\n uniqueItems: true\n public-ip-assignment:\n description: |-\n Configures public IP assignment of the Instances with:\n\n * IPv4 (`inet4`) addressing only (default);\n * both IPv4 and IPv6 (`dual`) addressing.\n enum:\n - inet4\n - dual\n type: string\n security-groups:\n description: Nodepool Security Groups\n items:\n $ref: '#/components/schemas/security-group'\n type: array\n uniqueItems: true\n size:\n description: Number of instances\n exclusiveMinimum: true\n format: int64\n minimum: 0\n type: integer\n taints:\n $ref: '#/components/schemas/sks-nodepool-taints'\nrequired:\n- name\n- size\n- disk-size\n- instance-type\ntype: object\n"), Example: examples, Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { @@ -21714,7 +21876,7 @@ func xRegister(subcommand bool) { cmd := &cobra.Command{ Use: "update-sks-nodepool id sks-nodepool-id", Short: "Update an SKS Nodepool", - Long: cli.Markdown("\n## Request Schema (application/json)\n\nproperties:\n anti-affinity-groups:\n description: Nodepool Anti-affinity Groups\n items:\n $ref: '#/components/schemas/anti-affinity-group'\n type: array\n uniqueItems: true\n deploy-target:\n $ref: '#/components/schemas/deploy-target'\n description:\n description: Nodepool description\n maxLength: 255\n type: string\n disk-size:\n description: Nodepool instances disk size in GiB\n format: int64\n maximum: 51200\n minimum: 20\n type: integer\n instance-prefix:\n description: 'Prefix to apply to managed instances names (default: pool)'\n maxLength: 30\n minLength: 1\n type: string\n instance-type:\n $ref: '#/components/schemas/instance-type'\n labels:\n $ref: '#/components/schemas/labels'\n name:\n description: Nodepool name\n maxLength: 255\n minLength: 1\n type: string\n private-networks:\n description: Nodepool Private Networks\n items:\n $ref: '#/components/schemas/private-network'\n type: array\n uniqueItems: true\n public-ip-assignment:\n description: |-\n Configures public IP assignment of the Instances with:\n\n * IPv4 (`inet4`) addressing only;\n * both IPv4 and IPv6 (`dual`) addressing.\n enum:\n - inet4\n - dual\n type: string\n security-groups:\n description: Nodepool Security Groups\n items:\n $ref: '#/components/schemas/security-group'\n type: array\n uniqueItems: true\n taints:\n $ref: '#/components/schemas/sks-nodepool-taints'\ntype: object\n"), + Long: cli.Markdown("\n## Request Schema (application/json)\n\nproperties:\n anti-affinity-groups:\n description: Nodepool Anti-affinity Groups\n items:\n $ref: '#/components/schemas/anti-affinity-group'\n type: array\n uniqueItems: true\n deploy-target:\n $ref: '#/components/schemas/deploy-target'\n description:\n description: Nodepool description\n maxLength: 255\n type: string\n disk-size:\n description: Nodepool instances disk size in GiB\n format: int64\n maximum: 51200\n minimum: 20\n type: integer\n instance-prefix:\n description: 'Prefix to apply to managed instances names (default: pool), lowercase only'\n maxLength: 30\n minLength: 1\n type: string\n instance-type:\n $ref: '#/components/schemas/instance-type'\n labels:\n $ref: '#/components/schemas/labels'\n name:\n description: Nodepool name, lowercase only\n maxLength: 255\n minLength: 1\n type: string\n private-networks:\n description: Nodepool Private Networks\n items:\n $ref: '#/components/schemas/private-network'\n type: array\n uniqueItems: true\n public-ip-assignment:\n description: |-\n Configures public IP assignment of the Instances with:\n\n * IPv4 (`inet4`) addressing only;\n * both IPv4 and IPv6 (`dual`) addressing.\n enum:\n - inet4\n - dual\n type: string\n security-groups:\n description: Nodepool Security Groups\n items:\n $ref: '#/components/schemas/security-group'\n type: array\n uniqueItems: true\n taints:\n $ref: '#/components/schemas/sks-nodepool-taints'\ntype: object\n"), Example: examples, Args: cobra.MinimumNArgs(2), Run: func(cmd *cobra.Command, args []string) { diff --git a/vendor/github.com/exoscale/egoscale/v3/operations.go b/vendor/github.com/exoscale/egoscale/v3/operations.go index 8a103355..d7f02d6f 100644 --- a/vendor/github.com/exoscale/egoscale/v3/operations.go +++ b/vendor/github.com/exoscale/egoscale/v3/operations.go @@ -1196,6 +1196,1299 @@ func (c Client) GetDBAASCACertificate(ctx context.Context) (*GetDBAASCACertifica return bodyresp, nil } +// [BETA] Delete DataDog external integration endpoint +func (c Client) DeleteDBAASExternalEndpointDatadog(ctx context.Context, id UUID) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-datadog/%v", id) + + request, err := http.NewRequestWithContext(ctx, "DELETE", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointDatadog: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointDatadog: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointDatadog: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "delete-dbaas-external-endpoint-datadog") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointDatadog: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointDatadog: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointDatadog: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +// [BETA] Get DataDog external endpoint settings +func (c Client) GetDBAASExternalEndpointDatadog(ctx context.Context, id UUID) (*DBAASExternalEndpointDatadogOutput, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-datadog/%v", id) + + request, err := http.NewRequestWithContext(ctx, "GET", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointDatadog: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointDatadog: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointDatadog: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "get-dbaas-external-endpoint-datadog") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointDatadog: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointDatadog: http response: %w", err) + } + + bodyresp := &DBAASExternalEndpointDatadogOutput{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointDatadog: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type UpdateDBAASExternalEndpointDatadogRequest struct { + Settings *DBAASEndpointDatadog `json:"settings,omitempty"` +} + +// [BETA] Update DataDog external integration endpoint +func (c Client) UpdateDBAASExternalEndpointDatadog(ctx context.Context, id UUID, req UpdateDBAASExternalEndpointDatadogRequest) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-datadog/%v", id) + + body, err := prepareJSONBody(req) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointDatadog: prepare Json body: %w", err) + } + + request, err := http.NewRequestWithContext(ctx, "PUT", c.serverEndpoint+path, body) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointDatadog: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + request.Header.Add("Content-Type", "application/json") + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointDatadog: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointDatadog: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "update-dbaas-external-endpoint-datadog") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointDatadog: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointDatadog: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointDatadog: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type CreateDBAASExternalEndpointDatadogRequest struct { + Settings *DBAASEndpointDatadog `json:"settings,omitempty"` +} + +// [BETA] Create DataDog external integration endpoint +func (c Client) CreateDBAASExternalEndpointDatadog(ctx context.Context, name string, req CreateDBAASExternalEndpointDatadogRequest) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-datadog/%v", name) + + body, err := prepareJSONBody(req) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointDatadog: prepare Json body: %w", err) + } + + request, err := http.NewRequestWithContext(ctx, "POST", c.serverEndpoint+path, body) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointDatadog: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + request.Header.Add("Content-Type", "application/json") + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointDatadog: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointDatadog: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "create-dbaas-external-endpoint-datadog") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointDatadog: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointDatadog: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointDatadog: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +// [BETA] Delete ElasticSearch logs external integration endpoint +func (c Client) DeleteDBAASExternalEndpointElasticsearch(ctx context.Context, id UUID) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-elasticsearch/%v", id) + + request, err := http.NewRequestWithContext(ctx, "DELETE", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointElasticsearch: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointElasticsearch: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointElasticsearch: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "delete-dbaas-external-endpoint-elasticsearch") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointElasticsearch: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointElasticsearch: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointElasticsearch: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +// [BETA] Get ElasticSearch Logs external integration endpoint settings +func (c Client) GetDBAASExternalEndpointElasticsearch(ctx context.Context, id UUID) (*DBAASEndpointElasticsearchOutput, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-elasticsearch/%v", id) + + request, err := http.NewRequestWithContext(ctx, "GET", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointElasticsearch: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointElasticsearch: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointElasticsearch: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "get-dbaas-external-endpoint-elasticsearch") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointElasticsearch: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointElasticsearch: http response: %w", err) + } + + bodyresp := &DBAASEndpointElasticsearchOutput{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointElasticsearch: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type UpdateDBAASExternalEndpointElasticsearchRequest struct { + Settings *DBAASEndpointElasticsearch `json:"settings,omitempty"` +} + +// [BETA] Update ElasticSearch Logs external integration endpoint +func (c Client) UpdateDBAASExternalEndpointElasticsearch(ctx context.Context, id UUID, req UpdateDBAASExternalEndpointElasticsearchRequest) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-elasticsearch/%v", id) + + body, err := prepareJSONBody(req) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointElasticsearch: prepare Json body: %w", err) + } + + request, err := http.NewRequestWithContext(ctx, "PUT", c.serverEndpoint+path, body) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointElasticsearch: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + request.Header.Add("Content-Type", "application/json") + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointElasticsearch: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointElasticsearch: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "update-dbaas-external-endpoint-elasticsearch") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointElasticsearch: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointElasticsearch: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointElasticsearch: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type CreateDBAASExternalEndpointElasticsearchRequest struct { + Settings *DBAASEndpointElasticsearch `json:"settings,omitempty"` +} + +// [BETA] Create ElasticSearch Logs external integration endpoint +func (c Client) CreateDBAASExternalEndpointElasticsearch(ctx context.Context, name string, req CreateDBAASExternalEndpointElasticsearchRequest) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-elasticsearch/%v", name) + + body, err := prepareJSONBody(req) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointElasticsearch: prepare Json body: %w", err) + } + + request, err := http.NewRequestWithContext(ctx, "POST", c.serverEndpoint+path, body) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointElasticsearch: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + request.Header.Add("Content-Type", "application/json") + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointElasticsearch: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointElasticsearch: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "create-dbaas-external-endpoint-elasticsearch") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointElasticsearch: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointElasticsearch: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointElasticsearch: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +// [BETA] Delete OpenSearch logs external integration endpoint +func (c Client) DeleteDBAASExternalEndpointOpensearch(ctx context.Context, id UUID) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-opensearch/%v", id) + + request, err := http.NewRequestWithContext(ctx, "DELETE", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointOpensearch: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointOpensearch: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointOpensearch: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "delete-dbaas-external-endpoint-opensearch") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointOpensearch: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointOpensearch: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointOpensearch: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +// [BETA] Get OpenSearch Logs external integration endpoint settings +func (c Client) GetDBAASExternalEndpointOpensearch(ctx context.Context, id UUID) (*DBAASEndpointOpensearchOutput, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-opensearch/%v", id) + + request, err := http.NewRequestWithContext(ctx, "GET", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointOpensearch: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointOpensearch: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointOpensearch: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "get-dbaas-external-endpoint-opensearch") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointOpensearch: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointOpensearch: http response: %w", err) + } + + bodyresp := &DBAASEndpointOpensearchOutput{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointOpensearch: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type UpdateDBAASExternalEndpointOpensearchRequest struct { + Settings *DBAASEndpointOpensearch `json:"settings,omitempty"` +} + +// [BETA] Update OpenSearch Logs external integration endpoint +func (c Client) UpdateDBAASExternalEndpointOpensearch(ctx context.Context, id UUID, req UpdateDBAASExternalEndpointOpensearchRequest) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-opensearch/%v", id) + + body, err := prepareJSONBody(req) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointOpensearch: prepare Json body: %w", err) + } + + request, err := http.NewRequestWithContext(ctx, "PUT", c.serverEndpoint+path, body) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointOpensearch: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + request.Header.Add("Content-Type", "application/json") + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointOpensearch: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointOpensearch: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "update-dbaas-external-endpoint-opensearch") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointOpensearch: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointOpensearch: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointOpensearch: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type CreateDBAASExternalEndpointOpensearchRequest struct { + Settings *DBAASEndpointOpensearch `json:"settings,omitempty"` +} + +// [BETA] Create OpenSearch Logs external integration endpoint +func (c Client) CreateDBAASExternalEndpointOpensearch(ctx context.Context, name string, req CreateDBAASExternalEndpointOpensearchRequest) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-opensearch/%v", name) + + body, err := prepareJSONBody(req) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointOpensearch: prepare Json body: %w", err) + } + + request, err := http.NewRequestWithContext(ctx, "POST", c.serverEndpoint+path, body) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointOpensearch: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + request.Header.Add("Content-Type", "application/json") + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointOpensearch: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointOpensearch: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "create-dbaas-external-endpoint-opensearch") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointOpensearch: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointOpensearch: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointOpensearch: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +// [BETA] Delete Prometheus external integration endpoint +func (c Client) DeleteDBAASExternalEndpointPrometheus(ctx context.Context, id UUID) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-prometheus/%v", id) + + request, err := http.NewRequestWithContext(ctx, "DELETE", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointPrometheus: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointPrometheus: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointPrometheus: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "delete-dbaas-external-endpoint-prometheus") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointPrometheus: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointPrometheus: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointPrometheus: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +// [BETA] Get Prometheus external integration endpoint settings +func (c Client) GetDBAASExternalEndpointPrometheus(ctx context.Context, id UUID) (*DBAASEndpointExternalPrometheusOutput, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-prometheus/%v", id) + + request, err := http.NewRequestWithContext(ctx, "GET", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointPrometheus: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointPrometheus: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointPrometheus: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "get-dbaas-external-endpoint-prometheus") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointPrometheus: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointPrometheus: http response: %w", err) + } + + bodyresp := &DBAASEndpointExternalPrometheusOutput{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointPrometheus: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type UpdateDBAASExternalEndpointPrometheusRequest struct { + Settings *DBAASEndpointPrometheus `json:"settings,omitempty"` +} + +// [BETA] Update Prometheus external integration endpoint +func (c Client) UpdateDBAASExternalEndpointPrometheus(ctx context.Context, id UUID, req UpdateDBAASExternalEndpointPrometheusRequest) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-prometheus/%v", id) + + body, err := prepareJSONBody(req) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointPrometheus: prepare Json body: %w", err) + } + + request, err := http.NewRequestWithContext(ctx, "PUT", c.serverEndpoint+path, body) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointPrometheus: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + request.Header.Add("Content-Type", "application/json") + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointPrometheus: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointPrometheus: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "update-dbaas-external-endpoint-prometheus") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointPrometheus: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointPrometheus: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointPrometheus: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type CreateDBAASExternalEndpointPrometheusRequest struct { + Settings *DBAASEndpointPrometheus `json:"settings,omitempty"` +} + +// [BETA] Create Prometheus external integration endpoint +func (c Client) CreateDBAASExternalEndpointPrometheus(ctx context.Context, name string, req CreateDBAASExternalEndpointPrometheusRequest) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-prometheus/%v", name) + + body, err := prepareJSONBody(req) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointPrometheus: prepare Json body: %w", err) + } + + request, err := http.NewRequestWithContext(ctx, "POST", c.serverEndpoint+path, body) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointPrometheus: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + request.Header.Add("Content-Type", "application/json") + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointPrometheus: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointPrometheus: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "create-dbaas-external-endpoint-prometheus") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointPrometheus: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointPrometheus: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointPrometheus: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +// [BETA] Delete RSyslog external integration endpoint +func (c Client) DeleteDBAASExternalEndpointRsyslog(ctx context.Context, id UUID) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-rsyslog/%v", id) + + request, err := http.NewRequestWithContext(ctx, "DELETE", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointRsyslog: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointRsyslog: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointRsyslog: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "delete-dbaas-external-endpoint-rsyslog") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointRsyslog: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointRsyslog: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("DeleteDBAASExternalEndpointRsyslog: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +// [BETA] Get RSyslog external integration endpoint settings +func (c Client) GetDBAASExternalEndpointRsyslog(ctx context.Context, id UUID) (*DBAASExternalEndpointRsyslogOutput, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-rsyslog/%v", id) + + request, err := http.NewRequestWithContext(ctx, "GET", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointRsyslog: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointRsyslog: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointRsyslog: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "get-dbaas-external-endpoint-rsyslog") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointRsyslog: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointRsyslog: http response: %w", err) + } + + bodyresp := &DBAASExternalEndpointRsyslogOutput{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("GetDBAASExternalEndpointRsyslog: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type UpdateDBAASExternalEndpointRsyslogRequest struct { + Settings *DBAASEndpointRsyslog `json:"settings,omitempty"` +} + +// [BETA] Update RSyslog external integration endpoint +func (c Client) UpdateDBAASExternalEndpointRsyslog(ctx context.Context, id UUID, req UpdateDBAASExternalEndpointRsyslogRequest) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-rsyslog/%v", id) + + body, err := prepareJSONBody(req) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointRsyslog: prepare Json body: %w", err) + } + + request, err := http.NewRequestWithContext(ctx, "PUT", c.serverEndpoint+path, body) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointRsyslog: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + request.Header.Add("Content-Type", "application/json") + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointRsyslog: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointRsyslog: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "update-dbaas-external-endpoint-rsyslog") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointRsyslog: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointRsyslog: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("UpdateDBAASExternalEndpointRsyslog: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type CreateDBAASExternalEndpointRsyslogRequest struct { + Settings *DBAASEndpointRsyslog `json:"settings,omitempty"` +} + +// [BETA] Create RSyslog external integration endpoint +func (c Client) CreateDBAASExternalEndpointRsyslog(ctx context.Context, name string, req CreateDBAASExternalEndpointRsyslogRequest) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint-rsyslog/%v", name) + + body, err := prepareJSONBody(req) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointRsyslog: prepare Json body: %w", err) + } + + request, err := http.NewRequestWithContext(ctx, "POST", c.serverEndpoint+path, body) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointRsyslog: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + request.Header.Add("Content-Type", "application/json") + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointRsyslog: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointRsyslog: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "create-dbaas-external-endpoint-rsyslog") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointRsyslog: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointRsyslog: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("CreateDBAASExternalEndpointRsyslog: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type ListDBAASExternalEndpointTypesResponseEndpointTypes struct { + ServiceTypes []string `json:"service-types,omitempty"` + Title string `json:"title,omitempty"` + Type EnumExternalEndpointTypes `json:"type,omitempty"` +} + +type ListDBAASExternalEndpointTypesResponse struct { + EndpointTypes []ListDBAASExternalEndpointTypesResponseEndpointTypes `json:"endpoint-types,omitempty"` +} + +// [BETA] List available external endpoint types and their schemas for DBaaS external integrations +func (c Client) ListDBAASExternalEndpointTypes(ctx context.Context) (*ListDBAASExternalEndpointTypesResponse, error) { + path := "/dbaas-external-endpoint-types" + + request, err := http.NewRequestWithContext(ctx, "GET", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("ListDBAASExternalEndpointTypes: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("ListDBAASExternalEndpointTypes: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("ListDBAASExternalEndpointTypes: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "list-dbaas-external-endpoint-types") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("ListDBAASExternalEndpointTypes: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("ListDBAASExternalEndpointTypes: http response: %w", err) + } + + bodyresp := &ListDBAASExternalEndpointTypesResponse{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("ListDBAASExternalEndpointTypes: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type AttachDBAASServiceToEndpointRequest struct { + // External endpoint id + DestEndpointID UUID `json:"dest-endpoint-id" validate:"required"` + Type EnumExternalEndpointTypes `json:"type" validate:"required"` +} + +// [BETA] Create a new DBaaS connection between a DBaaS service and an external service +func (c Client) AttachDBAASServiceToEndpoint(ctx context.Context, sourceServiceName string, req AttachDBAASServiceToEndpointRequest) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint/%v/attach", sourceServiceName) + + body, err := prepareJSONBody(req) + if err != nil { + return nil, fmt.Errorf("AttachDBAASServiceToEndpoint: prepare Json body: %w", err) + } + + request, err := http.NewRequestWithContext(ctx, "PUT", c.serverEndpoint+path, body) + if err != nil { + return nil, fmt.Errorf("AttachDBAASServiceToEndpoint: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + request.Header.Add("Content-Type", "application/json") + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("AttachDBAASServiceToEndpoint: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("AttachDBAASServiceToEndpoint: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "attach-dbaas-service-to-endpoint") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("AttachDBAASServiceToEndpoint: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("AttachDBAASServiceToEndpoint: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("AttachDBAASServiceToEndpoint: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type DetachDBAASServiceFromEndpointRequest struct { + // External Integration ID + IntegrationID UUID `json:"integration-id" validate:"required"` +} + +// [BETA] Detach a DBaaS external integration from a service +func (c Client) DetachDBAASServiceFromEndpoint(ctx context.Context, sourceServiceName string, req DetachDBAASServiceFromEndpointRequest) (*Operation, error) { + path := fmt.Sprintf("/dbaas-external-endpoint/%v/detach", sourceServiceName) + + body, err := prepareJSONBody(req) + if err != nil { + return nil, fmt.Errorf("DetachDBAASServiceFromEndpoint: prepare Json body: %w", err) + } + + request, err := http.NewRequestWithContext(ctx, "PUT", c.serverEndpoint+path, body) + if err != nil { + return nil, fmt.Errorf("DetachDBAASServiceFromEndpoint: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + request.Header.Add("Content-Type", "application/json") + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("DetachDBAASServiceFromEndpoint: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("DetachDBAASServiceFromEndpoint: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "detach-dbaas-service-from-endpoint") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("DetachDBAASServiceFromEndpoint: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("DetachDBAASServiceFromEndpoint: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("DetachDBAASServiceFromEndpoint: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type ListDBAASExternalEndpointsResponse struct { + DBAASEndpoints []DBAASExternalEndpoint `json:"dbaas-endpoints,omitempty"` +} + +// FindDBAASExternalEndpoint attempts to find an DBAASExternalEndpoint by nameOrID. +func (l ListDBAASExternalEndpointsResponse) FindDBAASExternalEndpoint(nameOrID string) (DBAASExternalEndpoint, error) { + for i, elem := range l.DBAASEndpoints { + if string(elem.Name) == nameOrID || elem.ID.String() == nameOrID { + return l.DBAASEndpoints[i], nil + } + } + + return DBAASExternalEndpoint{}, fmt.Errorf("%q not found in ListDBAASExternalEndpointsResponse: %w", nameOrID, ErrNotFound) +} + +// [BETA] List available external endpoints for integrations +func (c Client) ListDBAASExternalEndpoints(ctx context.Context) (*ListDBAASExternalEndpointsResponse, error) { + path := "/dbaas-external-endpoints" + + request, err := http.NewRequestWithContext(ctx, "GET", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("ListDBAASExternalEndpoints: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("ListDBAASExternalEndpoints: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("ListDBAASExternalEndpoints: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "list-dbaas-external-endpoints") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("ListDBAASExternalEndpoints: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("ListDBAASExternalEndpoints: http response: %w", err) + } + + bodyresp := &ListDBAASExternalEndpointsResponse{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("ListDBAASExternalEndpoints: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +// [BETA] Get a DBaaS external integration +func (c Client) GetDBAASExternalIntegration(ctx context.Context, id UUID) (*DBAASExternalIntegration, error) { + path := fmt.Sprintf("/dbaas-external-integration/%v", id) + + request, err := http.NewRequestWithContext(ctx, "GET", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("GetDBAASExternalIntegration: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("GetDBAASExternalIntegration: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("GetDBAASExternalIntegration: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "get-dbaas-external-integration") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("GetDBAASExternalIntegration: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("GetDBAASExternalIntegration: http response: %w", err) + } + + bodyresp := &DBAASExternalIntegration{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("GetDBAASExternalIntegration: prepare Json response: %w", err) + } + + return bodyresp, nil +} + +type ListDBAASExternalIntegrationsResponse struct { + ExternalIntegrations []DBAASExternalIntegration `json:"external-integrations,omitempty"` +} + +// FindDBAASExternalIntegration attempts to find an DBAASExternalIntegration by ID. +func (l ListDBAASExternalIntegrationsResponse) FindDBAASExternalIntegration(ID string) (DBAASExternalIntegration, error) { + for i, elem := range l.ExternalIntegrations { + if elem.ID.String() == ID { + return l.ExternalIntegrations[i], nil + } + } + + return DBAASExternalIntegration{}, fmt.Errorf("%q not found in ListDBAASExternalIntegrationsResponse: %w", ID, ErrNotFound) +} + +// [BETA] List all DBaaS connections between services and external endpoints +func (c Client) ListDBAASExternalIntegrations(ctx context.Context, serviceName string) (*ListDBAASExternalIntegrationsResponse, error) { + path := fmt.Sprintf("/dbaas-external-integrations/%v", serviceName) + + request, err := http.NewRequestWithContext(ctx, "GET", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("ListDBAASExternalIntegrations: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("ListDBAASExternalIntegrations: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("ListDBAASExternalIntegrations: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "list-dbaas-external-integrations") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("ListDBAASExternalIntegrations: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("ListDBAASExternalIntegrations: http response: %w", err) + } + + bodyresp := &ListDBAASExternalIntegrationsResponse{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("ListDBAASExternalIntegrations: prepare Json response: %w", err) + } + + return bodyresp, nil +} + // Delete a Grafana service func (c Client) DeleteDBAASServiceGrafana(ctx context.Context, name string) (*Operation, error) { path := fmt.Sprintf("/dbaas-grafana/%v", name) @@ -1599,7 +2892,7 @@ type CreateDBAASIntegrationRequest struct { SourceService DBAASServiceName `json:"source-service" validate:"required,gte=0,lte=63"` } -// Create a new DBaaS integration between two services +// [BETA] Create a new DBaaS integration between two services func (c Client) CreateDBAASIntegration(ctx context.Context, req CreateDBAASIntegrationRequest) (*Operation, error) { path := "/dbaas-integration" @@ -1662,7 +2955,7 @@ type ListDBAASIntegrationSettingsResponse struct { Settings *ListDBAASIntegrationSettingsResponseSettings `json:"settings,omitempty"` } -// Get DBaaS integration settings +// [BETA] Get DBaaS integration settings func (c Client) ListDBAASIntegrationSettings(ctx context.Context, integrationType string, sourceType string, destType string) (*ListDBAASIntegrationSettingsResponse, error) { path := fmt.Sprintf("/dbaas-integration-settings/%v/%v/%v", integrationType, sourceType, destType) @@ -1709,7 +3002,7 @@ type ListDBAASIntegrationTypesResponse struct { DBAASIntegrationTypes []DBAASIntegrationType `json:"dbaas-integration-types,omitempty"` } -// Get DBaaS integration types +// [BETA] Get DBaaS integration types func (c Client) ListDBAASIntegrationTypes(ctx context.Context) (*ListDBAASIntegrationTypesResponse, error) { path := "/dbaas-integration-types" @@ -1752,7 +3045,7 @@ func (c Client) ListDBAASIntegrationTypes(ctx context.Context) (*ListDBAASIntegr return bodyresp, nil } -// Delete a DBaaS Integration +// [BETA] Delete a DBaaS Integration func (c Client) DeleteDBAASIntegration(ctx context.Context, id UUID) (*Operation, error) { path := fmt.Sprintf("/dbaas-integration/%v", id) @@ -1795,7 +3088,7 @@ func (c Client) DeleteDBAASIntegration(ctx context.Context, id UUID) (*Operation return bodyresp, nil } -// Get a DBaaS Integration +// [BETA] Get a DBaaS Integration func (c Client) GetDBAASIntegration(ctx context.Context, id UUID) (*DBAASIntegration, error) { path := fmt.Sprintf("/dbaas-integration/%v", id) @@ -1843,7 +3136,7 @@ type UpdateDBAASIntegrationRequest struct { Settings map[string]any `json:"settings" validate:"required"` } -// Update a existing DBaaS integration +// [BETA] Update a existing DBaaS integration func (c Client) UpdateDBAASIntegration(ctx context.Context, id UUID, req UpdateDBAASIntegrationRequest) (*Operation, error) { path := fmt.Sprintf("/dbaas-integration/%v", id) @@ -2467,6 +3760,49 @@ func (c Client) DeleteDBAASKafkaTopicAclConfig(ctx context.Context, name string, return bodyresp, nil } +// Reveal the secrets for DBaaS Kafka Connect +func (c Client) RevealDBAASKafkaConnectPassword(ctx context.Context, serviceName string) (*DBAASUserKafkaConnectSecrets, error) { + path := fmt.Sprintf("/dbaas-kafka/%v/connect/password/reveal", serviceName) + + request, err := http.NewRequestWithContext(ctx, "GET", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("RevealDBAASKafkaConnectPassword: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("RevealDBAASKafkaConnectPassword: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("RevealDBAASKafkaConnectPassword: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "reveal-dbaas-kafka-connect-password") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("RevealDBAASKafkaConnectPassword: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("RevealDBAASKafkaConnectPassword: http response: %w", err) + } + + bodyresp := &DBAASUserKafkaConnectSecrets{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("RevealDBAASKafkaConnectPassword: prepare Json response: %w", err) + } + + return bodyresp, nil +} + type CreateDBAASKafkaUserRequest struct { Username DBAASUserUsername `json:"username" validate:"required,gte=1,lte=64"` } @@ -3046,6 +4382,49 @@ func (c Client) UpdateDBAASServiceMysql(ctx context.Context, name string, req Up return bodyresp, nil } +// Temporarily enable writes for MySQL services in read-only mode due to filled up storage +func (c Client) EnableDBAASMysqlWrites(ctx context.Context, name string) (*Operation, error) { + path := fmt.Sprintf("/dbaas-mysql/%v/enable/writes", name) + + request, err := http.NewRequestWithContext(ctx, "PUT", c.serverEndpoint+path, nil) + if err != nil { + return nil, fmt.Errorf("EnableDBAASMysqlWrites: new request: %w", err) + } + request.Header.Add("User-Agent", UserAgent) + + if err := c.executeRequestInterceptors(ctx, request); err != nil { + return nil, fmt.Errorf("EnableDBAASMysqlWrites: execute request editors: %w", err) + } + + if err := c.signRequest(request); err != nil { + return nil, fmt.Errorf("EnableDBAASMysqlWrites: sign request: %w", err) + } + + if c.trace { + dumpRequest(request, "enable-dbaas-mysql-writes") + } + + response, err := c.httpClient.Do(request) + if err != nil { + return nil, fmt.Errorf("EnableDBAASMysqlWrites: http client do: %w", err) + } + + if c.trace { + dumpResponse(response) + } + + if err := handleHTTPErrorResp(response); err != nil { + return nil, fmt.Errorf("EnableDBAASMysqlWrites: http response: %w", err) + } + + bodyresp := &Operation{} + if err := prepareJSONResponse(response, bodyresp); err != nil { + return nil, fmt.Errorf("EnableDBAASMysqlWrites: prepare Json response: %w", err) + } + + return bodyresp, nil +} + // Initiate MySQL maintenance update func (c Client) StartDBAASMysqlMaintenance(ctx context.Context, name string) (*Operation, error) { path := fmt.Sprintf("/dbaas-mysql/%v/maintenance/start", name) @@ -12393,6 +13772,13 @@ func (c Client) GetSKSClusterInspection(ctx context.Context, id UUID) (*GetSKSCl return bodyresp, nil } +type CreateSKSNodepoolRequestPublicIPAssignment string + +const ( + CreateSKSNodepoolRequestPublicIPAssignmentInet4 CreateSKSNodepoolRequestPublicIPAssignment = "inet4" + CreateSKSNodepoolRequestPublicIPAssignmentDual CreateSKSNodepoolRequestPublicIPAssignment = "dual" +) + type CreateSKSNodepoolRequest struct { // Nodepool addons Addons []string `json:"addons,omitempty"` @@ -12404,17 +13790,21 @@ type CreateSKSNodepoolRequest struct { Description string `json:"description,omitempty" validate:"omitempty,lte=255"` // Nodepool instances disk size in GiB DiskSize int64 `json:"disk-size" validate:"required,gte=20,lte=51200"` - // Prefix to apply to instances names (default: pool) + // Prefix to apply to instances names (default: pool), lowercase only InstancePrefix string `json:"instance-prefix,omitempty" validate:"omitempty,gte=1,lte=30"` // Compute instance type InstanceType *InstanceType `json:"instance-type" validate:"required"` // Kubelet image GC options KubeletImageGC *KubeletImageGC `json:"kubelet-image-gc,omitempty"` Labels Labels `json:"labels,omitempty"` - // Nodepool name + // Nodepool name, lowercase only Name string `json:"name" validate:"required,gte=1,lte=255"` // Nodepool Private Networks PrivateNetworks []PrivateNetwork `json:"private-networks,omitempty"` + // Configures public IP assignment of the Instances with: + // * both IPv4 and IPv6 (`dual`) addressing. + // * both IPv4 and IPv6 (`dual`) addressing. + PublicIPAssignment CreateSKSNodepoolRequestPublicIPAssignment `json:"public-ip-assignment,omitempty"` // Nodepool Security Groups SecurityGroups []SecurityGroup `json:"security-groups,omitempty"` // Number of instances @@ -12558,6 +13948,13 @@ func (c Client) GetSKSNodepool(ctx context.Context, id UUID, sksNodepoolID UUID) return bodyresp, nil } +type UpdateSKSNodepoolRequestPublicIPAssignment string + +const ( + UpdateSKSNodepoolRequestPublicIPAssignmentInet4 UpdateSKSNodepoolRequestPublicIPAssignment = "inet4" + UpdateSKSNodepoolRequestPublicIPAssignmentDual UpdateSKSNodepoolRequestPublicIPAssignment = "dual" +) + type UpdateSKSNodepoolRequest struct { // Nodepool Anti-affinity Groups AntiAffinityGroups []AntiAffinityGroup `json:"anti-affinity-groups,omitempty"` @@ -12567,15 +13964,19 @@ type UpdateSKSNodepoolRequest struct { Description string `json:"description,omitempty" validate:"omitempty,lte=255"` // Nodepool instances disk size in GiB DiskSize int64 `json:"disk-size,omitempty" validate:"omitempty,gte=20,lte=51200"` - // Prefix to apply to managed instances names (default: pool) + // Prefix to apply to managed instances names (default: pool), lowercase only InstancePrefix string `json:"instance-prefix,omitempty" validate:"omitempty,gte=1,lte=30"` // Compute instance type InstanceType *InstanceType `json:"instance-type,omitempty"` Labels Labels `json:"labels,omitempty"` - // Nodepool name + // Nodepool name, lowercase only Name string `json:"name,omitempty" validate:"omitempty,gte=1,lte=255"` // Nodepool Private Networks PrivateNetworks []PrivateNetwork `json:"private-networks,omitempty"` + // Configures public IP assignment of the Instances with: + // * both IPv4 and IPv6 (`dual`) addressing. + // * both IPv4 and IPv6 (`dual`) addressing. + PublicIPAssignment UpdateSKSNodepoolRequestPublicIPAssignment `json:"public-ip-assignment,omitempty"` // Nodepool Security Groups SecurityGroups []SecurityGroup `json:"security-groups,omitempty"` Taints SKSNodepoolTaints `json:"taints,omitempty"` diff --git a/vendor/github.com/exoscale/egoscale/v3/schemas.go b/vendor/github.com/exoscale/egoscale/v3/schemas.go index 5fee1602..3796e735 100644 --- a/vendor/github.com/exoscale/egoscale/v3/schemas.go +++ b/vendor/github.com/exoscale/egoscale/v3/schemas.go @@ -191,6 +191,155 @@ type DBAASBackupConfig struct { type DBAASDatabaseName string +type DBAASDatadogTag struct { + // Optional tag explanation + Comment string `json:"comment,omitempty" validate:"omitempty,lte=1024"` + // Tag value + Tag string `json:"tag" validate:"required,gte=1,lte=200"` +} + +type DBAASEndpointDatadog struct { + // Datadog API key + DatadogAPIKey string `json:"datadog-api-key" validate:"required,gte=1,lte=256"` + // Custom tags provided by user + DatadogTags []DBAASDatadogTag `json:"datadog-tags,omitempty"` + // Disable consumer group metrics + DisableConsumerStats *bool `json:"disable-consumer-stats,omitempty"` + // Number of separate instances to fetch kafka consumer statistics with + KafkaConsumerCheckInstances int64 `json:"kafka-consumer-check-instances,omitempty" validate:"omitempty,gte=1,lte=100"` + // Number of seconds that datadog will wait to get consumer statistics from brokers + KafkaConsumerStatsTimeout int64 `json:"kafka-consumer-stats-timeout,omitempty" validate:"omitempty,gte=2,lte=300"` + // Maximum number of partition contexts to send + MaxPartitionContexts int64 `json:"max-partition-contexts,omitempty" validate:"omitempty,gte=200,lte=200000"` + Site EnumDatadogSite `json:"site" validate:"required"` +} + +type DBAASEndpointElasticsearch struct { + // PEM encoded CA certificate + CA string `json:"ca,omitempty" validate:"omitempty,lte=16384"` + // Maximum number of days of logs to keep + IndexDaysMax int64 `json:"index-days-max,omitempty" validate:"omitempty,gte=1,lte=10000"` + // Elasticsearch index prefix + IndexPrefix string `json:"index-prefix" validate:"required,gte=1,lte=1000"` + // Elasticsearch request timeout limit + Timeout int64 `json:"timeout,omitempty" validate:"omitempty,gte=10,lte=120"` + // Elasticsearch connection URL + URL string `json:"url" validate:"required,gte=12,lte=2048"` +} + +type DBAASEndpointElasticsearchOutput struct { + // External integration endpoint id + ID UUID `json:"id,omitempty"` + // External integration endpoint name + Name string `json:"name,omitempty"` + Settings *DBAASEndpointElasticsearch `json:"settings,omitempty"` + Type EnumExternalEndpointTypes `json:"type,omitempty"` +} + +type DBAASEndpointExternalPrometheusOutput struct { + // External integration endpoint id + ID UUID `json:"id,omitempty"` + // External integration endpoint name + Name string `json:"name,omitempty"` + Settings *DBAASEndpointPrometheus `json:"settings,omitempty"` + Type EnumExternalEndpointTypes `json:"type,omitempty"` +} + +type DBAASEndpointOpensearch struct { + // PEM encoded CA certificate + CA string `json:"ca,omitempty" validate:"omitempty,lte=16384"` + // Maximum number of days of logs to keep + IndexDaysMax int64 `json:"index-days-max,omitempty" validate:"omitempty,gte=1,lte=10000"` + // OpenSearch index prefix + IndexPrefix string `json:"index-prefix" validate:"required,gte=1,lte=1000"` + // OpenSearch request timeout limit + Timeout int64 `json:"timeout,omitempty" validate:"omitempty,gte=10,lte=120"` + // OpenSearch connection URL + URL string `json:"url" validate:"required,gte=12,lte=2048"` +} + +type DBAASEndpointOpensearchOutput struct { + // External integration endpoint id + ID UUID `json:"id,omitempty"` + // External integration endpoint name + Name string `json:"name,omitempty"` + Settings *DBAASEndpointOpensearch `json:"settings,omitempty"` + Type EnumExternalEndpointTypes `json:"type,omitempty"` +} + +type DBAASEndpointPrometheus struct { + // Prometheus basic authentication password + BasicAuthPassword string `json:"basic-auth-password,omitempty" validate:"omitempty,gte=8,lte=64"` + // Prometheus basic authentication username + BasicAuthUsername string `json:"basic-auth-username,omitempty" validate:"omitempty,gte=5,lte=32"` +} + +type DBAASEndpointRsyslog struct { + // PEM encoded CA certificate + CA string `json:"ca,omitempty" validate:"omitempty,lte=16384"` + // PEM encoded client certificate + Cert string `json:"cert,omitempty" validate:"omitempty,lte=16384"` + Format EnumRsyslogFormat `json:"format" validate:"required"` + // PEM encoded client key + Key string `json:"key,omitempty" validate:"omitempty,lte=16384"` + // Custom syslog message format + Logline string `json:"logline,omitempty" validate:"omitempty,gte=1,lte=512"` + // Rsyslog max message size + MaxMessageSize int64 `json:"max-message-size,omitempty" validate:"omitempty,gte=2048,lte=2.147483647e+09"` + // Rsyslog server port + Port int64 `json:"port" validate:"required,gte=1,lte=65535"` + // Structured data block for log message + SD string `json:"sd,omitempty" validate:"omitempty,lte=1024"` + // Rsyslog server IP address or hostname + Server string `json:"server" validate:"required,gte=4,lte=255"` + // Require TLS + Tls *bool `json:"tls" validate:"required"` +} + +type DBAASExternalEndpoint struct { + // External integration endpoint id + ID UUID `json:"id,omitempty"` + // External integration endpoint name + Name string `json:"name,omitempty"` + Type EnumExternalEndpointTypes `json:"type,omitempty"` +} + +type DBAASExternalEndpointDatadogOutput struct { + // External integration endpoint id + ID UUID `json:"id,omitempty"` + // External integration endpoint name + Name string `json:"name,omitempty"` + Settings *DBAASEndpointDatadog `json:"settings,omitempty"` + Type EnumExternalEndpointTypes `json:"type,omitempty"` +} + +type DBAASExternalEndpointRsyslogOutput struct { + // External integration endpoint id + ID UUID `json:"id,omitempty"` + // External integration endpoint name + Name string `json:"name,omitempty"` + Settings *DBAASEndpointRsyslog `json:"settings,omitempty"` + Type EnumExternalEndpointTypes `json:"type,omitempty"` +} + +// Integrations with other services +type DBAASExternalIntegration struct { + // Description of the integration + Description string `json:"description" validate:"required"` + // External destination endpoint id + DestEndpointID string `json:"dest-endpoint-id,omitempty"` + // External destination endpoint name + DestEndpointName string `json:"dest-endpoint-name,omitempty"` + // Endpoint integration UUID + ID UUID `json:"id,omitempty"` + // DBaaS source service name + SourceServiceName string `json:"source-service-name" validate:"required"` + SourceServiceType DBAASServiceTypeName `json:"source-service-type" validate:"required,gte=0,lte=64"` + // Integration status + Status string `json:"status,omitempty"` + Type EnumExternalEndpointTypes `json:"type" validate:"required"` +} + type DBAASIntegration struct { // Description of the integration Description string `json:"description,omitempty"` @@ -578,38 +727,6 @@ type DBAASServiceGrafana struct { Zone string `json:"zone,omitempty"` } -// Integrations with other services -type DBAASServiceIntegration struct { - // True when integration is active - Active *bool `json:"active" validate:"required"` - // Description of the integration - Description string `json:"description" validate:"required"` - // Destination endpoint name - DestEndpoint string `json:"dest-endpoint,omitempty"` - // Destination endpoint id - DestEndpointID string `json:"dest-endpoint-id,omitempty"` - // Destination service name - DestService string `json:"dest-service" validate:"required"` - DestServiceType DBAASServiceTypeName `json:"dest-service-type" validate:"required,gte=0,lte=64"` - // True when integration is enabled - Enabled *bool `json:"enabled" validate:"required"` - // Integration status - IntegrationStatus map[string]any `json:"integration-status,omitempty"` - // Type of the integration - IntegrationType string `json:"integration-type" validate:"required"` - // Integration ID - ServiceIntegrationID string `json:"service-integration-id" validate:"required"` - // Source endpoint name - SourceEndpoint string `json:"source-endpoint,omitempty"` - // Source endpoint ID - SourceEndpointID string `json:"source-endpoint-id,omitempty"` - // Source service name - SourceService string `json:"source-service" validate:"required"` - SourceServiceType DBAASServiceTypeName `json:"source-service-type" validate:"required,gte=0,lte=64"` - // Service integration settings - UserConfig map[string]any `json:"user-config,omitempty"` -} - // Kafka authentication methods type DBAASServiceKafkaAuthenticationMethods struct { // Whether certificate/SSL authentication is enabled @@ -1239,6 +1356,14 @@ type DBAASUserGrafanaSecrets struct { Username string `json:"username,omitempty"` } +// Kafka Connect secrets +type DBAASUserKafkaConnectSecrets struct { + // Kafka Connect password + Password string `json:"password,omitempty"` + // Kafka Connect username + Username string `json:"username,omitempty"` +} + // Kafka User secrets type DBAASUserKafkaSecrets struct { // Kafka certificate @@ -1430,6 +1555,27 @@ const ( EnumComponentUsageReplica EnumComponentUsage = "replica" ) +type EnumDatadogSite string + +const ( + EnumDatadogSiteUs3DatadoghqCom EnumDatadogSite = "us3.datadoghq.com" + EnumDatadogSiteDdogGovCom EnumDatadogSite = "ddog-gov.com" + EnumDatadogSiteDatadoghqEU EnumDatadogSite = "datadoghq.eu" + EnumDatadogSiteUs5DatadoghqCom EnumDatadogSite = "us5.datadoghq.com" + EnumDatadogSiteAp1DatadoghqCom EnumDatadogSite = "ap1.datadoghq.com" + EnumDatadogSiteDatadoghqCom EnumDatadogSite = "datadoghq.com" +) + +type EnumExternalEndpointTypes string + +const ( + EnumExternalEndpointTypesPrometheus EnumExternalEndpointTypes = "prometheus" + EnumExternalEndpointTypesOpensearch EnumExternalEndpointTypes = "opensearch" + EnumExternalEndpointTypesRsyslog EnumExternalEndpointTypes = "rsyslog" + EnumExternalEndpointTypesDatadog EnumExternalEndpointTypes = "datadog" + EnumExternalEndpointTypesElasticsearch EnumExternalEndpointTypes = "elasticsearch" +) + type EnumIntegrationTypes string const ( @@ -1507,6 +1653,14 @@ const ( EnumPGVariantAiven EnumPGVariant = "aiven" ) +type EnumRsyslogFormat string + +const ( + EnumRsyslogFormatCustom EnumRsyslogFormat = "custom" + EnumRsyslogFormatRfc3164 EnumRsyslogFormat = "rfc3164" + EnumRsyslogFormatRfc5424 EnumRsyslogFormat = "rfc5424" +) + type EnumServiceState string const ( @@ -2457,6 +2611,13 @@ type SKSKubeconfigRequest struct { User string `json:"user,omitempty"` } +type SKSNodepoolPublicIPAssignment string + +const ( + SKSNodepoolPublicIPAssignmentInet4 SKSNodepoolPublicIPAssignment = "inet4" + SKSNodepoolPublicIPAssignmentDual SKSNodepoolPublicIPAssignment = "dual" +) + type SKSNodepoolState string const ( @@ -2498,6 +2659,10 @@ type SKSNodepool struct { Name string `json:"name,omitempty" validate:"omitempty,gte=1,lte=255"` // Nodepool Private Networks PrivateNetworks []PrivateNetwork `json:"private-networks,omitempty"` + // Nodepool public IP assignment of the Instances: + // * IPv4 and IPv6 (`dual`) addressing. + // * IPv4 and IPv6 (`dual`) addressing. + PublicIPAssignment SKSNodepoolPublicIPAssignment `json:"public-ip-assignment,omitempty"` // Nodepool Security Groups SecurityGroups []SecurityGroup `json:"security-groups,omitempty"` // Number of instances diff --git a/vendor/modules.txt b/vendor/modules.txt index ea3975ac..98688e69 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -220,7 +220,7 @@ github.com/exoscale/egoscale/v2 github.com/exoscale/egoscale/v2/api github.com/exoscale/egoscale/v2/oapi github.com/exoscale/egoscale/version -# github.com/exoscale/egoscale/v3 v3.1.1 +# github.com/exoscale/egoscale/v3 v3.1.2 ## explicit; go 1.22 github.com/exoscale/egoscale/v3 github.com/exoscale/egoscale/v3/credentials