From d3fdd33d16ed96840ed0b18eb1d58b188c5b5da9 Mon Sep 17 00:00:00 2001 From: Mike Rostermund Date: Fri, 8 Sep 2023 15:07:10 +0200 Subject: [PATCH] Replace hasura/go-graphql-client with cli/shurcooL-graphql --- api/actions.go | 203 ++++++++++++++++++++++--------------------- api/alerts.go | 76 ++++++++-------- api/client.go | 19 +++- api/cluster.go | 29 ++++--- api/featureflag.go | 10 ++- api/files.go | 9 +- api/groups.go | 9 +- api/ingest-tokens.go | 31 +++---- api/license.go | 6 +- api/organizations.go | 4 +- api/packages.go | 7 +- api/parsers.go | 42 +++++---- api/repositories.go | 47 +++++----- api/roles.go | 57 +++++++----- api/users.go | 23 ++--- api/views.go | 33 +++---- go.mod | 8 +- go.sum | 57 ++---------- 18 files changed, 344 insertions(+), 326 deletions(-) diff --git a/api/actions.go b/api/actions.go index 9214cc7..cf80a8d 100644 --- a/api/actions.go +++ b/api/actions.go @@ -2,6 +2,7 @@ package api import ( "fmt" + graphql "github.com/cli/shurcooL-graphql" "reflect" ) @@ -106,7 +107,7 @@ func (n *Actions) List(viewName string) ([]Action, error) { } variables := map[string]interface{}{ - "viewName": viewName, + "viewName": graphql.String(viewName), } err := n.client.Query(&query, variables) @@ -136,16 +137,18 @@ func (n *Actions) Update(viewName string, newAction *Action) (*Action, error) { } `graphql:"updateEmailAction(input: { id: $id, viewName: $viewName, name: $actionName, recipients: $recipients, subjectTemplate: $subjectTemplate, bodyTemplate: $bodyTemplate, useProxy: $useProxy })"` } - recipientsGQL := make([]string, len(newAction.EmailAction.Recipients)) - copy(recipientsGQL, newAction.EmailAction.Recipients) + recipientsGQL := make([]graphql.String, len(newAction.EmailAction.Recipients)) + for i, recipient := range newAction.EmailAction.Recipients { + recipientsGQL[i] = graphql.String(recipient) + } variables := map[string]interface{}{ - "id": currentAction.ID, - "viewName": viewName, - "actionName": newAction.Name, + "id": graphql.String(currentAction.ID), + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), "recipients": recipientsGQL, - "subjectTemplate": newAction.EmailAction.SubjectTemplate, - "bodyTemplate": newAction.EmailAction.BodyTemplate, - "useProxy": newAction.EmailAction.UseProxy, + "subjectTemplate": graphql.String(newAction.EmailAction.SubjectTemplate), + "bodyTemplate": graphql.String(newAction.EmailAction.BodyTemplate), + "useProxy": graphql.Boolean(newAction.EmailAction.UseProxy), } err := n.client.Mutate(&mutation, variables) @@ -177,10 +180,10 @@ func (n *Actions) Update(viewName string, newAction *Action) (*Action, error) { } variables := map[string]interface{}{ - "id": currentAction.ID, - "viewName": viewName, - "actionName": newAction.Name, - "ingestToken": newAction.HumioRepoAction.IngestToken, + "id": graphql.String(currentAction.ID), + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), + "ingestToken": graphql.String(newAction.HumioRepoAction.IngestToken), } err := n.client.Mutate(&mutation, variables) @@ -209,12 +212,12 @@ func (n *Actions) Update(viewName string, newAction *Action) (*Action, error) { } variables := map[string]interface{}{ - "id": currentAction.ID, - "viewName": viewName, - "actionName": newAction.Name, - "apiUrl": newAction.OpsGenieAction.ApiUrl, - "genieKey": newAction.OpsGenieAction.GenieKey, - "useProxy": newAction.OpsGenieAction.UseProxy, + "id": graphql.String(currentAction.ID), + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), + "apiUrl": graphql.String(newAction.OpsGenieAction.ApiUrl), + "genieKey": graphql.String(newAction.OpsGenieAction.GenieKey), + "useProxy": graphql.Boolean(newAction.OpsGenieAction.UseProxy), } err := n.client.Mutate(&mutation, variables) @@ -245,12 +248,12 @@ func (n *Actions) Update(viewName string, newAction *Action) (*Action, error) { } variables := map[string]interface{}{ - "id": currentAction.ID, - "viewName": viewName, - "actionName": newAction.Name, - "severity": newAction.PagerDutyAction.Severity, - "routingKey": newAction.PagerDutyAction.RoutingKey, - "useProxy": newAction.PagerDutyAction.UseProxy, + "id": graphql.String(currentAction.ID), + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), + "severity": graphql.String(newAction.PagerDutyAction.Severity), + "routingKey": graphql.String(newAction.PagerDutyAction.RoutingKey), + "useProxy": graphql.Boolean(newAction.PagerDutyAction.UseProxy), } err := n.client.Mutate(&mutation, variables) @@ -288,12 +291,12 @@ func (n *Actions) Update(viewName string, newAction *Action) (*Action, error) { } } variables := map[string]interface{}{ - "id": currentAction.ID, - "viewName": viewName, - "actionName": newAction.Name, - "url": newAction.SlackAction.Url, + "id": graphql.String(currentAction.ID), + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), + "url": graphql.String(newAction.SlackAction.Url), "fields": fieldsGQL, - "useProxy": newAction.SlackAction.UseProxy, + "useProxy": graphql.Boolean(newAction.SlackAction.UseProxy), } err := n.client.Mutate(&mutation, variables) @@ -323,8 +326,10 @@ func (n *Actions) Update(viewName string, newAction *Action) (*Action, error) { } `graphql:"updateSlackPostMessageAction(input: { id: $id, viewName: $viewName, name: $actionName, apiToken: $apiToken, channels: $channels, fields: $fields, useProxy: $useProxy })"` } - channelsGQL := make([]string, len(newAction.SlackPostMessageAction.Channels)) - copy(channelsGQL, newAction.SlackPostMessageAction.Channels) + channelsGQL := make([]graphql.String, len(newAction.SlackPostMessageAction.Channels)) + for k, v := range newAction.SlackPostMessageAction.Channels { + channelsGQL[k] = graphql.String(v) + } fieldsGQL := make([]SlackFieldEntryInput, len(newAction.SlackPostMessageAction.Fields)) for k, v := range newAction.SlackPostMessageAction.Fields { fieldsGQL[k] = SlackFieldEntryInput{ @@ -333,13 +338,13 @@ func (n *Actions) Update(viewName string, newAction *Action) (*Action, error) { } } variables := map[string]interface{}{ - "id": currentAction.ID, - "viewName": viewName, - "actionName": newAction.Name, - "apiToken": newAction.SlackPostMessageAction.ApiToken, + "id": graphql.String(currentAction.ID), + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), + "apiToken": graphql.String(newAction.SlackPostMessageAction.ApiToken), "channels": channelsGQL, "fields": fieldsGQL, - "useProxy": newAction.SlackPostMessageAction.UseProxy, + "useProxy": graphql.Boolean(newAction.SlackPostMessageAction.UseProxy), } err := n.client.Mutate(&mutation, variables) @@ -371,12 +376,12 @@ func (n *Actions) Update(viewName string, newAction *Action) (*Action, error) { } variables := map[string]interface{}{ - "id": currentAction.ID, - "viewName": viewName, - "actionName": newAction.Name, - "messageType": newAction.VictorOpsAction.MessageType, - "notifyUrl": newAction.VictorOpsAction.NotifyUrl, - "useProxy": newAction.VictorOpsAction.UseProxy, + "id": graphql.String(currentAction.ID), + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), + "messageType": graphql.String(newAction.VictorOpsAction.MessageType), + "notifyUrl": graphql.String(newAction.VictorOpsAction.NotifyUrl), + "useProxy": graphql.Boolean(newAction.VictorOpsAction.UseProxy), } err := n.client.Mutate(&mutation, variables) @@ -414,15 +419,15 @@ func (n *Actions) Update(viewName string, newAction *Action) (*Action, error) { } } variables := map[string]interface{}{ - "id": currentAction.ID, - "viewName": viewName, - "actionName": newAction.Name, - "url": newAction.WebhookAction.Url, - "method": newAction.WebhookAction.Method, + "id": graphql.String(currentAction.ID), + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), + "url": graphql.String(newAction.WebhookAction.Url), + "method": graphql.String(newAction.WebhookAction.Method), "headers": headersGQL, - "bodyTemplate": newAction.WebhookAction.BodyTemplate, - "ignoreSSL": newAction.WebhookAction.IgnoreSSL, - "useProxy": newAction.WebhookAction.UseProxy, + "bodyTemplate": graphql.String(newAction.WebhookAction.BodyTemplate), + "ignoreSSL": graphql.Boolean(newAction.WebhookAction.IgnoreSSL), + "useProxy": graphql.Boolean(newAction.WebhookAction.UseProxy), } err := n.client.Mutate(&mutation, variables) @@ -467,15 +472,17 @@ func (n *Actions) Add(viewName string, newAction *Action) (*Action, error) { } `graphql:"createEmailAction(input: { viewName: $viewName, name: $actionName, recipients: $recipients, subjectTemplate: $subjectTemplate, bodyTemplate: $bodyTemplate, useProxy: $useProxy })"` } - recipientsGQL := make([]string, len(newAction.EmailAction.Recipients)) - copy(recipientsGQL, newAction.EmailAction.Recipients) + recipientsGQL := make([]graphql.String, len(newAction.EmailAction.Recipients)) + for i, recipient := range newAction.EmailAction.Recipients { + recipientsGQL[i] = graphql.String(recipient) + } variables := map[string]interface{}{ - "viewName": viewName, - "actionName": newAction.Name, + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), "recipients": recipientsGQL, - "subjectTemplate": newAction.EmailAction.SubjectTemplate, - "bodyTemplate": newAction.EmailAction.BodyTemplate, - "useProxy": newAction.EmailAction.UseProxy, + "subjectTemplate": graphql.String(newAction.EmailAction.SubjectTemplate), + "bodyTemplate": graphql.String(newAction.EmailAction.BodyTemplate), + "useProxy": graphql.Boolean(newAction.EmailAction.UseProxy), } err := n.client.Mutate(&mutation, variables) @@ -507,9 +514,9 @@ func (n *Actions) Add(viewName string, newAction *Action) (*Action, error) { } variables := map[string]interface{}{ - "viewName": viewName, - "actionName": newAction.Name, - "ingestToken": newAction.HumioRepoAction.IngestToken, + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), + "ingestToken": graphql.String(newAction.HumioRepoAction.IngestToken), } err := n.client.Mutate(&mutation, variables) @@ -538,11 +545,11 @@ func (n *Actions) Add(viewName string, newAction *Action) (*Action, error) { } variables := map[string]interface{}{ - "viewName": viewName, - "actionName": newAction.Name, - "apiUrl": newAction.OpsGenieAction.ApiUrl, - "genieKey": newAction.OpsGenieAction.GenieKey, - "useProxy": newAction.OpsGenieAction.UseProxy, + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), + "apiUrl": graphql.String(newAction.OpsGenieAction.ApiUrl), + "genieKey": graphql.String(newAction.OpsGenieAction.GenieKey), + "useProxy": graphql.Boolean(newAction.OpsGenieAction.UseProxy), } err := n.client.Mutate(&mutation, variables) @@ -573,11 +580,11 @@ func (n *Actions) Add(viewName string, newAction *Action) (*Action, error) { } variables := map[string]interface{}{ - "viewName": viewName, - "actionName": newAction.Name, - "severity": newAction.PagerDutyAction.Severity, - "routingKey": newAction.PagerDutyAction.RoutingKey, - "useProxy": newAction.PagerDutyAction.UseProxy, + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), + "severity": graphql.String(newAction.PagerDutyAction.Severity), + "routingKey": graphql.String(newAction.PagerDutyAction.RoutingKey), + "useProxy": graphql.Boolean(newAction.PagerDutyAction.UseProxy), } err := n.client.Mutate(&mutation, variables) @@ -615,11 +622,11 @@ func (n *Actions) Add(viewName string, newAction *Action) (*Action, error) { } } variables := map[string]interface{}{ - "viewName": viewName, - "actionName": newAction.Name, - "url": newAction.SlackAction.Url, + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), + "url": graphql.String(newAction.SlackAction.Url), "fields": fieldsGQL, - "useProxy": newAction.SlackAction.UseProxy, + "useProxy": graphql.Boolean(newAction.SlackAction.UseProxy), } err := n.client.Mutate(&mutation, variables) @@ -649,8 +656,10 @@ func (n *Actions) Add(viewName string, newAction *Action) (*Action, error) { } `graphql:"createSlackPostMessageAction(input: { viewName: $viewName, name: $actionName, apiToken: $apiToken, channels: $channels, fields: $fields, useProxy: $useProxy })"` } - channelsGQL := make([]string, len(newAction.SlackPostMessageAction.Channels)) - copy(channelsGQL, newAction.SlackPostMessageAction.Channels) + channelsGQL := make([]graphql.String, len(newAction.SlackPostMessageAction.Channels)) + for k, v := range newAction.SlackPostMessageAction.Channels { + channelsGQL[k] = graphql.String(v) + } fieldsGQL := make([]SlackFieldEntryInput, len(newAction.SlackPostMessageAction.Fields)) for k, v := range newAction.SlackPostMessageAction.Fields { fieldsGQL[k] = SlackFieldEntryInput{ @@ -659,12 +668,12 @@ func (n *Actions) Add(viewName string, newAction *Action) (*Action, error) { } } variables := map[string]interface{}{ - "viewName": viewName, - "actionName": newAction.Name, - "apiToken": newAction.SlackPostMessageAction.ApiToken, + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), + "apiToken": graphql.String(newAction.SlackPostMessageAction.ApiToken), "channels": channelsGQL, "fields": fieldsGQL, - "useProxy": newAction.SlackPostMessageAction.UseProxy, + "useProxy": graphql.Boolean(newAction.SlackPostMessageAction.UseProxy), } err := n.client.Mutate(&mutation, variables) @@ -696,11 +705,11 @@ func (n *Actions) Add(viewName string, newAction *Action) (*Action, error) { } variables := map[string]interface{}{ - "viewName": viewName, - "actionName": newAction.Name, - "messageType": newAction.VictorOpsAction.MessageType, - "notifyUrl": newAction.VictorOpsAction.NotifyUrl, - "useProxy": newAction.VictorOpsAction.UseProxy, + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), + "messageType": graphql.String(newAction.VictorOpsAction.MessageType), + "notifyUrl": graphql.String(newAction.VictorOpsAction.NotifyUrl), + "useProxy": graphql.Boolean(newAction.VictorOpsAction.UseProxy), } err := n.client.Mutate(&mutation, variables) @@ -738,14 +747,14 @@ func (n *Actions) Add(viewName string, newAction *Action) (*Action, error) { } } variables := map[string]interface{}{ - "viewName": viewName, - "actionName": newAction.Name, - "url": newAction.WebhookAction.Url, - "method": newAction.WebhookAction.Method, + "viewName": graphql.String(viewName), + "actionName": graphql.String(newAction.Name), + "url": graphql.String(newAction.WebhookAction.Url), + "method": graphql.String(newAction.WebhookAction.Method), "headers": headersGQL, - "bodyTemplate": newAction.WebhookAction.BodyTemplate, - "ignoreSSL": newAction.WebhookAction.IgnoreSSL, - "useProxy": newAction.WebhookAction.UseProxy, + "bodyTemplate": graphql.String(newAction.WebhookAction.BodyTemplate), + "ignoreSSL": graphql.Boolean(newAction.WebhookAction.IgnoreSSL), + "useProxy": graphql.Boolean(newAction.WebhookAction.UseProxy), } err := n.client.Mutate(&mutation, variables) @@ -794,8 +803,8 @@ func (n *Actions) GetByID(viewName, actionID string) (*Action, error) { } variables := map[string]interface{}{ - "viewName": viewName, - "actionId": actionID, + "viewName": graphql.String(viewName), + "actionId": graphql.String(actionID), } err := n.client.Query(&query, variables) @@ -831,8 +840,8 @@ func (n *Actions) Delete(viewName, actionName string) error { } variables := map[string]interface{}{ - "viewName": viewName, - "actionId": actionID, + "viewName": graphql.String(viewName), + "actionId": graphql.String(actionID), } return n.client.Mutate(&mutation, variables) diff --git a/api/alerts.go b/api/alerts.go index b56c638..1565890 100644 --- a/api/alerts.go +++ b/api/alerts.go @@ -2,6 +2,7 @@ package api import ( "fmt" + graphql "github.com/cli/shurcooL-graphql" ) type Alert struct { @@ -13,17 +14,15 @@ type Alert struct { TimeOfLastTrigger int `graphql:"timeOfLastTrigger" yaml:"timeOfLastTrigger" json:"timeOfLastTrigger"` IsStarred bool `graphql:"isStarred" yaml:"isStarred" json:"isStarred"` Description string `graphql:"description" yaml:"description,omitempty" json:"description"` - ThrottleTimeMillis Long `graphql:"throttleTimeMillis" yaml:"throttleTimeMillis" json:"throttleTimeMillis"` + ThrottleTimeMillis int `graphql:"throttleTimeMillis" yaml:"throttleTimeMillis" json:"throttleTimeMillis"` Enabled bool `graphql:"enabled" yaml:"enabled" json:"enabled"` Actions []string `graphql:"actions" yaml:"actions" json:"actions"` - Labels []string `graphql:"labels" yaml:"labels" json:"labels"` + Labels []string `graphql:"labels" yaml:"labels,omitempty" json:"labels,omitempty"` LastError string `graphql:"lastError" yaml:"lastError" json:"lastError"` } type Long int64 -func (l Long) GetGraphQLType() string { return "Long" } - type Alerts struct { client *Client } @@ -38,7 +37,7 @@ func (a *Alerts) List(viewName string) ([]Alert, error) { } variables := map[string]interface{}{ - "viewName": viewName, + "viewName": graphql.String(viewName), } err := a.client.Query(&query, variables) @@ -58,25 +57,29 @@ func (a *Alerts) Update(viewName string, newAlert *Alert) (*Alert, error) { Alert `graphql:"updateAlert(input: { id: $id, viewName: $viewName, name: $alertName, description: $description, queryString: $queryString, queryStart: $queryStart, throttleTimeMillis: $throttleTimeMillis, throttleField: $throttleField, enabled: $enabled, actions: $actions, labels: $labels })"` } - actions := make([]string, len(newAlert.Actions)) - labels := make([]string, len(newAlert.Labels)) - var throttleField *string - copy(actions, newAlert.Actions) - copy(labels, newAlert.Labels) + actions := make([]graphql.String, len(newAlert.Actions)) + labels := make([]graphql.String, len(newAlert.Labels)) + var throttleField *graphql.String + for i, action := range newAlert.Actions { + actions[i] = graphql.String(action) + } + for i, label := range newAlert.Labels { + labels[i] = graphql.String(label) + } if newAlert.ThrottleField != "" { - field := newAlert.ThrottleField + field := graphql.String(newAlert.ThrottleField) throttleField = &field } variables := map[string]interface{}{ - "id": newAlert.ID, - "viewName": viewName, - "alertName": newAlert.Name, - "description": newAlert.Description, - "queryString": newAlert.QueryString, - "queryStart": newAlert.QueryStart, + "id": graphql.String(newAlert.ID), + "viewName": graphql.String(viewName), + "alertName": graphql.String(newAlert.Name), + "description": graphql.String(newAlert.Description), + "queryString": graphql.String(newAlert.QueryString), + "queryStart": graphql.String(newAlert.QueryStart), "throttleField": throttleField, - "throttleTimeMillis": newAlert.ThrottleTimeMillis, - "enabled": newAlert.Enabled, + "throttleTimeMillis": Long(newAlert.ThrottleTimeMillis), + "enabled": graphql.Boolean(newAlert.Enabled), "actions": actions, "labels": labels, } @@ -115,25 +118,28 @@ func (a *Alerts) Add(viewName string, newAlert *Alert) (*Alert, error) { Alert `graphql:"createAlert(input: { viewName: $viewName, name: $alertName, description: $description, queryString: $queryString, queryStart: $queryStart, throttleTimeMillis: $throttleTimeMillis, throttleField: $throttleField, enabled: $enabled, actions: $actions, labels: $labels })"` } - actions := make([]string, len(newAlert.Actions)) - labels := make([]string, len(newAlert.Labels)) - var throttleField *string - copy(actions, newAlert.Actions) - copy(labels, newAlert.Labels) + actions := make([]graphql.String, len(newAlert.Actions)) + labels := make([]graphql.String, len(newAlert.Labels)) + var throttleField *graphql.String + for i, action := range newAlert.Actions { + actions[i] = graphql.String(action) + } + for i, label := range newAlert.Labels { + labels[i] = graphql.String(label) + } if newAlert.ThrottleField != "" { - field := newAlert.ThrottleField + field := graphql.String(newAlert.ThrottleField) throttleField = &field } - variables := map[string]interface{}{ - "viewName": viewName, - "alertName": newAlert.Name, - "description": newAlert.Description, - "queryString": newAlert.QueryString, - "queryStart": newAlert.QueryStart, - "throttleTimeMillis": newAlert.ThrottleTimeMillis, + "viewName": graphql.String(viewName), + "alertName": graphql.String(newAlert.Name), + "description": graphql.String(newAlert.Description), + "queryString": graphql.String(newAlert.QueryString), + "queryStart": graphql.String(newAlert.QueryStart), + "throttleTimeMillis": Long(newAlert.ThrottleTimeMillis), "throttleField": throttleField, - "enabled": newAlert.Enabled, + "enabled": graphql.Boolean(newAlert.Enabled), "actions": actions, "labels": labels, } @@ -197,8 +203,8 @@ func (a *Alerts) Delete(viewName, alertName string) error { } variables := map[string]interface{}{ - "viewName": viewName, - "alertId": alertId, + "viewName": graphql.String(viewName), + "alertId": graphql.String(alertId), } return a.client.Mutate(&mutation, variables) diff --git a/api/client.go b/api/client.go index e8c63df..ee2f11a 100644 --- a/api/client.go +++ b/api/client.go @@ -4,13 +4,12 @@ import ( "bytes" "context" "fmt" + graphql "github.com/cli/shurcooL-graphql" "io" "net" "net/http" "net/url" "strings" - - "github.com/hasura/go-graphql-client" ) const defaultUserAgent = "Humio-go-client/unknown" @@ -148,3 +147,19 @@ func (c *Client) HTTPRequestContext(ctx context.Context, httpMethod string, path var client = c.newHTTPClientWithHeaders(headers) return client.Do(req) } + +func optBoolArg(v *bool) *graphql.Boolean { + var argPtr *graphql.Boolean + if v != nil { + argPtr = graphql.NewBoolean(graphql.Boolean(*v)) + } + return argPtr +} + +func optStringArg(v *string) *graphql.String { + var argPtr *graphql.String + if v != nil { + argPtr = graphql.NewString(graphql.String(*v)) + } + return argPtr +} diff --git a/api/cluster.go b/api/cluster.go index 36a2292..4abbd18 100644 --- a/api/cluster.go +++ b/api/cluster.go @@ -2,6 +2,7 @@ package api import ( "fmt" + graphql "github.com/cli/shurcooL-graphql" "math" ) @@ -71,13 +72,13 @@ func (c *Clusters) Get() (Cluster, error) { } type StoragePartitionInput struct { - ID int32 `json:"id"` - NodeIDs []int32 `json:"nodeIds"` + ID graphql.Int `json:"id"` + NodeIDs []graphql.Int `json:"nodeIds"` } type IngestPartitionInput struct { - ID int32 `json:"id"` - NodeIDs []int32 `json:"nodeIds"` + ID graphql.Int `json:"id"` + NodeIDs []graphql.Int `json:"nodeIds"` } // Deprecated: returns dummy data as of LogScale 1.88 @@ -85,7 +86,7 @@ func (c *Clusters) UpdateStoragePartitionScheme(desired []StoragePartitionInput) var mutation struct { UpdateStoragePartitionScheme struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"updateStoragePartitionScheme(partitions: $partitions)"` } @@ -101,7 +102,7 @@ func (c *Clusters) UpdateIngestPartitionScheme(desired []IngestPartitionInput) e var mutation struct { UpdateStoragePartitionScheme struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"updateIngestPartitionScheme(partitions: $partitions)"` } @@ -117,7 +118,7 @@ func (c *Clusters) StartDataRedistribution() error { var mutation struct { StartDataRedistribution struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"startDataRedistribution"` } @@ -129,12 +130,12 @@ func (c *Clusters) ClusterMoveStorageRouteAwayFromNode(nodeID int) error { var mutation struct { ClusterMoveStorageRouteAwayFromNode struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"clusterMoveStorageRouteAwayFromNode(nodeID: $id)"` } variables := map[string]interface{}{ - "id": int32(nodeID), + "id": graphql.Int(nodeID), } return c.client.Mutate(&mutation, variables) @@ -145,12 +146,12 @@ func (c *Clusters) ClusterMoveIngestRoutesAwayFromNode(nodeID int) error { var mutation struct { ClusterMoveIngestRoutesAwayFromNode struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"clusterMoveIngestRoutesAwayFromNode(nodeID: $id)"` } variables := map[string]interface{}{ - "id": int32(nodeID), + "id": graphql.Int(nodeID), } return c.client.Mutate(&mutation, variables) @@ -201,13 +202,13 @@ func (n *ClusterNodes) Unregister(nodeID int, force bool) error { var mutation struct { ClusterUnregisterNode struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"clusterUnregisterNode(force: $force, nodeID: $id)"` } variables := map[string]interface{}{ - "id": int32(nodeID), - "force": force, + "id": graphql.Int(nodeID), + "force": graphql.Boolean(force), } return n.client.Mutate(&mutation, variables) diff --git a/api/featureflag.go b/api/featureflag.go index 3c4880d..35ae741 100644 --- a/api/featureflag.go +++ b/api/featureflag.go @@ -1,5 +1,7 @@ package api +import graphql "github.com/cli/shurcooL-graphql" + type FeatureFlag string type FeatureFlags struct { @@ -63,7 +65,7 @@ func (f *FeatureFlags) EnableForOrganization(organizationID string, flag Feature variables := map[string]interface{}{ "feature": flag, - "orgId": organizationID, + "orgId": graphql.String(organizationID), } return f.c.Mutate(&mutation, variables) @@ -76,7 +78,7 @@ func (f *FeatureFlags) DisableForOrganization(organizationID string, flag Featur variables := map[string]interface{}{ "feature": flag, - "orgId": organizationID, + "orgId": graphql.String(organizationID), } return f.c.Mutate(&mutation, variables) @@ -89,7 +91,7 @@ func (f *FeatureFlags) EnableForUser(userID string, flag FeatureFlag) error { variables := map[string]interface{}{ "feature": flag, - "userId": userID, + "userId": graphql.String(userID), } return f.c.Mutate(&mutation, variables) @@ -102,7 +104,7 @@ func (f *FeatureFlags) DisableForUser(userID string, flag FeatureFlag) error { variables := map[string]interface{}{ "feature": flag, - "userId": userID, + "userId": graphql.String(userID), } return f.c.Mutate(&mutation, variables) diff --git a/api/files.go b/api/files.go index 13a4350..6ca6b73 100644 --- a/api/files.go +++ b/api/files.go @@ -3,6 +3,7 @@ package api import ( "context" "fmt" + graphql "github.com/cli/shurcooL-graphql" "io" "mime/multipart" "net/http" @@ -31,7 +32,7 @@ func (f *Files) List(viewName string) ([]File, error) { } variables := map[string]interface{}{ - "viewName": viewName, + "viewName": graphql.String(viewName), } err := f.client.Query(&query, variables) @@ -42,13 +43,13 @@ func (f *Files) Delete(viewName string, fileName string) error { var query struct { RemoveFile struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"removeFile(name:$viewName, fileName: $fileName)"` } variables := map[string]interface{}{ - "viewName": viewName, - "fileName": fileName, + "viewName": graphql.String(viewName), + "fileName": graphql.String(fileName), } return f.client.Mutate(&query, variables) diff --git a/api/groups.go b/api/groups.go index 4d398ef..30c676f 100644 --- a/api/groups.go +++ b/api/groups.go @@ -2,6 +2,7 @@ package api import ( "errors" + graphql "github.com/cli/shurcooL-graphql" ) type Groups struct { @@ -44,8 +45,8 @@ func (g *Groups) AddUserToGroup(groupID string, userID string) error { } variables := map[string]interface{}{ - "userID": userID, - "groupID": groupID, + "userID": graphql.String(userID), + "groupID": graphql.String(groupID), } err := g.client.Mutate(&mutation, variables) @@ -78,8 +79,8 @@ func (g *Groups) RemoveUserFromGroup(groupID string, userID string) error { } variables := map[string]interface{}{ - "userID": userID, - "groupID": groupID, + "userID": graphql.String(userID), + "groupID": graphql.String(groupID), } return g.client.Mutate(&mutation, variables) diff --git a/api/ingest-tokens.go b/api/ingest-tokens.go index 83ac7d7..7f860d7 100644 --- a/api/ingest-tokens.go +++ b/api/ingest-tokens.go @@ -2,6 +2,7 @@ package api import ( "fmt" + graphql "github.com/cli/shurcooL-graphql" ) type IngestTokens struct { @@ -32,7 +33,7 @@ func (i *IngestTokens) List(repo string) ([]IngestToken, error) { } variables := map[string]interface{}{ - "repositoryName": repo, + "repositoryName": graphql.String(repo), } err := i.client.Query(&query, variables) @@ -78,9 +79,9 @@ func toIngestToken(data ingestTokenData) *IngestToken { func (i *IngestTokens) Add(repositoryName string, tokenName string, parserName string) (*IngestToken, error) { variables := map[string]interface{}{ - "tokenName": tokenName, - "repositoryName": repositoryName, - "parserId": (*string)(nil), + "tokenName": graphql.String(tokenName), + "repositoryName": graphql.String(repositoryName), + "parserId": (*graphql.String)(nil), } if parserName != "" { @@ -88,7 +89,7 @@ func (i *IngestTokens) Add(repositoryName string, tokenName string, parserName s if err != nil { return nil, fmt.Errorf("unable to look up parser id for parser name %q: %w", parserName, err) } - variables["parserId"] = parser.ID + variables["parserId"] = graphql.String(parser.ID) } var mutation struct { @@ -120,13 +121,13 @@ func (i *IngestTokens) Update(repositoryName string, tokenName string, parserNam var mutation struct { Result struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"unassignIngestToken(repositoryName: $repositoryName, tokenName: $tokenName)"` } variables := map[string]interface{}{ - "tokenName": tokenName, - "repositoryName": repositoryName, + "tokenName": graphql.String(tokenName), + "repositoryName": graphql.String(repositoryName), } err := i.client.Mutate(&mutation, variables) @@ -137,7 +138,7 @@ func (i *IngestTokens) Update(repositoryName string, tokenName string, parserNam var mutation struct { Result struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"assignParserToIngestToken(input: { repositoryName: $repositoryName, tokenName: $tokenName, parserId: $parserId })"` } @@ -146,9 +147,9 @@ func (i *IngestTokens) Update(repositoryName string, tokenName string, parserNam return nil, fmt.Errorf("unable to look up parser id for parser name %q: %w", parserName, err) } variables := map[string]interface{}{ - "tokenName": tokenName, - "repositoryName": repositoryName, - "parserId": parser.ID, + "tokenName": graphql.String(tokenName), + "repositoryName": graphql.String(repositoryName), + "parserId": graphql.String(parser.ID), } err2 := i.client.Mutate(&mutation, variables) @@ -164,13 +165,13 @@ func (i *IngestTokens) Remove(repositoryName string, tokenName string) error { var mutation struct { Result struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"removeIngestToken(repositoryName: $repositoryName, name: $tokenName)"` } variables := map[string]interface{}{ - "tokenName": tokenName, - "repositoryName": repositoryName, + "tokenName": graphql.String(tokenName), + "repositoryName": graphql.String(repositoryName), } return i.client.Mutate(&mutation, variables) diff --git a/api/license.go b/api/license.go index ab59359..7fbad22 100644 --- a/api/license.go +++ b/api/license.go @@ -1,5 +1,7 @@ package api +import graphql "github.com/cli/shurcooL-graphql" + type Licenses struct { client *Client } @@ -32,11 +34,11 @@ func (l *Licenses) Install(license string) error { var mutation struct { UpdateLicenseKey struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"updateLicenseKey(license: $license)"` } variables := map[string]interface{}{ - "license": license, + "license": graphql.String(license), } return l.client.Mutate(&mutation, variables) diff --git a/api/organizations.go b/api/organizations.go index e180c8b..0632fb7 100644 --- a/api/organizations.go +++ b/api/organizations.go @@ -1,5 +1,7 @@ package api +import graphql "github.com/cli/shurcooL-graphql" + type Organizations struct { client *Client } @@ -18,7 +20,7 @@ func (o *Organizations) CreateOrganization(name string) (Organization, error) { } variables := map[string]interface{}{ - "name": name, + "name": graphql.String(name), } err := o.client.Mutate(&mutation, variables) diff --git a/api/packages.go b/api/packages.go index d858b64..fd31a3e 100644 --- a/api/packages.go +++ b/api/packages.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "fmt" + graphql "github.com/cli/shurcooL-graphql" "io" "net/http" "net/url" @@ -113,7 +114,7 @@ func (p *Packages) ListInstalled(viewName string) ([]InstalledPackage, error) { } variables := map[string]interface{}{ - "repositoryName": viewName, + "repositoryName": graphql.String(viewName), } err := p.client.Query(&query, variables) @@ -193,13 +194,13 @@ func (p *Packages) UninstallPackage(viewName string, packageID string) error { var mutation struct { UninstallPackage struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"uninstallPackage(packageId: $packageId, viewName: $viewName)"` } variables := map[string]interface{}{ "packageId": UnversionedPackageSpecifier(packageID), - "viewName": viewName, + "viewName": graphql.String(viewName), } return p.client.Mutate(&mutation, variables) diff --git a/api/parsers.go b/api/parsers.go index 5754d6f..cf82a29 100644 --- a/api/parsers.go +++ b/api/parsers.go @@ -1,5 +1,7 @@ package api +import graphql "github.com/cli/shurcooL-graphql" + type ParserTestCase struct { Input string Output map[string]string @@ -34,7 +36,7 @@ func (p *Parsers) List(repositoryName string) ([]ParserListItem, error) { } variables := map[string]interface{}{ - "repositoryName": repositoryName, + "repositoryName": graphql.String(repositoryName), } var parsers []ParserListItem @@ -49,7 +51,7 @@ func (p *Parsers) Remove(repositoryName string, parserName string) error { var mutation struct { RemoveParser struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"removeParser(input: { id: $id, repositoryName: $repositoryName })"` } @@ -59,8 +61,8 @@ func (p *Parsers) Remove(repositoryName string, parserName string) error { } variables := map[string]interface{}{ - "repositoryName": repositoryName, - "id": parser.ID, + "repositoryName": graphql.String(repositoryName), + "id": graphql.String(parser.ID), } return p.client.Mutate(&mutation, variables) @@ -71,23 +73,29 @@ func (p *Parsers) Add(repositoryName string, parser *Parser, force bool) error { var mutation struct { CreateParser struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"createParser(input: { name: $name, repositoryName: $repositoryName, testData: $testData, tagFields: $tagFields, sourceCode: $sourceCode, force: $force})"` } - tagFieldsGQL := make([]string, len(parser.TagFields)) - copy(tagFieldsGQL, parser.TagFields) + tagFieldsGQL := make([]graphql.String, len(parser.TagFields)) + + for i, field := range parser.TagFields { + tagFieldsGQL[i] = graphql.String(field) + } - testsGQL := make([]string, len(parser.Tests)) - copy(testsGQL, parser.Tests) + testsGQL := make([]graphql.String, len(parser.Tests)) + + for i, field := range parser.Tests { + testsGQL[i] = graphql.String(field) + } variables := map[string]interface{}{ - "name": parser.Name, - "sourceCode": parser.Script, - "repositoryName": repositoryName, + "name": graphql.String(parser.Name), + "sourceCode": graphql.String(parser.Script), + "repositoryName": graphql.String(repositoryName), "testData": testsGQL, "tagFields": tagFieldsGQL, - "force": force, + "force": graphql.Boolean(force), } return p.client.Mutate(&mutation, variables) @@ -107,8 +115,8 @@ func (p *Parsers) Get(repositoryName string, parserName string) (*Parser, error) } variables := map[string]interface{}{ - "parserName": parserName, - "repositoryName": repositoryName, + "parserName": graphql.String(parserName), + "repositoryName": graphql.String(repositoryName), } err := p.client.Query(&query, variables) @@ -143,8 +151,8 @@ func (p *Parsers) Export(repositoryName string, parserName string) (string, erro } variables := map[string]interface{}{ - "parserName": parserName, - "repositoryName": repositoryName, + "parserName": graphql.String(parserName), + "repositoryName": graphql.String(repositoryName), } err := p.client.Query(&query, variables) diff --git a/api/repositories.go b/api/repositories.go index 9209edd..3f3d62f 100644 --- a/api/repositories.go +++ b/api/repositories.go @@ -2,6 +2,7 @@ package api import ( "fmt" + graphql "github.com/cli/shurcooL-graphql" "strings" ) @@ -27,7 +28,7 @@ func (r *Repositories) Get(name string) (Repository, error) { } variables := map[string]interface{}{ - "name": name, + "name": graphql.String(name), } err := r.client.Query(&query, variables) @@ -63,7 +64,7 @@ func (r *Repositories) Create(name string) error { } variables := map[string]interface{}{ - "name": name, + "name": graphql.String(name), } err := r.client.Mutate(&mutation, variables) @@ -88,12 +89,12 @@ func (r *Repositories) Delete(name, reason string, allowDataDeletion bool) error var mutation struct { DeleteSearchDomain struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"deleteSearchDomain(name: $name, deleteMessage: $reason)"` } variables := map[string]interface{}{ - "name": name, - "reason": reason, + "name": graphql.String(name), + "reason": graphql.String(reason), } return r.client.Mutate(&mutation, variables) @@ -135,12 +136,12 @@ func (r *Repositories) UpdateUserGroup(name, username string, groups ...DefaultG var mutation struct { UpdateDefaultGroupMembershipsMutation struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"updateDefaultGroupMemberships(input: {viewName: $name, userName: $username, groups: $groups})"` } variables := map[string]interface{}{ - "name": name, - "username": username, + "name": graphql.String(name), + "username": graphql.String(username), "groups": groups, } @@ -157,12 +158,12 @@ func (r *Repositories) UpdateTimeBasedRetention(name string, retentionInDays flo var mutation struct { UpdateRetention struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"updateRetention(repositoryName: $name, timeBasedRetention: $retentionInDays)"` } variables := map[string]interface{}{ - "name": name, - "retentionInDays": (*float64)(nil), + "name": graphql.String(name), + "retentionInDays": (*graphql.Float)(nil), } if retentionInDays > 0 { if retentionInDays < existingRepo.RetentionDays || existingRepo.RetentionDays == 0 { @@ -170,7 +171,7 @@ func (r *Repositories) UpdateTimeBasedRetention(name string, retentionInDays flo return fmt.Errorf("repository contains data and data deletion not allowed") } } - variables["retentionInDays"] = retentionInDays + variables["retentionInDays"] = graphql.Float(retentionInDays) } return r.client.Mutate(&mutation, variables) @@ -186,12 +187,12 @@ func (r *Repositories) UpdateStorageBasedRetention(name string, storageInGB floa var mutation struct { UpdateRetention struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"updateRetention(repositoryName: $name, storageSizeBasedRetention: $storageInGB)"` } variables := map[string]interface{}{ - "name": name, - "storageInGB": (*float64)(nil), + "name": graphql.String(name), + "storageInGB": (*graphql.Float)(nil), } if storageInGB > 0 { if storageInGB < existingRepo.StorageRetentionSizeGB || existingRepo.StorageRetentionSizeGB == 0 { @@ -199,7 +200,7 @@ func (r *Repositories) UpdateStorageBasedRetention(name string, storageInGB floa return fmt.Errorf("repository contains data and data deletion not allowed") } } - variables["storageInGB"] = storageInGB + variables["storageInGB"] = graphql.Float(storageInGB) } return r.client.Mutate(&mutation, variables) @@ -215,12 +216,12 @@ func (r *Repositories) UpdateIngestBasedRetention(name string, ingestInGB float6 var mutation struct { UpdateRetention struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"updateRetention(repositoryName: $name, ingestSizeBasedRetention: $ingestInGB)"` } variables := map[string]interface{}{ - "name": name, - "ingestInGB": (*float64)(nil), + "name": graphql.String(name), + "ingestInGB": (*graphql.Float)(nil), } if ingestInGB > 0 { if ingestInGB < existingRepo.IngestRetentionSizeGB || existingRepo.IngestRetentionSizeGB == 0 { @@ -228,7 +229,7 @@ func (r *Repositories) UpdateIngestBasedRetention(name string, ingestInGB float6 return fmt.Errorf("repository contains data and data deletion not allowed") } } - variables["ingestInGB"] = ingestInGB + variables["ingestInGB"] = graphql.Float(ingestInGB) } return r.client.Mutate(&mutation, variables) @@ -238,13 +239,13 @@ func (r *Repositories) UpdateDescription(name, description string) error { var mutation struct { UpdateDescription struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"updateDescriptionForSearchDomain(name: $name, newDescription: $description)"` } variables := map[string]interface{}{ - "name": name, - "description": description, + "name": graphql.String(name), + "description": graphql.String(description), } return r.client.Mutate(&mutation, variables) diff --git a/api/roles.go b/api/roles.go index e581e1b..6979aad 100644 --- a/api/roles.go +++ b/api/roles.go @@ -2,6 +2,7 @@ package api import ( "fmt" + graphql "github.com/cli/shurcooL-graphql" ) type Roles struct { @@ -42,19 +43,25 @@ func (r *Roles) Create(role *Role) error { Role `graphql:"createRole(input: {displayName: $displayName, viewPermissions: $permissions, color: $color, systemPermissions: $systemPermissions, organizationPermissions: $orgPermissions})"` } - viewPermissions := make([]string, len(role.ViewPermissions)) - copy(viewPermissions, role.ViewPermissions) + viewPermissions := make([]graphql.String, len(role.ViewPermissions)) + for i, permission := range role.ViewPermissions { + viewPermissions[i] = graphql.String(permission) + } - systemPermissions := make([]string, len(role.SystemPermissions)) - copy(systemPermissions, role.SystemPermissions) + systemPermissions := make([]graphql.String, len(role.SystemPermissions)) + for i, permission := range role.SystemPermissions { + systemPermissions[i] = graphql.String(permission) + } - orgPermissions := make([]string, len(role.OrgPermissions)) - copy(orgPermissions, role.OrgPermissions) + orgPermissions := make([]graphql.String, len(role.OrgPermissions)) + for i, permission := range role.OrgPermissions { + orgPermissions[i] = graphql.String(permission) + } variables := map[string]interface{}{ - "displayName": role.DisplayName, - "color": role.Color, - "description": role.Description, + "displayName": graphql.String(role.DisplayName), + "color": graphql.String(role.Color), + "description": graphql.String(role.Description), "viewPermissions": viewPermissions, "systemPermissions": systemPermissions, "orgPermissions": orgPermissions, @@ -77,20 +84,26 @@ func (r *Roles) Update(rolename string, newRole *Role) error { Role `graphql:"updateRole(input: {roleId: $roleId, displayName: $displayName, color: $color, description: $description, viewPermissions: $viewPermissions, systemPermissions: $systemPermissions, organizationPermissions: $orgPermissions})"` } - viewPermissions := make([]string, len(newRole.ViewPermissions)) - copy(viewPermissions, newRole.ViewPermissions) + viewPermissions := make([]graphql.String, len(newRole.ViewPermissions)) + for i, permission := range newRole.ViewPermissions { + viewPermissions[i] = graphql.String(permission) + } - systemPermissions := make([]string, len(newRole.SystemPermissions)) - copy(systemPermissions, newRole.SystemPermissions) + systemPermissions := make([]graphql.String, len(newRole.SystemPermissions)) + for i, permission := range newRole.SystemPermissions { + systemPermissions[i] = graphql.String(permission) + } - orgPermissions := make([]string, len(newRole.OrgPermissions)) - copy(orgPermissions, newRole.OrgPermissions) + orgPermissions := make([]graphql.String, len(newRole.OrgPermissions)) + for i, permission := range newRole.OrgPermissions { + orgPermissions[i] = graphql.String(permission) + } variables := map[string]interface{}{ - "roleId": roleId, - "displayName": newRole.DisplayName, - "color": newRole.Color, - "description": newRole.Description, + "roleId": graphql.String(roleId), + "displayName": graphql.String(newRole.DisplayName), + "color": graphql.String(newRole.Color), + "description": graphql.String(newRole.Description), "viewPermissions": viewPermissions, "systemPermissions": systemPermissions, "organizationPermissions": orgPermissions, @@ -103,7 +116,7 @@ func (r *Roles) RemoveRole(rolename string) error { var mutation struct { RemoveRole struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"removeRole(input: {roleId: $roleId})"` } @@ -113,7 +126,7 @@ func (r *Roles) RemoveRole(rolename string) error { } variables := map[string]interface{}{ - "roleId": role.ID, + "roleId": graphql.String(role.ID), } return r.client.Mutate(mutation, variables) @@ -130,7 +143,7 @@ func (r *Roles) Get(rolename string) (*Role, error) { } variables := map[string]interface{}{ - "roleId": roleId, + "roleId": graphql.String(roleId), } err = r.client.Query(query, variables) diff --git a/api/users.go b/api/users.go index 9d12423..0866287 100644 --- a/api/users.go +++ b/api/users.go @@ -2,6 +2,7 @@ package api import ( "errors" + graphql "github.com/cli/shurcooL-graphql" ) type Users struct { @@ -46,7 +47,7 @@ func (u *Users) Get(username string) (User, error) { } variables := map[string]interface{}{ - "username": username, + "username": graphql.String(username), } err := u.client.Query(&query, variables) @@ -76,7 +77,7 @@ func (u *Users) Add(username string, changeset UserChangeSet) (User, error) { var mutation struct { Result struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"addUserV2(input: {username: $username, company: $company, isRoot: $isRoot, fullName: $fullName, picture: $picture, email: $email, countryCode: $countryCode})"` } @@ -96,7 +97,7 @@ func (u *Users) Remove(username string) (User, error) { } variables := map[string]interface{}{ - "username": username, + "username": graphql.String(username), } err := u.client.Mutate(&mutation, variables) @@ -113,7 +114,7 @@ func (u *Users) RotateUserApiTokenAndGet(userID string) (string, error) { } variables := map[string]interface{}{ - "id": userID, + "id": graphql.String(userID), } err := u.client.Mutate(&mutation, variables) @@ -126,12 +127,12 @@ func (u *Users) RotateUserApiTokenAndGet(userID string) (string, error) { func userChangesetToVars(username string, changeset UserChangeSet) map[string]interface{} { return map[string]interface{}{ - "username": username, - "isRoot": changeset.IsRoot, - "fullName": changeset.FullName, - "company": changeset.Company, - "countryCode": changeset.CountryCode, - "email": changeset.Email, - "picture": changeset.Picture, + "username": graphql.String(username), + "isRoot": optBoolArg(changeset.IsRoot), + "fullName": optStringArg(changeset.FullName), + "company": optStringArg(changeset.Company), + "countryCode": optStringArg(changeset.CountryCode), + "email": optStringArg(changeset.Email), + "picture": optStringArg(changeset.Picture), } } diff --git a/api/views.go b/api/views.go index 9f7ec75..1ddc773 100644 --- a/api/views.go +++ b/api/views.go @@ -1,6 +1,7 @@ package api import ( + graphql "github.com/cli/shurcooL-graphql" "sort" "strings" ) @@ -39,7 +40,7 @@ func (c *Views) Get(name string) (*View, error) { } variables := map[string]interface{}{ - "name": name, + "name": graphql.String(name), } err := c.client.Query(&query, variables) @@ -83,8 +84,8 @@ func (c *Views) List() ([]ViewListItem, error) { } type ViewConnectionInput struct { - RepositoryName string `json:"repositoryName"` - Filter string `json:"filter"` + RepositoryName graphql.String `json:"repositoryName"` + Filter graphql.String `json:"filter"` } func (c *Views) Create(name, description string, connections map[string]string) error { @@ -100,14 +101,14 @@ func (c *Views) Create(name, description string, connections map[string]string) viewConnections = append( viewConnections, ViewConnectionInput{ - RepositoryName: k, - Filter: v, + RepositoryName: graphql.String(k), + Filter: graphql.String(v), }) } variables := map[string]interface{}{ - "name": name, - "description": description, + "name": graphql.String(name), + "description": graphql.String(description), "connections": viewConnections, } @@ -118,12 +119,12 @@ func (c *Views) Delete(name, reason string) error { var mutation struct { DeleteSearchDomain struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"deleteSearchDomain(name: $name, deleteMessage: $reason)"` } variables := map[string]interface{}{ - "name": name, - "reason": reason, + "name": graphql.String(name), + "reason": graphql.String(reason), } return c.client.Mutate(&mutation, variables) @@ -141,13 +142,13 @@ func (c *Views) UpdateConnections(name string, connections map[string]string) er viewConnections = append( viewConnections, ViewConnectionInput{ - RepositoryName: k, - Filter: v, + RepositoryName: graphql.String(k), + Filter: graphql.String(v), }) } variables := map[string]interface{}{ - "viewName": name, + "viewName": graphql.String(name), "connections": viewConnections, } @@ -158,13 +159,13 @@ func (c *Views) UpdateDescription(name string, description string) error { var mutation struct { UpdateDescriptionMutation struct { // We have to make a selection, so just take __typename - Typename string `graphql:"__typename"` + Typename graphql.String `graphql:"__typename"` } `graphql:"updateDescriptionForSearchDomain(name: $name, newDescription: $description)"` } variables := map[string]interface{}{ - "name": name, - "description": description, + "name": graphql.String(name), + "description": graphql.String(description), } return c.client.Mutate(&mutation, variables) diff --git a/go.mod b/go.mod index 96ea795..d9a5052 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/humio/cli go 1.20 require ( + github.com/cli/shurcooL-graphql v0.0.3 github.com/gofrs/uuid v3.2.0+incompatible - github.com/hasura/go-graphql-client v0.10.0 github.com/hpcloud/tail v1.0.0 github.com/mitchellh/go-homedir v1.1.0 github.com/olekukonko/tablewriter v0.0.1 @@ -19,10 +19,8 @@ require ( require ( github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/google/uuid v1.3.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/klauspost/compress v1.16.7 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-runewidth v0.0.6 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect @@ -32,12 +30,10 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.4.2 // indirect + golang.org/x/net v0.10.0 // indirect golang.org/x/text v0.9.0 // indirect gopkg.in/fsnotify.v1 v1.4.7 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - nhooyr.io/websocket v1.8.7 // indirect ) - -replace github.com/gin-gonic/gin v1.6.3 => github.com/gin-gonic/gin v1.7.7 diff --git a/go.sum b/go.sum index 70dd9ec..0ad22cd 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,8 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/cli/shurcooL-graphql v0.0.3 h1:CtpPxyGDs136/+ZeyAfUKYmcQBjDlq5aqnrDCW5Ghh8= +github.com/cli/shurcooL-graphql v0.0.3/go.mod h1:tlrLmw/n5Q/+4qSvosT+9/W5zc8ZMjnJeYBxSdb4nWA= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -59,26 +61,9 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.7.7 h1:3DoBmSbJbZAWqXJC3SLjAPfutPJJRN1U5pALB7EeTTs= -github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= -github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= -github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= -github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -106,7 +91,6 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -119,7 +103,6 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -135,57 +118,36 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/graph-gophers/graphql-go v1.5.0 h1:fDqblo50TEpD0LY7RXk/LFVYEVqo3+tXMNMPSVXA1yc= -github.com/graph-gophers/graphql-transport-ws v0.0.2 h1:DbmSkbIGzj8SvHei6n8Mh9eLQin8PtA8xY9eCzjRpvo= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hasura/go-graphql-client v0.10.0 h1:eQm/ap/rqxMG6yAGe6J+FkXu1VqJ9p21E63vz0A7zLQ= -github.com/hasura/go-graphql-client v0.10.0/go.mod h1:z9UPkMmCBMuJjvBEtdE6F+oTR2r15AcjirVNq/8P+Ig= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= -github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-runewidth v0.0.6 h1:V2iyH+aX9C5fsYCpK60U8BYIvmhqxuOL3JZcqc1NB7k= github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= @@ -216,7 +178,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -226,10 +187,6 @@ github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gt github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= -github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -247,7 +204,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -313,6 +269,9 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220923203811-8be639271d50/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -347,7 +306,6 @@ golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -370,10 +328,12 @@ golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -528,7 +488,6 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -552,8 +511,6 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= -nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=