Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add gcp_redis_cluster table and improve gcp_redis_instance #679

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 187 additions & 0 deletions docs/tables/gcp_redis_cluster.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
---
title: "Steampipe Table: gcp_redis_cluster - Query Google Cloud Platform Memorystore Redis Clusters using SQL"
description: "Allows users to query Memorystore Redis Clusters on Google Cloud Platform, providing detailed information about each cluster."
---

# Table: gcp_redis_cluster - Query Google Cloud Platform Memorystore Redis Clusters using SQL

Google Cloud Platform's Memorystore Redis Cluster service is a fully managed service that powers applications with low-latency data access. It provides secure and highly available Redis clusters while Google handles all the underlying infrastructure for you. Redis clusters are ideal for use cases such as caching, session storage, gaming leaderboards, real-time analytics, and queueing.

## Table Usage Guide

The `gcp_redis_cluster` table provides insights into Memorystore Redis Clusters within Google Cloud Platform. As a DevOps engineer, you can explore cluster-specific details through this table, including the cluster's ID, name, region, and current status. Utilize it to monitor and manage your Redis clusters, ensuring they are configured correctly and running efficiently.

## Examples

### Basic info
Explore which Google Cloud Platform (GCP) Memorystore Redis clusters have been created, along with their creation times, locations, memory sizes, and IP addresses. This is useful for gaining insights into your GCP Memorystore Redis clusters' configurations and understanding how your resources are being utilized.

```sql+postgres
select
name,
create_time,
location,
size_gb,
precise_size_gb,
psc_connections[0] ->> 'address' as address
from
gcp_redis_cluster;
```

```sql+sqlite
select
name,
create_time,
location,
size_gb,
precise_size_gb,
psc_connections[0] -> 'address' as address
from
gcp_redis_cluster;
```

### List clusters that have IAM authorization enabled
Discover the segments that have enabled IAM authorization to enhance security measures and maintain data privacy within your GCP Memorystore Redis clusters. This can be particularly useful in identifying potential vulnerabilities and ensuring compliance with best practices.

```sql+postgres
select
name,
create_time,
location,
psc_connections[0] ->> 'address' as address
from
gcp_redis_cluster
where
authorization_mode = 1;
```

```sql+sqlite
select
name,
create_time,
location,
psc_connections[0] -> 'address' as address
from
gcp_redis_cluster
where
authorization_mode = 1;
```

### List clusters created in the last 7 days
Discover the segments that have been newly added within the past week. This is beneficial in monitoring the growth and changes in your database over a short period.

```sql+postgres
select
name,
create_time,
location,
psc_connections[0] ->> 'address' as address
from
gcp_redis_cluster
where
create_time >= current_timestamp - interval '7 days';
```

```sql+sqlite
select
name,
create_time,
location,
psc_connections[0] -> 'address' as address
from
gcp_redis_cluster
where
create_time >= datetime('now', '-7 days');
```

### Get node details of each cluster
Gain insights into the specific details of each cluster node in your GCP Memorystore Redis database, such as the creation time and location. This can be particularly useful for troubleshooting or for optimizing your database's performance and security.

```sql+postgres
select
name,
create_time,
location,
node_type,
size_gb,
replica_count,
shard_count
from
gcp_redis_cluster
where
name = 'cluster-test'
and location = 'europe-west9';
```

```sql+sqlite
select
name,
create_time,
location,
node_type,
size_gb,
replica_count,
shard_count
from
gcp_redis_cluster
where
name = 'cluster-test'
and location = 'europe-west9';
```

### List clusters that have in-transit encryption disabled
Discover the segments where in-transit encryption is disabled in clusters. This is particularly useful in identifying potential security risks and ensuring data protection standards are maintained.

```sql+postgres
select
name,
create_time,
location,
psc_connections[0] ->> 'address' as address
from
gcp_redis_cluster
where
transit_encryption_mode != 2;
```

```sql+sqlite
select
name,
create_time,
location,
psc_connections[0] -> 'address' as address
from
gcp_redis_cluster
where
transit_encryption_mode != 2;
```

<!--
FIXME: this is missing from the Go SDK
https://github.com/googleapis/google-cloud-go/issues/11061

### List the maintenance details of clusters
Explore the maintenance characteristics of your clusters to identify when and how often maintenance is performed, as well as the versions available for maintenance. This can help you manage and plan your maintenance activities more effectively.

```sql+postgres
select
name,
create_time,
location,
maintenance_policy,
maintenance_schedule
from
gcp_redis_cluster;
```

```sql+sqlite
select
name,
create_time,
location,
maintenance_policy,
maintenance_schedule
from
gcp_redis_cluster;
```
-->
28 changes: 14 additions & 14 deletions docs/tables/gcp_redis_instance.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
title: "Steampipe Table: gcp_redis_instance - Query Google Cloud Platform Redis Instances using SQL"
description: "Allows users to query Redis Instances on Google Cloud Platform, providing detailed information about each instance."
title: "Steampipe Table: gcp_redis_instance - Query Google Cloud Platform Memorystore Redis Instances using SQL"
description: "Allows users to query Memorystore Redis Instances on Google Cloud Platform, providing detailed information about each instance."
---

# Table: gcp_redis_instance - Query Google Cloud Platform Redis Instances using SQL
# Table: gcp_redis_instance - Query Google Cloud Platform Memorystore Redis Instances using SQL

Google Cloud Platform's Redis service is a fully managed service that powers applications with low-latency data access. It provides secure and highly available Redis instances while Google handles all the underlying infrastructure for you. Redis instances are ideal for use cases such as caching, session storage, gaming leaderboards, real-time analytics, and queueing.
Google Cloud Platform's Memorystore Redis service is a fully managed service that powers applications with low-latency data access. It provides secure and highly available Redis instances while Google handles all the underlying infrastructure for you. Redis instances are ideal for use cases such as caching, session storage, gaming leaderboards, real-time analytics, and queueing.

## Table Usage Guide

The `gcp_redis_instance` table provides insights into Redis Instances within Google Cloud Platform. As a DevOps engineer, you can explore instance-specific details through this table, including the instance's ID, name, region, and current status. Utilize it to monitor and manage your Redis instances, ensuring they are configured correctly and running efficiently.
The `gcp_redis_instance` table provides insights into Memorystore Redis Instances within Google Cloud Platform. As a DevOps engineer, you can explore instance-specific details through this table, including the instance's ID, name, region, and current status. Utilize it to monitor and manage your Redis instances, ensuring they are configured correctly and running efficiently.

## Examples

### Basic info
Explore which Google Cloud Platform (GCP) Redis instances have been created, along with their display names, creation times, locations, memory sizes, and reserved IP ranges. This is useful for gaining insights into your GCP Redis instances' configurations and understanding how your resources are being utilized.
Explore which Google Cloud Platform (GCP) Memorystore Redis instances have been created, along with their display names, creation times, locations, memory sizes, and reserved IP ranges. This is useful for gaining insights into your GCP Memorystore Redis instances' configurations and understanding how your resources are being utilized.

```sql+postgres
select
Expand All @@ -41,7 +41,7 @@ from
```

### List instances that have authentication enabled
Discover the segments that have enabled authentication to enhance security measures and maintain data privacy within your GCP Redis instances. This can be particularly useful in identifying potential vulnerabilities and ensuring compliance with best practices.
Discover the segments that have enabled authentication to enhance security measures and maintain data privacy within your GCP Memorystore Redis instances. This can be particularly useful in identifying potential vulnerabilities and ensuring compliance with best practices.

```sql+postgres
select
Expand Down Expand Up @@ -103,7 +103,7 @@ where
```

### List the node details of each instance
Gain insights into the specific details of each instance node in your Google Cloud Redis database, such as the creation time and location. This can be particularly useful for troubleshooting or for optimizing your database's performance and security.
Gain insights into the specific details of each instance node in your GCP Memorystore Redis database, such as the creation time and location. This can be particularly useful for troubleshooting or for optimizing your database's performance and security.

```sql+postgres
select
Expand Down Expand Up @@ -164,8 +164,8 @@ where
customer_managed_key is not null;
```

### List instances that have transit mode disabled
Discover the segments where transit mode is disabled in instances. This is particularly useful in identifying potential security risks and ensuring data protection standards are maintained.
### List instances that have in-transit encryption disabled
Discover the segments where in-transit encryption is disabled in instances. This is particularly useful in identifying potential security risks and ensuring data protection standards are maintained.

```sql+postgres
select
Expand All @@ -178,7 +178,7 @@ select
from
gcp_redis_instance
where
transit_encryption_mode = 2;
transit_encryption_mode != 1;
```

```sql+sqlite
Expand All @@ -192,7 +192,7 @@ select
from
gcp_redis_instance
where
transit_encryption_mode = 2;
transit_encryption_mode != 1;
```

### List the maintenance details of instances
Expand Down Expand Up @@ -227,7 +227,7 @@ from
```

### List instances with direct peering access
Explore which instances have direct peering access in order to better manage your network and ensure secure connections. This can be especially useful for maintaining optimal performance and security in your GCP Redis instances.
Explore which instances have direct peering access in order to better manage your network and ensure secure connections. This can be especially useful for maintaining optimal performance and security in your GCP Memorystore Redis instances.

```sql+postgres
select
Expand Down Expand Up @@ -255,4 +255,4 @@ from
gcp_redis_instance
where
connect_mode = 1;
```
```
36 changes: 36 additions & 0 deletions gcp/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/turbot/steampipe-plugin-sdk/v5/plugin"
"github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform"
"github.com/turbot/steampipe-plugin-sdk/v5/rate_limiter"
)

const pluginName = "steampipe-plugin-gcp"
Expand All @@ -36,6 +37,40 @@ func Plugin(ctx context.Context) *plugin.Plugin {
ConnectionConfigSchema: &plugin.ConnectionConfigSchema{
NewInstance: ConfigInstance,
},
RateLimiters: []*rate_limiter.Definition{
// FIXME: API Requests per 100 seconds: 5,000
// https://cloud.google.com/memorystore/docs/redis/quotas#per-second_api_requests_quota
{
Name: "gcp_redis_list_instances",
FillRate: 50,
BucketSize: 5000, // FIXME: this will burst if consumed all at once
Scope: []string{"connection", "service", "action"},
Where: "service = 'redis' and action = 'ListInstances'",
},
{
Name: "gcp_redis_get_instance",
FillRate: 50,
BucketSize: 5000, // FIXME: this will burst if consumed all at once
Scope: []string{"connection", "service", "action"},
Where: "service = 'redis' and action = 'GetInstance'",
},
// FIXME: Redis Cluster requests per project per minute: 60
// https://cloud.google.com/memorystore/docs/cluster/quotas#per-minute_api_requests_quota
{
Name: "gcp_rediscluster_list_clusters",
FillRate: 1,
BucketSize: 60, // FIXME: this will burst if consumed all at once
Scope: []string{"connection", "service", "action"},
Where: "service = 'rediscluster' and action = 'ListClusters'",
},
{
Name: "gcp_rediscluster_get_cluster",
FillRate: 1,
BucketSize: 60, // FIXME: this will burst if consumed all at once
Scope: []string{"connection", "service", "action"},
Where: "service = 'rediscluster' and action = 'GetCluster'",
},
},
TableMap: map[string]*plugin.Table{
"gcp_alloydb_cluster": tableGcpAlloyDBCluster(ctx),
"gcp_alloydb_instance": tableGcpAlloyDBInstance(ctx),
Expand Down Expand Up @@ -129,6 +164,7 @@ func Plugin(ctx context.Context) *plugin.Plugin {
"gcp_pubsub_snapshot": tableGcpPubSubSnapshot(ctx),
"gcp_pubsub_subscription": tableGcpPubSubSubscription(ctx),
"gcp_pubsub_topic": tableGcpPubSubTopic(ctx),
"gcp_redis_cluster": tableGcpRedisCluster(ctx),
"gcp_redis_instance": tableGcpRedisInstance(ctx),
"gcp_secret_manager_secret": tableGcpSecretManagerSecret(ctx),
"gcp_service_account": tableGcpServiceAccount(ctx),
Expand Down
59 changes: 0 additions & 59 deletions gcp/redis_location_list.go

This file was deleted.

Loading
Loading