Skip to content

Commit

Permalink
feat: add allowCQL field to model.VPCPeering (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
charconstpointer authored Feb 14, 2024
1 parent b35ed02 commit 9d76306
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
14 changes: 7 additions & 7 deletions internal/provider/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func ResourceCluster() *schema.Resource {
// being ForceNew; Scylla Cloud API does not allow for
// updating existing clusters, thus update the implementation
// always returns a non-nil error.
//ForceNew: true,
// ForceNew: true,
Default: true,
},
"request_id": {
Expand Down Expand Up @@ -258,9 +258,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int
}

func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
var (
c = meta.(*scylla.Client)
)
c := meta.(*scylla.Client)

clusterID, err := strconv.ParseInt(d.Id(), 10, 64)
if err != nil {
Expand Down Expand Up @@ -325,6 +323,10 @@ func setClusterKVs(d *schema.ResourceData, cluster *model.Cluster, p *scylla.Clo
_ = d.Set("datacenter", cluster.Datacenter.Name)
_ = d.Set("status", cluster.Status)

if cluster.UserAPIInterface == "ALTERNATOR" {
_ = d.Set("alternator_write_isolation", cluster.AlternatorWriteIsolation)
}

if id := cluster.Datacenter.AccountCloudProviderCredentialID; id >= 1000 {
_ = d.Set("byoa_id", id)
}
Expand All @@ -339,9 +341,7 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int
}

func resourceClusterDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
var (
c = meta.(*scylla.Client)
)
c := meta.(*scylla.Client)

clusterID, err := strconv.ParseInt(d.Id(), 10, 64)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions internal/provider/vpc_peering.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ lookup:
_ = d.Set("connection_id", vpcPeering.ExternalID)
_ = d.Set("cluster_id", cluster.ID)
_ = d.Set("network_link", vpcPeering.NetworkLink())
_ = d.Set("allow_cql", vpcPeering.AllowCQL)

if c.Meta.GCPBlocks[r.ExternalID] != vpcPeering.CIDRList[0] {
_ = d.Set("peer_cidr_blocks", vpcPeering.CIDRList)
Expand Down
24 changes: 13 additions & 11 deletions internal/scylla/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,18 @@ type Cluster struct {
JumpStart *ExpirationTime `json:"jumpStart"`
Progress *Progress `json:"progress"`

ReplicationFactor int64 `json:"replicationFactor,omitempty"`
BroadcastType string `json:"broadcastType,omitempty"`
GrafanaURL string `json:"grafanaUrl,omitempty"`
ClientIP string `json:"clientIp,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
PromProxyEnabled bool `json:"promProxyEnabled,omitempty"`
AllowedIPs []AllowedIP `json:"allowedIps,omitempty"`
Datacenters []Datacenter `json:"dataCenters,omitempty"`
Nodes []Node `json:"nodes,omitempty"`
VPCList []VPC `json:"vpcList,omitempty"`
VPCPeeringList []VPCPeering `json:"vpcPeeringList,omitempty"`
ReplicationFactor int64 `json:"replicationFactor,omitempty"`
BroadcastType string `json:"broadcastType,omitempty"`
GrafanaURL string `json:"grafanaUrl,omitempty"`
ClientIP string `json:"clientIp,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
PromProxyEnabled bool `json:"promProxyEnabled,omitempty"`
AllowedIPs []AllowedIP `json:"allowedIps,omitempty"`
Datacenters []Datacenter `json:"dataCenters,omitempty"`
Nodes []Node `json:"nodes,omitempty"`
VPCList []VPC `json:"vpcList,omitempty"`
VPCPeeringList []VPCPeering `json:"vpcPeeringList,omitempty"`
AlternatorWriteIsolation string `json:"alternatorWriteIsolation,omitempty"`
}

type Progress struct {
Expand Down Expand Up @@ -240,6 +241,7 @@ type VPCPeering struct {
ProjectID string `json:"projectID"`
Status string `json:"status"`
ExpiresAt string `json:"expiresAt"`
AllowCQL bool `json:"allowCql"`
}

func (vp *VPCPeering) NetworkLink() string {
Expand Down

0 comments on commit 9d76306

Please sign in to comment.