-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Madhushree Ray <[email protected]>
- Loading branch information
1 parent
a759191
commit 4204413
Showing
5 changed files
with
487 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# Table: gcp_artifact_registry_repository | ||
|
||
Google Cloud Artifact Registry is a managed artifact repository service provided by Google Cloud Platform (GCP). It is designed to store and manage software packages, container images, and other development artifacts. Artifact Registry helps organizations manage their dependencies, share software artifacts, and ensure the reliability and security of their software supply chain. | ||
|
||
### Basic info | ||
|
||
```sql | ||
select | ||
name, | ||
cleanup_policy_dry_run, | ||
create_time, | ||
format, | ||
kms_key_name, | ||
mode | ||
from | ||
gcp_artifact_registry_repository; | ||
``` | ||
|
||
### List unencrypted repositories | ||
|
||
```sql | ||
select | ||
name, | ||
cleanup_policy_dry_run, | ||
create_time, | ||
kms_key_name | ||
from | ||
gcp_artifact_registry_repository | ||
where | ||
kms_key_name = ''; | ||
``` | ||
|
||
### List docker format package repositories | ||
|
||
```sql | ||
select | ||
name, | ||
create_time, | ||
description, | ||
size_bytes, | ||
format | ||
from | ||
gcp_artifact_registry_repository | ||
where | ||
format = 'DOCKER'; | ||
``` | ||
|
||
### List standard repositories | ||
|
||
```sql | ||
select | ||
name, | ||
format, | ||
mode, | ||
create_time | ||
from | ||
gcp_artifact_registry_repository | ||
where | ||
mode = 'STANDARD_REPOSITORY'; | ||
``` | ||
|
||
### List repositories that satisfies physical zone separation | ||
|
||
```sql | ||
select | ||
name, | ||
mode, | ||
format, | ||
satisfies_pzs, | ||
description, | ||
create_time | ||
from | ||
gcp_artifact_registry_repository | ||
where | ||
satisfies_pzs; | ||
``` | ||
|
||
### Get docker configuration of repositories | ||
|
||
```sql | ||
select | ||
name, | ||
docker_config -> 'ImmutableTags' as immutable_tags, | ||
docker_config ->> 'ForceSendFields' as force_send_fields, | ||
docker_config ->> 'NullFields' as null_fields | ||
from | ||
gcp_artifact_registry_repository; | ||
``` | ||
|
||
### Get remote repository config details of repositories | ||
|
||
```sql | ||
select | ||
name, | ||
remote_repository_config ->> 'AptRepository' as apt_repository, | ||
remote_repository_config ->> 'DockerRepository' as docker_repository, | ||
remote_repository_config ->> 'MavenRepository' as maven_repository, | ||
remote_repository_config ->> 'NpmRepository' as npm_repository, | ||
remote_repository_config ->> 'PythonRepository' as python_repository, | ||
remote_repository_config ->> 'YumRepository' as yum_repository | ||
from | ||
gcp_artifact_registry_repository; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package gcp | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/turbot/steampipe-plugin-sdk/v5/plugin" | ||
"google.golang.org/api/artifactregistry/v1" | ||
) | ||
|
||
|
||
// BuildregionList :: return a list of matrix items, one per region specified | ||
func BuildArtifactRegistryLocationList(ctx context.Context, d *plugin.QueryData) []map[string]interface{} { | ||
|
||
// have we already created and cached the locations? | ||
locationCacheKey := "ArtifactRegistry" | ||
if cachedData, ok := d.ConnectionManager.Cache.Get(locationCacheKey); ok { | ||
plugin.Logger(ctx).Trace("listlocationDetails:", cachedData.([]map[string]interface{})) | ||
return cachedData.([]map[string]interface{}) | ||
} | ||
|
||
// Create Service Connection | ||
service, err := ArtifactRegistryService(ctx, d) | ||
if err != nil { | ||
return nil | ||
} | ||
|
||
// Get project details | ||
projectData, err := activeProject(ctx, d) | ||
if err != nil { | ||
return nil | ||
} | ||
project := projectData.Project | ||
|
||
resp := service.Projects.Locations.List("projects/" + project) | ||
if err != nil { | ||
return nil | ||
} | ||
|
||
var locations []*artifactregistry.Location | ||
|
||
if err := resp.Pages(ctx, func(page *artifactregistry.ListLocationsResponse) error { | ||
locations = append(locations, page.Locations...) | ||
return nil | ||
}); err != nil { | ||
return nil | ||
} | ||
|
||
// validate location list | ||
matrix := make([]map[string]interface{}, len(locations)) | ||
for i, location := range locations { | ||
matrix[i] = map[string]interface{}{matrixKeyLocation: location.LocationId} | ||
} | ||
d.ConnectionManager.Cache.Set(locationCacheKey, matrix) | ||
return matrix | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.