diff --git a/formal/api/client.go b/formal/api/client.go index 72f55563..0620c0eb 100644 --- a/formal/api/client.go +++ b/formal/api/client.go @@ -1,53 +1,14 @@ package api import ( - "errors" - "fmt" - "io" - "net/http" - "time" + "github.com/formalco/go-sdk/sdk" ) -type Client struct { - HostURL string - HTTPClient *http.Client - APIKey string +type GrpcClient struct { ReturnSensitiveValue bool + Sdk *sdk.FormalSDK } -const FORMAL_HOST_URL string = "https://api.formalcloud.net" - -func NewClient(apiKey string, returnSensitiveValue bool) (*Client, error) { - c := Client{ - HTTPClient: &http.Client{Timeout: 100 * time.Second}, - APIKey: apiKey, - HostURL: FORMAL_HOST_URL, - ReturnSensitiveValue: returnSensitiveValue, - } - - return &c, nil -} - -func (c *Client) doRequest(req *http.Request) ([]byte, error) { - if c.APIKey == "" { - return nil, errors.New("client was not initialized with an api key") - } - req.Header.Add("X-Api-Key", c.APIKey) - - res, err := c.HTTPClient.Do(req) - if err != nil { - return nil, err - } - defer res.Body.Close() - - body, err := io.ReadAll(res.Body) - if err != nil { - return nil, err - } - - if res.StatusCode != http.StatusOK { - return nil, fmt.Errorf("status: %d, body: %s", res.StatusCode, body) - } - - return body, err +func NewClient(apiKey string, returnSensitiveValue bool) *GrpcClient { + return &GrpcClient{Sdk: sdk.New(apiKey), ReturnSensitiveValue: returnSensitiveValue} } diff --git a/formal/api/client_cloud_account.go b/formal/api/client_cloud_account.go deleted file mode 100644 index 425ce12d..00000000 --- a/formal/api/client_cloud_account.go +++ /dev/null @@ -1,96 +0,0 @@ -package api - -import ( - "encoding/json" - "net/http" - "strings" -) - -type CloudIntegration struct { - Id string `json:"id,omitempty"` - AwsFormalId string `json:"aws_formal_id,omitempty"` - CloudAccountName string `json:"cloud_account_name,omitempty"` - CloudProvider string `json:"cloud_provider,omitempty"` - AwsFormalIamRole string `json:"aws_formal_iam_role,omitempty"` - AwsFormalHandshakeID string `json:"aws_formal_handshake_id,omitempty"` - GCPProjectID string `json:"gcp_project_id,omitempty"` - TemplateBody string `json:"aws_template_body,omitempty"` - AwsFormalPingbackArn string `json:"aws_formal_pingback_arn,omitempty"` - AwsFormalStackName string `json:"aws_formal_stack_name,omitempty"` - AwsCloudRegion string `json:"aws_cloud_region,omitempty"` - AwsFormalR53PrivateHostedZoneId string `json:"aws_formal_r53_private_hosted_zone_id,omitempty"` -} - -func (c *Client) CreateCloudAccount(cloudAccountName, awsCloudRegion string) (*CloudIntegration, error) { - // Compile - p := CloudIntegration{ - CloudAccountName: cloudAccountName, - AwsCloudRegion: awsCloudRegion, - } - - // Send - rb, err := json.Marshal(p) - if err != nil { - return nil, err - } - req, err := http.NewRequest("POST", c.HostURL+"/admin/integrations/cloud/aws", strings.NewReader(string(rb))) - if err != nil { - return nil, err - } - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - var ret CloudIntegration - err = json.Unmarshal(body, &ret) - if err != nil { - return nil, err - } - - return &ret, nil -} - -type GetIntegrationsCloudAccountByIDRes struct { - Integration CloudIntegration `json:"integration"` -} - -func (c *Client) GetCloudAccount(cloudAccountFormalId string) (*CloudIntegration, error) { - req, err := http.NewRequest("GET", c.HostURL+"/admin/integrations/cloud/"+cloudAccountFormalId, nil) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - cloudIntegrationRes := GetIntegrationsCloudAccountByIDRes{} - err = json.Unmarshal(body, &cloudIntegrationRes) - if err != nil { - return nil, err - } - - return &cloudIntegrationRes.Integration, nil -} - -// DeleteGroup - Deletes a group -func (c *Client) DeleteCloudAccount(cloudAccountFormalId string) error { - req, err := http.NewRequest("DELETE", c.HostURL+"/admin/integrations/cloud/"+cloudAccountFormalId, nil) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} diff --git a/formal/api/client_dataplane.go b/formal/api/client_dataplane.go deleted file mode 100644 index 502a8df9..00000000 --- a/formal/api/client_dataplane.go +++ /dev/null @@ -1,151 +0,0 @@ -package api - -import ( - "encoding/json" - "errors" - "net/http" - "strings" -) - -// CreateDataplane - Create new dataplane -func (c *Client) CreateDataplane(payload FlatDataplane) (*FlatDataplane, error) { - rb, err := json.Marshal(payload) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", c.HostURL+"/admin/integrations/cloud/stacks/new-dataplane", strings.NewReader(string(rb))) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - dataplane := FlatDataplane{} - err = json.Unmarshal(body, &dataplane) - if err != nil { - return nil, err - } - - return &dataplane, nil -} - -func (c *Client) GetDataplane(dataplaneId string) (*FlatDataplane, error) { - // Send GET request - req, err := http.NewRequest("GET", c.HostURL+"/admin/integrations/cloud/stacks/"+dataplaneId, nil) - if err != nil { - return nil, err - } - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - // Parse response - plane := FlatDataplane{} - err = json.Unmarshal(body, &plane) - if err != nil { - return nil, err - } - - return &plane, nil -} - -// DeleteDataplane - Deletes a dataplane -func (c *Client) DeleteDataplane(dataplaneId string) error { - if dataplaneId == "" { - return errors.New("dataplaneId is empty") - } - req, err := http.NewRequest("DELETE", c.HostURL+"/admin/integrations/cloud/stacks/"+dataplaneId, nil) - - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} - -func (c *Client) CreateDataplaneRoutes(payload DataplaneRoutes) (*DataplaneRoutes, error) { - rb, err := json.Marshal(payload) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", c.HostURL+"/admin/integrations/cloud/stacks/"+payload.DataplaneId+"/routes", - strings.NewReader(string(rb))) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - dataplaneRoutes := DataplaneRoutes{} - err = json.Unmarshal(body, &dataplaneRoutes) - if err != nil { - return nil, err - } - - return &dataplaneRoutes, nil -} - -func (c *Client) GetDataplaneRoutes(id string) (*DataplaneRoutes, error) { - // Send GET request - req, err := http.NewRequest("GET", c.HostURL+"/admin/integrations/cloud/stacks/routes/"+id, nil) - if err != nil { - return nil, err - } - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - // Parse response - routes := DataplaneRoutes{} - err = json.Unmarshal(body, &routes) - if err != nil { - return nil, err - } - - return &routes, nil -} - -func (c *Client) DeleteDataplaneRoutes(routeId string) error { - if routeId == "" { - return errors.New("routeId is empty") - } - - req, err := http.NewRequest("DELETE", c.HostURL+"/admin/integrations/cloud/stacks/routes/"+routeId, nil) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} diff --git a/formal/api/client_datastore.go b/formal/api/client_datastore.go deleted file mode 100644 index c23f41f2..00000000 --- a/formal/api/client_datastore.go +++ /dev/null @@ -1,183 +0,0 @@ -package api - -import ( - "encoding/json" - "net/http" - "strings" -) - -type GetAndCreateDataStoreResponseV2 struct { - DataStoreId string `json:"datastore_id"` - DataStore Datastore `json:"datastore"` -} - -// CreateDatastore - Create new datastore -func (c *Client) CreateDatastore(payload Datastore) (string, error) { - rb, err := json.Marshal(payload) - if err != nil { - return "", err - } - - req, err := http.NewRequest("POST", c.HostURL+"/admin/datastores", strings.NewReader(string(rb))) - if err != nil { - return "", err - } - - body, err := c.doRequest(req) - if err != nil { - return "", err - } - - datastore := GetAndCreateDataStoreResponseV2{} - err = json.Unmarshal(body, &datastore) - if err != nil { - return "", err - } - - return datastore.DataStoreId, nil -} - -// GetDatastore - Returns a specifc datastore -func (c *Client) GetDatastore(datastoreId string) (*Datastore, error) { - req, err := http.NewRequest("GET", c.HostURL+"/admin/datastores/"+datastoreId, nil) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - dsInfra := GetAndCreateDataStoreResponseV2{} - err = json.Unmarshal(body, &dsInfra) - if err != nil { - return nil, err - } - - return &dsInfra.DataStore, nil -} - -// UpdateDatastoreName -func (c *Client) UpdateDatastoreName(datastoreId string, datastoreUpdate Datastore) error { - rb, err := json.Marshal(datastoreUpdate) - if err != nil { - return nil - } - - req, err := http.NewRequest("PUT", c.HostURL+"/admin/datastores/"+datastoreId+"/name", strings.NewReader(string(rb))) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} - -// UpdateDatastoreName -func (c *Client) UpdateDatastoreHealthCheckDbName(datastoreId string, datastoreUpdate Datastore) error { - rb, err := json.Marshal(datastoreUpdate) - if err != nil { - return nil - } - - req, err := http.NewRequest("PUT", c.HostURL+"/admin/datastores/"+datastoreId+"/health-check-db-name", strings.NewReader(string(rb))) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} - -// To be used in the future with other fields too -func (c *Client) UpdateDatastoreDefaultAcccessBehavior(datastoreId string, datastoreUpdate Datastore) error { - rb, err := json.Marshal(datastoreUpdate) - if err != nil { - return nil - } - - req, err := http.NewRequest("PUT", c.HostURL+"/admin/datastores/"+datastoreId+"/default-access-behavior", strings.NewReader(string(rb))) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} - -func (c *Client) UpdateDatastoreDbDiscoveryConfig(datastoreId string, datastoreUpdate Datastore) error { - rb, err := json.Marshal(datastoreUpdate) - if err != nil { - return nil - } - - req, err := http.NewRequest("PUT", c.HostURL+"/admin/datastores/"+datastoreId+"/db-discovery-config", strings.NewReader(string(rb))) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} - -// DeleteDatastore - Deletes a datastore -func (c *Client) DeleteDatastore(datastoreId string) error { - req, err := http.NewRequest("DELETE", c.HostURL+"/admin/datastores/"+datastoreId, nil) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} diff --git a/formal/api/client_default_field_encryption.go b/formal/api/client_default_field_encryption.go deleted file mode 100644 index ccf02ea0..00000000 --- a/formal/api/client_default_field_encryption.go +++ /dev/null @@ -1,83 +0,0 @@ -package api - -import ( - "encoding/json" - "net/http" - "strings" -) - -type DefaultFieldEncryptionRes struct { - DefaultFieldEncryption DefaultFieldEncryptionStruct `json:"default_field_encryption_policy"` -} - -func (c *Client) CreateOrUpdateDefaultFieldEncryption(payload DefaultFieldEncryptionStruct) (*DefaultFieldEncryptionStruct, error) { - rb, err := json.Marshal(payload) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", c.HostURL+"/admin/encryption/default-policy", strings.NewReader(string(rb))) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - var createdDefaultFieldEncryption DefaultFieldEncryptionRes - err = json.Unmarshal(body, &createdDefaultFieldEncryption) - - if err != nil { - return nil, err - } - - return &createdDefaultFieldEncryption.DefaultFieldEncryption, nil -} - - -// GetDefaultFieldEncryption - Returns a specifc defaultFieldEncryption -// Done 2 -func (c *Client) GetDefaultFieldEncryption() (*DefaultFieldEncryptionStruct, error) { - req, err := http.NewRequest("GET", c.HostURL+"/admin/encryption/default-policy", nil) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - // Adapting to existing response format - resJson := DefaultFieldEncryptionRes{} - err = json.Unmarshal(body, &resJson) - if err != nil { - return nil, err - } - - - return &resJson.DefaultFieldEncryption, nil -} - -// DeleteDefaultFieldEncryption - Deletes a defaultFieldEncryption -// DONE -func (c *Client) DeleteDefaultFieldEncryption() error { - req, err := http.NewRequest("DELETE",c.HostURL+"/admin/encryption/default-policy", nil) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} diff --git a/formal/api/client_field_encryption.go b/formal/api/client_field_encryption.go deleted file mode 100644 index c7844c7f..00000000 --- a/formal/api/client_field_encryption.go +++ /dev/null @@ -1,118 +0,0 @@ -package api - -import ( - "encoding/json" - "net/http" - "strings" -) - -type CreateFieldEncryptionRes struct { - DatastoreID string `json:"datastore_id"` - FieldEncryption FieldEncryptionStruct `json:"field"` -} - -func (c *Client) CreateFieldEncryption(payload FieldEncryptionStruct) (*FieldEncryptionStruct, error) { - rb, err := json.Marshal(payload) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", c.HostURL+"/admin/stores/"+payload.DsId+"/encryption/field", strings.NewReader(string(rb))) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - var createdFieldEncryption CreateFieldEncryptionRes - err = json.Unmarshal(body, &createdFieldEncryption) - - if err != nil { - return nil, err - } - - return &createdFieldEncryption.FieldEncryption, nil -} - -type GetFieldEncryptionEndpointRes struct { - FieldEncryptions []FieldEncryptionStruct `json:"fields"` -} - -// GetFieldEncryption - Returns a specifc fieldEncryption -// Done 2 -func (c *Client) GetFieldEncryption(dataStoreId, targetPath string) (*FieldEncryptionStruct, error) { - req, err := http.NewRequest("GET", c.HostURL+"/admin/stores/"+dataStoreId+"/encryption/field", nil) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - // Adapting to existing response format - resJson := GetFieldEncryptionEndpointRes{} - err = json.Unmarshal(body, &resJson) - if err != nil { - return nil, err - } - for _, resFieldEncryption := range resJson.FieldEncryptions { - if targetPath == resFieldEncryption.Path { - return &resFieldEncryption, nil - } - } - - return nil, nil -} - -// UpdateFieldEncryption - Updates an fieldEncryption -// func (c *Client) UpdateFieldEncryption(fieldEncryptionId string, fieldEncryptionUpdate FieldEncryptionOrgItem) error { -// rb, err := json.Marshal(fieldEncryptionUpdate) -// if err != nil { -// return err -// } - -// req, err := http.NewRequest("PUT", c.HostURL+"/admin/policies/"+fieldEncryptionId, strings.NewReader(string(rb))) -// if err != nil { -// return err -// } - -// // TODO: Though the api restricts fields, best to restrict here as well -// body, err := c.doRequest(req) -// if err != nil { -// return err -// } - -// var res Message -// err = json.Unmarshal(body, &res) -// if err != nil { -// return err -// } - -// return nil -// } - -// DeleteFieldEncryption - Deletes a fieldEncryption -// DONE -func (c *Client) DeleteFieldEncryption(dataStoreId, formalKeyId string) error { - req, err := http.NewRequest("DELETE", c.HostURL+"/admin/stores/"+dataStoreId+"/encryption/field/"+formalKeyId, nil) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} diff --git a/formal/api/client_group.go b/formal/api/client_group.go deleted file mode 100644 index b03da12a..00000000 --- a/formal/api/client_group.go +++ /dev/null @@ -1,115 +0,0 @@ -package api - -import ( - "encoding/json" - "net/http" - "strings" -) - -type CreateGroupEndpointRes struct { - Group Group `json:"group"` - Message string `json:"message"` -} - -// Done 2 -// Create new group -func (c *Client) CreateGroup(payload Group) (*Group, error) { - rb, err := json.Marshal(payload) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", c.HostURL+"/admin/identities/groups", strings.NewReader(string(rb))) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - createdGroupRes := CreateGroupEndpointRes{} - err = json.Unmarshal(body, &createdGroupRes) - - if err != nil { - return nil, err - } - - return &createdGroupRes.Group, nil -} - -type GetGroupEndpointRes struct { - Group Group `json:"group"` -} - -// Done 2 -// GetGroup - Returns a specifc group -func (c *Client) GetGroup(groupId string) (*Group, error) { - req, err := http.NewRequest("GET", c.HostURL+"/admin/identities/groups/"+groupId, nil) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - // Adapting to existing response format - resJson := GetGroupEndpointRes{} - err = json.Unmarshal(body, &resJson) - if err != nil { - return nil, err - } - group := resJson.Group - - return &group, nil -} - -// UpdateGroup - Updates an group -func (c *Client) UpdateGroup(groupId string, groupUpdate Group) error { - rb, err := json.Marshal(groupUpdate) - if err != nil { - return err - } - - req, err := http.NewRequest("POST", c.HostURL+"/admin/identities/groups/"+groupId, strings.NewReader(string(rb))) - if err != nil { - return err - } - - // TODO: Though the api restricts fields, best to restrict here as well - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} - -// DeleteGroup - Deletes a group -func (c *Client) DeleteGroup(groupId string) error { - req, err := http.NewRequest("DELETE", c.HostURL+"/admin/identities/groups/"+groupId, nil) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} diff --git a/formal/api/client_group_link_role.go b/formal/api/client_group_link_role.go deleted file mode 100644 index 83ea7ffc..00000000 --- a/formal/api/client_group_link_role.go +++ /dev/null @@ -1,129 +0,0 @@ -package api - -import ( - "encoding/json" - "net/http" - "strings" -) - -// CreateGroupLinkRole - Create new link from user to group -type CreateGroupLinkRoleResponse struct { - Message string `json:"message"` -} - -type GroupLinkRolePayload struct { - RoleIds []string `json:"roles"` -} - -func (c *Client) CreateGroupLinkRole(roleId, groupId string) error { - // Compile - routePayload := GroupLinkRolePayload{ - RoleIds: []string{roleId}, - } - - // Send - rb, err := json.Marshal(routePayload) - if err != nil { - return err - } - req, err := http.NewRequest("POST", c.HostURL+"/admin/identities/groups/"+groupId+"/link/users", strings.NewReader(string(rb))) - if err != nil { - return err - } - body, err := c.doRequest(req) - if err != nil { - return err - } - var ret CreateGroupLinkRoleResponse - err = json.Unmarshal(body, &ret) - if err != nil { - return err - } - - return nil -} - -func (c *Client) GetGroupLinkRole(roleId, groupId string) (string, error) { - req, err := http.NewRequest("GET", c.HostURL+"/admin/identities/groups/"+groupId, nil) - if err != nil { - return "", err - } - - body, err := c.doRequest(req) - if err != nil { - return "", err - } - - group := GetGroupEndpointRes{} - err = json.Unmarshal(body, &group) - if err != nil { - return "", err - } - for _, existingLinkRoleId := range group.Group.RolesIDs { - if existingLinkRoleId == roleId { - return roleId, nil - } - } - - return "", nil -} - -// UpdateGroupLinkRole - Updates an roleLinkGroup -// func (c *Client) UpdateGroupLinkRole(roleLinkGroupId string, roleLinkGroupUpdate GroupLinkRoleStruct) error { -// rb, err := json.Marshal(roleLinkGroupUpdate) -// if err != nil { -// return err -// } - -// req, err := http.NewRequest("PUT", c.HostURL+"/admin/policies/"+roleLinkGroupId, strings.NewReader(string(rb))) -// if err != nil { -// return err -// } - -// // TODO: Though the api restricts fields, best to restrict here as well -// body, err := c.doRequest(req) -// if err != nil { -// return err -// } - -// var res Message -// err = json.Unmarshal(body, &res) -// if err != nil { -// return err -// } - -// return nil -// } - -// DeleteGroupLinkRole - Deletes a roleLinkGroup -func (c *Client) DeleteGroupLinkRole(roleId, groupId string) error { - // Compile - routePayload := GroupLinkRolePayload{ - RoleIds: []string{roleId}, - } - - // Send - rb, err := json.Marshal(routePayload) - if err != nil { - return err - } - - req, err := http.NewRequest("DELETE", c.HostURL+"/admin/identities/groups/"+groupId+"/link/users", strings.NewReader(string(rb))) - - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} diff --git a/formal/api/client_key.go b/formal/api/client_key.go deleted file mode 100644 index fb89d227..00000000 --- a/formal/api/client_key.go +++ /dev/null @@ -1,85 +0,0 @@ -package api - -import ( - "encoding/json" - "net/http" - "strings" -) - -type KeyResponse struct { - Key KeyStruct `json:"key"` -} - -const keyApiPath = "/admin/integrations/encryption" - -// Done 2 -func (c *Client) CreateKey(payload KeyStruct) (*KeyStruct, error) { - rb, err := json.Marshal(payload) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", c.HostURL+ keyApiPath, strings.NewReader(string(rb))) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - createdKeyRes := KeyResponse{} - err = json.Unmarshal(body, &createdKeyRes) - - if err != nil { - return nil, err - } - - return &createdKeyRes.Key, nil -} - -// Done 2 -// GetKey - Returns a specifc key -func (c *Client) GetKey(formalKeyId string) (*KeyStruct, error) { - req, err := http.NewRequest("GET", c.HostURL+keyApiPath + "/" + formalKeyId, nil) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - // Adapting to existing response format - getKeyRes := KeyResponse{} - err = json.Unmarshal(body, &getKeyRes) - if err != nil { - return nil, err - } - - - return &getKeyRes.Key, nil -} - - -func (c *Client) DeleteKey(formalKeyId string) error { - req, err := http.NewRequest("DELETE", c.HostURL+keyApiPath + "/" + formalKeyId, nil) - - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} diff --git a/formal/api/client_native_role.go b/formal/api/client_native_role.go deleted file mode 100644 index 33d2da7e..00000000 --- a/formal/api/client_native_role.go +++ /dev/null @@ -1,128 +0,0 @@ -package api - -import ( - "encoding/json" - "net/http" - "strings" -) - -type NativeRoleRes struct { - NativeRole NativeRole `json:"native_role"` - Message string `json:"message"` -} - -func (c *Client) CreateNativeRole(payload NativeRole) (*NativeRole, error) { - rb, err := json.Marshal(payload) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", c.HostURL+"/admin/stores/"+payload.DatastoreId+"/native-roles", strings.NewReader(string(rb))) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - createdRoleRes := NativeRoleRes{} - err = json.Unmarshal(body, &createdRoleRes) - - if err != nil { - return nil, err - } - - return &createdRoleRes.NativeRole, nil -} - -func (c *Client) GetNativeRole(datastoreId, nativeRoleId string) (*NativeRole, error) { - req, err := http.NewRequest("GET", c.HostURL+"/admin/stores/"+datastoreId+"/native-roles/"+nativeRoleId, nil) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - // Adapting to existing response format - resJson := NativeRoleRes{} - err = json.Unmarshal(body, &resJson) - if err != nil { - return nil, err - } - role := resJson.NativeRole - - return &role, nil -} - -type NewSecretPayload struct { - Secret string `json:"secret"` -} - -func (c *Client) UpdateNativeRole(datastoreId, roleId, newSecret string, useAsDefault bool) error { - if newSecret != "" { - payload := NewSecretPayload{Secret: newSecret} - rb, err := json.Marshal(payload) - if err != nil { - return err - } - req, err := http.NewRequest("PUT", c.HostURL+"/admin/stores/"+datastoreId+"/native-roles/"+roleId+"/secret", strings.NewReader(string(rb))) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - } else if useAsDefault { - req, err := http.NewRequest("POST", c.HostURL+"/admin/stores/"+datastoreId+"/native-roles/"+roleId+"/default", nil) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - } - - return nil -} - -// DeleteRole - Deletes a role -func (c *Client) DeleteNativeRole(datastoreId, roleId string) error { - req, err := http.NewRequest("DELETE", c.HostURL+"/admin/stores/"+datastoreId+"/native-roles/"+roleId, nil) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} diff --git a/formal/api/client_native_role_link.go b/formal/api/client_native_role_link.go deleted file mode 100644 index 46995e54..00000000 --- a/formal/api/client_native_role_link.go +++ /dev/null @@ -1,78 +0,0 @@ -package api - -import ( - "encoding/json" - "net/http" - "strings" -) - -// CreateNativeRoleLink - Create new link from user to group -type NativeRoleLinkResponse struct { - Link NativeRoleLink `json:"link"` -} - -func (c *Client) CreateNativeRoleLink(datastoreId, nativeRoleId, formalIdentityId, formalIdentityType string) error { - payload := NativeRoleLink{ - FormalIdentityType: formalIdentityType, - } - - rb, err := json.Marshal(payload) - if err != nil { - return err - } - req, err := http.NewRequest("PUT", c.HostURL+"/admin/stores/"+datastoreId+"/native-roles/"+nativeRoleId+"/link/"+formalIdentityId, strings.NewReader(string(rb))) - if err != nil { - return err - } - body, err := c.doRequest(req) - if err != nil { - return err - } - var ret NativeRoleLinkResponse - err = json.Unmarshal(body, &ret) - if err != nil { - return err - } - - return nil -} - -func (c *Client) GetNativeRoleLink(datastoreId, identityId string) (*NativeRoleLink, error) { - req, err := http.NewRequest("GET", c.HostURL+"/admin/stores/"+datastoreId+"/native-roles/identity-links/"+identityId, nil) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - var ret NativeRoleLinkResponse - err = json.Unmarshal(body, &ret) - if err != nil { - return nil, err - } - return &ret.Link, nil -} - -func (c *Client) DeleteNativeRoleLink(datastoreId, formalIdentityId string) error { - req, err := http.NewRequest("DELETE", c.HostURL+"/admin/stores/"+datastoreId+"/native-roles/ignored/link/"+formalIdentityId, nil) - - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} diff --git a/formal/api/client_policy.go b/formal/api/client_policy.go deleted file mode 100644 index 1e87e50e..00000000 --- a/formal/api/client_policy.go +++ /dev/null @@ -1,110 +0,0 @@ -package api - -import ( - "context" - "encoding/json" - "net/http" - "strings" -) - -// CreatePolicy - Create new policy -func (c *Client) CreatePolicy(ctx context.Context, payload CreatePolicyPayload) (*Policy, error) { - rb, err := json.Marshal(payload) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", c.HostURL+"/admin/policies", strings.NewReader(string(rb))) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - createdPolicy := Policy{} - err = json.Unmarshal(body, &createdPolicy) - if err != nil { - return nil, err - } - - return &createdPolicy, nil -} - -// At the moment, only GET is shaped such. Create needs to be updated (is just struct atm) -type GetAndCreatePolicyEndpointRes struct { - Policy Policy `json:"policy"` -} - -// GetPolicy - Returns a specifc policy -func (c *Client) GetPolicy(policyId string) (*Policy, error) { - req, err := http.NewRequest("GET", c.HostURL+"/admin/policies/"+policyId, nil) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - // Adapting to existing response format - resJson := GetAndCreatePolicyEndpointRes{} - err = json.Unmarshal(body, &resJson) - if err != nil { - return nil, err - } - policy := resJson.Policy - - return &policy, nil -} - -// UpdatePolicy - Updates an policy -func (c *Client) UpdatePolicy(policyId string, policyUpdate Policy) error { - rb, err := json.Marshal(policyUpdate) - if err != nil { - return err - } - - req, err := http.NewRequest("PUT", c.HostURL+"/admin/policies/"+policyId, strings.NewReader(string(rb))) - if err != nil { - return err - } - - // TODO: Though the api restricts fields, best to restrict here as well - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} - -// DeletePolicy - Deletes a policy -func (c *Client) DeletePolicy(policyId string) error { - req, err := http.NewRequest("DELETE", c.HostURL+"/admin/policies/"+policyId, nil) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} diff --git a/formal/api/client_role.go b/formal/api/client_role.go deleted file mode 100644 index 7916f91f..00000000 --- a/formal/api/client_role.go +++ /dev/null @@ -1,120 +0,0 @@ -package api -import ( - "encoding/json" - "net/http" - "strings" -) - -type CreateRoleEndpointRes struct { - Role Role `json:"role"` - Message string `json:"message"` -} - -// Done 2 -// Create new role -func (c *Client) CreateRole(payload Role) (*Role, error) { - fullPayload := struct { - Role Role `json:"role"` - }{ - Role: payload, - } - - rb, err := json.Marshal(fullPayload) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", c.HostURL+"/admin/identities/roles", strings.NewReader(string(rb))) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - createdRoleRes := CreateRoleEndpointRes{} - err = json.Unmarshal(body, &createdRoleRes) - - if err != nil { - return nil, err - } - - return &createdRoleRes.Role, nil -} - -type GetRoleEndpointRes struct { - Role Role `json:"role"` -} - -// Done 2 -// GetRole - Returns a specifc role -func (c *Client) GetRole(roleId string) (*Role, error) { - req, err := http.NewRequest("GET", c.HostURL+"/admin/identities/roles/"+roleId, nil) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - // Adapting to existing response format - resJson := GetRoleEndpointRes{} - err = json.Unmarshal(body, &resJson) - if err != nil { - return nil, err - } - role := resJson.Role - - return &role, nil -} - -// UpdateGroup - Updates an group -func (c *Client) UpdateRole(roleId string, roleData Role) error { - rb, err := json.Marshal(roleData) - if err != nil { - return err - } - - req, err := http.NewRequest("PUT", c.HostURL+"/admin/identities/roles/"+roleId, strings.NewReader(string(rb))) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} - - -// DeleteRole - Deletes a role -func (c *Client) DeleteRole(roleId string) error { - req, err := http.NewRequest("DELETE", c.HostURL+"/admin/identities/roles/"+roleId, nil) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} diff --git a/formal/api/client_sidecar.go b/formal/api/client_sidecar.go deleted file mode 100644 index 985dbab6..00000000 --- a/formal/api/client_sidecar.go +++ /dev/null @@ -1,129 +0,0 @@ -package api - -import ( - "encoding/json" - "fmt" - "net/http" - "strings" -) - -type GetAndCreateSidecarResponseV2 struct { - Id string `json:"id"` - Sidecar Sidecar `json:"sidecar"` -} - -// GetSidecar - Returns a specifc sidecar - -type GetSidecarTlsCertResponse struct { - Secret string `json:"secret"` -} - -func (c *Client) GetSidecarTlsCert(sidecarId string) (*string, error) { - req, err := http.NewRequest("GET", c.HostURL+"/admin/sidecars/"+sidecarId+"/tlscert", nil) - if err != nil { - return nil, err - } - - body, err := c.doRequest(req) - if err != nil { - return nil, err - } - - tlsCertRes := GetSidecarTlsCertResponse{} - err = json.Unmarshal(body, &tlsCertRes) - if err != nil { - return nil, err - } - - return &tlsCertRes.Secret, nil -} - -// UpdateSidecarName -func (c *Client) UpdateSidecarName(sidecarId string, sidecarUpdate Sidecar) error { - rb, err := json.Marshal(sidecarUpdate) - if err != nil { - return nil - } - - req, err := http.NewRequest("PUT", c.HostURL+"/admin/sidecars/"+sidecarId+"/name", strings.NewReader(string(rb))) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} - -func (c *Client) UpdateSidecarVersion(sidecarId, version string) error { - req, err := http.NewRequest(http.MethodPut, fmt.Sprintf("%s/admin/sidecars/%s/version/%s", c.HostURL, sidecarId, version), nil) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} - -func (c *Client) UpdateSidecarHostname(sidecarId, hostname string) error { - req, err := http.NewRequest(http.MethodPut, fmt.Sprintf("%s/admin/sidecars/%s/sidecar-hostname?hostname=%s", c.HostURL, sidecarId, hostname), nil) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - - return nil -} - -func (c *Client) UpdateSidecarGlobalKMSEncrypt(sidecarId string, sidecarUpdate Sidecar) error { - if sidecarUpdate.FullKMSDecryption { - req, err := http.NewRequest("PUT", c.HostURL+"/admin/sidecars/"+sidecarId+"/kms-decrypt-policy?enable=true", nil) - if err != nil { - return err - } - - body, err := c.doRequest(req) - if err != nil { - return err - } - - var res Message - err = json.Unmarshal(body, &res) - if err != nil { - return err - } - } - - return nil -} - -// DeleteSidecar - Deletes a sidecar diff --git a/formal/api/types.go b/formal/api/types.go deleted file mode 100644 index 5fd87c3b..00000000 --- a/formal/api/types.go +++ /dev/null @@ -1,226 +0,0 @@ -package api - -type FieldEncryptionStruct struct { - OrgId string `json:"org_id"` - DsId string `json:"datastore_id"` - FieldName string `json:"name"` - Path string `json:"path"` - KeyStorage string `json:"key_storage"` - KeyId string `json:"key_id"` - Alg string `json:"alg"` -} - -type DefaultFieldEncryptionStruct struct { - KmsKeyID string `json:"kms_key_id"` - EncryptionAlg string `json:"encryption_alg"` - DataKeyStorage string `json:"data_key_storage"` - UpdatedAt int `json:"updated_at"` -} - -// Used for datastore creation status -type Sidecar struct { - Id string `json:"id"` - Technology string `json:"technology"` - CloudAccountId string `json:"cloud_account_id"` - CloudProvider string `json:"cloud_provider"` - CloudRegion string `json:"cloud_region"` - CreatedAt int64 `json:"created_at"` - DataplaneId string `json:"dataplane_id"` - DsId string `json:"datastore_id"` - Deployed bool `json:"deployed"` - DeploymentType string `json:"deployment_type"` - FailOpen bool `json:"fail_open"` - FormalHostname string `json:"formal_hostname"` - FullKMSDecryption bool `json:"global_kms_decrypt"` - Name string `json:"name,omitempty"` - NetworkType string `json:"network_type"` - OrgId string `json:"org_id"` - ProxyStatus string `json:"proxy_status"` - ServerConnectionStatus string `json:"server_connection_status"` - ServerErrorMessage string `json:"server_error_message"` - Version string `json:"version"` -} - -type Datastore struct { - Id string `json:"id"` - CreatedAt int64 `json:"created_at"` - OrgId string `json:"org_id"` - DsId string `json:"datastore_id"` - Name string `json:"name,omitempty"` - OriginalHostname string `json:"hostname"` - Port int `json:"port"` - Technology string `json:"technology"` - HealthCheckDbName string `json:"health_check_db_name"` - DbDiscoveryJobWaitTime string `json:"db_discovery_job_wait_time"` - DbDiscoveryNativeRoleID string `json:"db_discovery_native_role_id"` -} - -type CreatePolicyPayload struct { - ID string `json:"id"` - Name string `json:"name"` - Description string `json:"description"` - Module string `json:"module"` - Active bool `json:"active"` - SourceType string `json:"source_type"` - Notification string `json:"notification"` - Owners []string `json:"owners"` -} - -type Policy struct { - ID string `json:"id"` - Name string `json:"name"` - Description string `json:"description"` - Module string `json:"module"` - SourceType string `json:"source_type"` - Notification string `json:"notification"` - Owners []string `json:"owners"` - Active bool `json:"active"` -} - -type Message struct { - Message string `json:"message"` -} - -type PolicyLinkStruct struct { - // ID of this link - ID string `json:"id"` - // ID of the policy - PolicyID string `json:"policy_id"` - // OrganisationID string `json:"org_id"` - // ID of the item it's linked to - ItemID string `json:"item_id"` - Type string `json:"type"` - // Active bool `json:"active"` - ExpireAt string `json:"expire_at"` -} - -type KeyStruct struct { - Id string `json:"id"` - OrgId string `json:"org_id"` - KeyName string `json:"name"` - KeyId string `json:"key_id"` - CloudRegion string `json:"cloud_region"` - KeyArn string `json:"arn"` - Active bool `json:"active"` - KeyType string `json:"key_type"` - // ^ kms, gcp, hashicorp - - ManagedBy string `json:"managed_by"` - // ^ managed_by, onprem, saas - - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at"` - CloudAccountID string `json:"cloud_account_id"` -} - -type Role struct { - ID string `json:"id"` - // OrganisationID *string `json:"organization_id"` - // Formal/idp etc - DBUsername string `json:"db_username"` - Type string `json:"type"` - - // Human - FirstName string `json:"first_name"` - LastName string `json:"last_name"` - Email string `json:"email"` - - // Other - // Role *string `json:"role"` - // Idp string `json:"idp"` - // IdpUserID string `json:"idp_user_id"` - - // Machine - Name string `json:"name"` - AppType string `json:"app_type"` - MachineRoleAccessToken string `json:"machine_role_access_token"` // returned in CREATE and GET routes. added for terraform - - // Status string `json:"status"` - ExpireAt int `json:"expire_at"` - Admin bool `json:"admin"` - // Created int64 `json:"created_at"` - // Policies []Policy `json:"linked_policies"` -} - -type CreateRolePayload struct { - // ID string `json:"id"` - - // Human - FirstName string `json:"first_name"` - LastName string `json:"last_name"` - Type string `json:"type"` - Email string `json:"email"` - Admin bool `json:"admin"` - - // Machine - Name string `json:"name"` - AppType string `json:"app_type"` -} - -type Group struct { - ID string `json:"id"` - Name string `json:"name"` - Description string `json:"description"` - RolesIDs []string `json:"user_ids"` -} - -/* -8/18 Sync with database.shared -- Changed terraform `formal_public_route_table_id` param from being assigned FormalVpcPublicRouteTables. It is now assigned FormalVpcPublicRouteTableId -*/ -type FlatDataplane struct { - Id string `json:"id"` - OrgId string `json:"org_id"` - StackName string `json:"name"` - Region string `json:"region"` - CloudAccountId string `json:"cloud_account_id"` - AvailabilityZone int `json:"availability_zone"` - VpcPeeringConnectionId string `json:"vpc_peering_connection_id"` - FormalR53PrivateHostedZoneId string `json:"formal_r53_private_hosted_zone_id"` - FormalVpcFlowLogsGroupArn string `json:"formal_vpc_flow_logs_group_arn"` - FormalVpcFlowLogGroupName string `json:"formal_vpc_flow_logs_group_name"` - FormalVpcFlowLogsIamRoleArn string `json:"formal_vpc_flow_logs_iam_role_arn"` - FormalVpcFlowLogsIamPolicyArn string `json:"formal_vpc_flow_logs_iam_policy_arn"` - InternetGateway string `json:"formal_vpc_igw_id"` - EgressOnlyInternetGateway string `json:"egress_only_igw"` - FormalVpcPrivateSubnetsIds interface{} `json:"formal_vpc_private_subnets_ids"` - FormalVpcPublicSubnetsIds interface{} `json:"formal_vpc_public_subnets_ids"` - FormalPublicSubnets []string `json:"formal_public_subnets"` - FormalPrivateSubnets []string `json:"formal_private_subnets"` - CustomerVpcRouteTables interface{} `json:"customer_vpc_route_tables"` - FormalNatGatewayIds interface{} `json:"formal_vpc_natg_ids"` - FormalVpcNatGatewayEips interface{} `json:"formal_vpc_natg_eips"` - FormalVpcPublicRouteTableId string `json:"formal_vpc_public_route_table_id"` - FormalVpcPublicRouteTables string `json:"formal_vpc_public_route_tables"` - FormalVpcPrivateRouteTables []string `json:"formal_vpc_private_route_table_routes"` - FormalVpcId string `json:"formal_vpc_id"` - FormalVpcCidrBlock string `json:"formal_vpc_cidr_block"` - EcsClusterName string `json:"ecs_cluster_name"` - EcsClusterArn string `json:"ecs_cluster_arn"` - Status string `json:"status"` - VpcPeering bool `json:"vpc_peering"` -} - -type DataplaneRoutes struct { - Id string `json:"id"` - OrgId string `json:"org_id"` - DataplaneId string `json:"dataplane_id"` - DestinationCidrBlock string `json:"destination_cidr_block"` - TransitGatewayId string `json:"transit_gateway_id"` - VpcPeeringConnectionId string `json:"vpc_peering_connection_id"` - Deployed bool `json:"deployed"` -} - -type NativeRole struct { - DatastoreId string `json:"datastore_id"` - NativeRoleId string `json:"native_role_id"` - NativeRoleSecret string `json:"native_role_secret"` - UseAsDefault bool `json:"use_as_default"` -} - -type NativeRoleLink struct { - DatastoreId string `json:"datastore_id"` - FormalIdentityId string `json:"formal_identity_id"` - FormalIdentityType string `json:"formal_identity_type"` - NativeRoleId string `json:"native_role_id"` -} diff --git a/formal/apiv2/client.go b/formal/apiv2/client.go deleted file mode 100644 index 69e0abbb..00000000 --- a/formal/apiv2/client.go +++ /dev/null @@ -1,14 +0,0 @@ -package apiv2 - -import ( - "github.com/formalco/go-sdk/sdk" -) - -type GrpcClient struct { - ReturnSensitiveValue bool - Sdk *sdk.FormalSDK -} - -func NewClient(apiKey string, returnSensitiveValue bool) *GrpcClient { - return &GrpcClient{Sdk: sdk.New(apiKey), ReturnSensitiveValue: returnSensitiveValue} -} diff --git a/formal/clients/clients.go b/formal/clients/clients.go index 54061b5b..e50a48c2 100644 --- a/formal/clients/clients.go +++ b/formal/clients/clients.go @@ -2,10 +2,8 @@ package clients import ( "github.com/formalco/terraform-provider-formal/formal/api" - "github.com/formalco/terraform-provider-formal/formal/apiv2" ) type Clients struct { - Http *api.Client - Grpc *apiv2.GrpcClient + Grpc *api.GrpcClient } diff --git a/formal/provider.go b/formal/provider.go index 2e95d380..e6ba994c 100644 --- a/formal/provider.go +++ b/formal/provider.go @@ -4,7 +4,6 @@ import ( "context" "os" - "github.com/formalco/terraform-provider-formal/formal/apiv2" "github.com/formalco/terraform-provider-formal/formal/clients" "github.com/formalco/terraform-provider-formal/formal/api" @@ -89,12 +88,8 @@ func configure(version string, p *schema.Provider) func(context.Context, *schema } returnSensitiveValue := d.Get("retrieve_sensitive_values").(bool) - http, err := api.NewClient(apiKey, returnSensitiveValue) - if err != nil { - return nil, diag.FromErr(err) - } - grpc := apiv2.NewClient(apiKey, returnSensitiveValue) + grpc := api.NewClient(apiKey, returnSensitiveValue) - return &clients.Clients{Http: http, Grpc: grpc}, nil + return &clients.Clients{Grpc: grpc}, nil } } diff --git a/formal/resources/resource_sidecar.go b/formal/resources/resource_sidecar.go index 7057f779..450d50fb 100644 --- a/formal/resources/resource_sidecar.go +++ b/formal/resources/resource_sidecar.go @@ -338,7 +338,7 @@ func resourceSidecarDelete(ctx context.Context, d *schema.ResourceData, meta int } if time.Since(deleteTimeStart) > time.Minute*15 { - newErr := errors.New("deletion of this sidecar has taken more than 10m; the sidecar may be unhealthy") + newErr := errors.New("deletion of this sidecar has taken more than 15m; the sidecar may be unhealthy") return diag.FromErr(newErr) } diff --git a/formal/resources/resource_user.go b/formal/resources/resource_user.go index 754881ac..0988924b 100644 --- a/formal/resources/resource_user.go +++ b/formal/resources/resource_user.go @@ -3,12 +3,14 @@ package resource import ( adminv1 "buf.build/gen/go/formal/admin/protocolbuffers/go/admin/v1" "context" + "errors" "github.com/bufbuild/connect-go" "github.com/formalco/terraform-provider-formal/formal/clients" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "google.golang.org/protobuf/types/known/timestamppb" + "strconv" "time" ) @@ -104,7 +106,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf // Warning or errors can be collected in a slice type var diags diag.Diagnostics - res, err := c.Grpc.Sdk.UserServiceClient.CreateUser(ctx, connect.NewRequest(&adminv1.CreateUserRequest{ + res, err := c.Grpc.Sdk.UserServiceClient.CreateUserV2(ctx, connect.NewRequest(&adminv1.CreateUserV2Request{ FirstName: d.Get("first_name").(string), LastName: d.Get("last_name").(string), Type: d.Get("type").(string), @@ -119,7 +121,36 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf return diag.FromErr(err) } - d.SetId(res.Msg.User.Id) + const ErrorTolerance = 5 + currentErrors := 0 + for { + // Retrieve status + createdUser, err := c.Grpc.Sdk.UserServiceClient.GetUserById(ctx, connect.NewRequest(&adminv1.GetUserByIdRequest{Id: res.Msg.Id})) + if err != nil { + if currentErrors >= ErrorTolerance { + return diag.FromErr(err) + } else { + tflog.Warn(ctx, "Experienced an error #"+strconv.Itoa(currentErrors+1)+" retrieving User: ", map[string]interface{}{"err": err}) + currentErrors += 1 + time.Sleep(15 * time.Second) + continue + } + } + + if createdUser == nil { + err = errors.New("user with the given ID not found. It may have been deleted") + return diag.FromErr(err) + } + + // Check status + if createdUser.Msg.User != nil { + break + } else { + time.Sleep(15 * time.Second) + } + } + + d.SetId(res.Msg.Id) resourceRoleRead(ctx, d, meta) @@ -200,6 +231,36 @@ func resourceUserDelete(ctx context.Context, d *schema.ResourceData, meta interf return diag.FromErr(err) } + const ErrorTolerance = 5 + currentErrors := 0 + deleteTimeStart := time.Now() + for { + // Retrieve status + _, err = c.Grpc.Sdk.UserServiceClient.GetUserById(ctx, connect.NewRequest(&adminv1.GetUserByIdRequest{Id: userId})) + if err != nil { + if connect.CodeOf(err) == connect.CodeNotFound { + tflog.Info(ctx, "User deleted", map[string]interface{}{"user_id": userId}) + // User was deleted + break + } + + // Handle other errors + if currentErrors >= ErrorTolerance { + return diag.FromErr(err) + } else { + tflog.Warn(ctx, "Experienced an error #"+strconv.Itoa(currentErrors)+" checking on User Status: ", map[string]interface{}{"err": err}) + currentErrors += 1 + } + } + + if time.Since(deleteTimeStart) > time.Minute*15 { + newErr := errors.New("deletion of this user has taken more than 15m") + return diag.FromErr(newErr) + } + + time.Sleep(15 * time.Second) + } + d.SetId("") return diags diff --git a/formal/utils/utils.go b/formal/utils/utils.go deleted file mode 100644 index 54905ac3..00000000 --- a/formal/utils/utils.go +++ /dev/null @@ -1,8 +0,0 @@ -package utils - -import "encoding/json" - -func PrettyLog(res interface{}) string { - s, _ := json.MarshalIndent(res, "", "\t") - return string(s) -} diff --git a/go.mod b/go.mod index 312629eb..7e49c549 100644 --- a/go.mod +++ b/go.mod @@ -3,24 +3,26 @@ module github.com/formalco/terraform-provider-formal go 1.20 require ( - buf.build/gen/go/formal/admin/protocolbuffers/go v1.31.0-20230826071847-93f511cce84e.1 + buf.build/gen/go/formal/admin/protocolbuffers/go v1.31.0-20230906231527-3330f2679f51.1 github.com/bufbuild/connect-go v1.10.0 github.com/formalco/go-sdk/sdk v1.2.1 github.com/hashicorp/terraform-plugin-docs v0.13.0 github.com/hashicorp/terraform-plugin-log v0.9.0 - github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1 + github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 google.golang.org/protobuf v1.31.0 ) require ( - buf.build/gen/go/formal/admin/bufbuild/connect-go v1.10.0-20230826071847-93f511cce84e.1 // indirect + buf.build/gen/go/formal/admin/bufbuild/connect-go v1.10.0-20230906231527-3330f2679f51.1 // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.1.1 // indirect github.com/Masterminds/sprig/v3 v3.2.2 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect github.com/agext/levenshtein v1.2.3 // indirect - github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/armon/go-radix v1.0.0 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/cloudflare/circl v1.3.3 // indirect github.com/fatih/color v1.15.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.5.9 // indirect @@ -31,20 +33,20 @@ require ( github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.4.10 // indirect + github.com/hashicorp/go-plugin v1.5.1 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/hc-install v0.5.0 // indirect - github.com/hashicorp/hcl/v2 v2.17.0 // indirect + github.com/hashicorp/hc-install v0.6.0 // indirect + github.com/hashicorp/hcl/v2 v2.18.0 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/hashicorp/terraform-exec v0.18.1 // indirect - github.com/hashicorp/terraform-json v0.16.0 // indirect - github.com/hashicorp/terraform-plugin-go v0.16.0 // indirect - github.com/hashicorp/terraform-registry-address v0.2.1 // indirect + github.com/hashicorp/terraform-exec v0.19.0 // indirect + github.com/hashicorp/terraform-json v0.17.1 // indirect + github.com/hashicorp/terraform-plugin-go v0.19.0 // indirect + github.com/hashicorp/terraform-registry-address v0.2.2 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/huandu/xstrings v1.3.2 // indirect - github.com/imdario/mergo v0.3.13 // indirect + github.com/imdario/mergo v0.3.15 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect github.com/mitchellh/cli v1.1.5 // indirect @@ -61,13 +63,13 @@ require ( github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - github.com/zclconf/go-cty v1.13.2 // indirect - golang.org/x/crypto v0.10.0 // indirect - golang.org/x/mod v0.8.0 // indirect - golang.org/x/net v0.11.0 // indirect - golang.org/x/sys v0.9.0 // indirect - golang.org/x/text v0.10.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.56.1 // indirect + github.com/zclconf/go-cty v1.14.0 // indirect + golang.org/x/crypto v0.13.0 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/net v0.15.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/grpc v1.58.0 // indirect ) diff --git a/go.sum b/go.sum index fc2bd15d..5f94cc8a 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,8 @@ -buf.build/gen/go/formal/admin/bufbuild/connect-go v1.10.0-20230826071847-93f511cce84e.1 h1:Ppr3r6BaCKjphUvkxOgfvwg0fgkS72AC9ENnVHI1x90= -buf.build/gen/go/formal/admin/bufbuild/connect-go v1.10.0-20230826071847-93f511cce84e.1/go.mod h1:aTeE0Sjv8H/uyqlUl1hVrN0cqtrzhp4pNwZ316HXbNc= -buf.build/gen/go/formal/admin/protocolbuffers/go v1.31.0-20230826071847-93f511cce84e.1 h1:m/OcmSH1M/QvQXtpoEwxMzyImpV8LS1PABlRl6nty4M= -buf.build/gen/go/formal/admin/protocolbuffers/go v1.31.0-20230826071847-93f511cce84e.1/go.mod h1:tT2ehgfLh5ummBwlcRRUHwLr5Xh7Sy1lYZTjZwCDoWo= +buf.build/gen/go/formal/admin/bufbuild/connect-go v1.10.0-20230906231527-3330f2679f51.1 h1:WpwvR3gI8DAsfxacfs4hPPzZWehnWYehurb25EwBSgY= +buf.build/gen/go/formal/admin/bufbuild/connect-go v1.10.0-20230906231527-3330f2679f51.1/go.mod h1:14BcAWffQ2l7GB5PFq+KycQlXNNPFREgmTAlC02V6NA= +buf.build/gen/go/formal/admin/protocolbuffers/go v1.31.0-20230906231527-3330f2679f51.1 h1:Eu+zTzvCXknSatTmFSH35FMeX8TAy2kKjzYq5ORCmMk= +buf.build/gen/go/formal/admin/protocolbuffers/go v1.31.0-20230906231527-3330f2679f51.1/go.mod h1:tT2ehgfLh5ummBwlcRRUHwLr5Xh7Sy1lYZTjZwCDoWo= +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= @@ -9,57 +10,47 @@ github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0 github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8= github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= -github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= -github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= -github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= -github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ= -github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= -github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= -github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 h1:KLq8BE0KwCL+mmXnjLWEAOYO+2l2AE4YMmqG1ZpZHBs= +github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= +github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= -github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= -github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bufbuild/connect-go v1.10.0 h1:QAJ3G9A1OYQW2Jbk3DeoJbkCxuKArrvZgDt47mjdTbg= github.com/bufbuild/connect-go v1.10.0/go.mod h1:CAIePUgkDR5pAFaylSMtNK45ANQjp9JvpluG20rhpV8= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= -github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= +github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/formalco/go-sdk/sdk v1.2.1 h1:x9dvmm5cTojzI29quu+6Tnv5qterdWIWDo43ieocTGQ= github.com/formalco/go-sdk/sdk v1.2.1/go.mod h1:NwJmPU0KjC4MGWgV7D4SacD/4+3Bj8EYNOTyQPl+/YM= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= -github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= -github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= -github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34= -github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= -github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4= -github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= +github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= +github.com/go-git/go-git/v5 v5.8.1 h1:Zo79E4p7TRk0xoRgMq0RShiTHGKcKI4+DI6BfJc/Q+A= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -83,33 +74,33 @@ github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVH github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.4.10 h1:xUbmA4jC6Dq163/fWcp8P3JuHilrHHMLNRxzGQJ9hNk= -github.com/hashicorp/go-plugin v1.4.10/go.mod h1:6/1TEzT0eQznvI/gV2CM29DLSkAK/e58mUWKVsPaph0= +github.com/hashicorp/go-plugin v1.5.1 h1:oGm7cWBaYIp3lJpx1RUEfLWophprE2EV/KUeqBYo+6k= +github.com/hashicorp/go-plugin v1.5.1/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/hc-install v0.5.0 h1:D9bl4KayIYKEeJ4vUDe9L5huqxZXczKaykSRcmQ0xY0= -github.com/hashicorp/hc-install v0.5.0/go.mod h1:JyzMfbzfSBSjoDCRPna1vi/24BEDxFaCPfdHtM5SCdo= -github.com/hashicorp/hcl/v2 v2.17.0 h1:z1XvSUyXd1HP10U4lrLg5e0JMVz6CPaJvAgxM0KNZVY= -github.com/hashicorp/hcl/v2 v2.17.0/go.mod h1:gJyW2PTShkJqQBKpAmPO3yxMxIuoXkOF2TpqXzrQyx4= +github.com/hashicorp/hc-install v0.6.0 h1:fDHnU7JNFNSQebVKYhHZ0va1bC6SrPQ8fpebsvNr2w4= +github.com/hashicorp/hc-install v0.6.0/go.mod h1:10I912u3nntx9Umo1VAeYPUUuehk0aRQJYpMwbX5wQA= +github.com/hashicorp/hcl/v2 v2.18.0 h1:wYnG7Lt31t2zYkcquwgKo6MWXzRUDIeIVU5naZwHLl8= +github.com/hashicorp/hcl/v2 v2.18.0/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/terraform-exec v0.18.1 h1:LAbfDvNQU1l0NOQlTuudjczVhHj061fNX5H8XZxHlH4= -github.com/hashicorp/terraform-exec v0.18.1/go.mod h1:58wg4IeuAJ6LVsLUeD2DWZZoc/bYi6dzhLHzxM41980= -github.com/hashicorp/terraform-json v0.16.0 h1:UKkeWRWb23do5LNAFlh/K3N0ymn1qTOO8c+85Albo3s= -github.com/hashicorp/terraform-json v0.16.0/go.mod h1:v0Ufk9jJnk6tcIZvScHvetlKfiNTC+WS21mnXIlc0B0= +github.com/hashicorp/terraform-exec v0.19.0 h1:FpqZ6n50Tk95mItTSS9BjeOVUb4eg81SpgVtZNNtFSM= +github.com/hashicorp/terraform-exec v0.19.0/go.mod h1:tbxUpe3JKruE9Cuf65mycSIT8KiNPZ0FkuTE3H4urQg= +github.com/hashicorp/terraform-json v0.17.1 h1:eMfvh/uWggKmY7Pmb3T85u86E2EQg6EQHgyRwf3RkyA= +github.com/hashicorp/terraform-json v0.17.1/go.mod h1:Huy6zt6euxaY9knPAFKjUITn8QxUFIe9VuSzb4zn/0o= github.com/hashicorp/terraform-plugin-docs v0.13.0 h1:6e+VIWsVGb6jYJewfzq2ok2smPzZrt1Wlm9koLeKazY= github.com/hashicorp/terraform-plugin-docs v0.13.0/go.mod h1:W0oCmHAjIlTHBbvtppWHe8fLfZ2BznQbuv8+UD8OucQ= -github.com/hashicorp/terraform-plugin-go v0.16.0 h1:DSOQ0rz5FUiVO4NUzMs8ln9gsPgHMTsfns7Nk+6gPuE= -github.com/hashicorp/terraform-plugin-go v0.16.0/go.mod h1:4sn8bFuDbt+2+Yztt35IbOrvZc0zyEi87gJzsTgCES8= +github.com/hashicorp/terraform-plugin-go v0.19.0 h1:BuZx/6Cp+lkmiG0cOBk6Zps0Cb2tmqQpDM3iAtnhDQU= +github.com/hashicorp/terraform-plugin-go v0.19.0/go.mod h1:EhRSkEPNoylLQntYsk5KrDHTZJh9HQoumZXbOGOXmec= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1 h1:G9WAfb8LHeCxu7Ae8nc1agZlQOSCUWsb610iAogBhCs= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1/go.mod h1:xcOSYlRVdPLmDUoqPhO9fiO/YCN/l6MGYeTzGt5jgkQ= -github.com/hashicorp/terraform-registry-address v0.2.1 h1:QuTf6oJ1+WSflJw6WYOHhLgwUiQ0FrROpHPYFtwTYWM= -github.com/hashicorp/terraform-registry-address v0.2.1/go.mod h1:BSE9fIFzp0qWsJUUyGquo4ldV9k2n+psif6NYkBRS3Y= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 h1:wcOKYwPI9IorAJEBLzgclh3xVolO7ZorYd6U1vnok14= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0/go.mod h1:qH/34G25Ugdj5FcM95cSoXzUgIbgfhVLXCcEcYaMwq8= +github.com/hashicorp/terraform-registry-address v0.2.2 h1:lPQBg403El8PPicg/qONZJDC6YlgCVbWDtNmmZKtBno= +github.com/hashicorp/terraform-registry-address v0.2.2/go.mod h1:LtwNbCihUoUZ3RYriyS2wF/lGPB6gF9ICLRtuDk7hSo= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= @@ -118,25 +109,17 @@ github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= -github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= +github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= -github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= -github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= -github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= +github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= 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/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= @@ -153,8 +136,6 @@ github.com/mitchellh/cli v1.1.5/go.mod h1:v8+iFts2sPIKUV1ltktPXMCC8fumSKFItNcD2c github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= -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/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= @@ -164,11 +145,9 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -177,22 +156,19 @@ github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSg github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 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.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -202,49 +178,40 @@ github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9 github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= -github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= +github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zclconf/go-cty v1.13.2 h1:4GvrUxe/QUDYuJKAav4EYqdM47/kZa672LwmXFmEKT0= -github.com/zclconf/go-cty v1.13.2/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0= -golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +github.com/zclconf/go-cty v1.14.0 h1:/Xrd39K7DXbHzlisFP9c4pHao4yyf+/Ug9LEz+Y/yhc= +github.com/zclconf/go-cty v1.14.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= -golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= -golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= -golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/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-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -252,49 +219,51 @@ golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.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.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= +google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= 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= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=