Skip to content

Commit

Permalink
🐛 Close GCP container service when done (#693)
Browse files Browse the repository at this point in the history
I noticed this step was missing, so I added it now

Signed-off-by: Ivan Milchev <[email protected]>
  • Loading branch information
imilchev authored Jan 3, 2023
1 parent 0a1e036 commit db52aef
Showing 1 changed file with 16 additions and 75 deletions.
91 changes: 16 additions & 75 deletions resources/packs/gcp/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,123 +37,63 @@ func (g *mqlGcpProjectCluster) init(args *resources.Args) (*resources.Args, GcpP
}

func (g *mqlGcpProjectClusterNodepool) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProjectClusterNodepoolConfig) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProjectClusterNodepoolNetworkConfig) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProjectClusterNodepoolNetworkConfigPerformanceConfig) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProjectClusterNodepoolConfigAccelerator) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProjectClusterNodepoolConfigAcceleratorGpuSharingConfig) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProjectClusterNodepoolConfigNodeTaint) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProjectClusterNodepoolConfigSandboxConfig) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProjectClusterNodepoolConfigShieldedInstanceConfig) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProjectClusterNodepoolConfigLinuxNodeConfig) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProjectClusterNodepoolConfigKubeletConfig) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProjectClusterNodepoolConfigGcfsConfig) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProjectClusterNodepoolConfigAdvancedMachineFeatures) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProjectClusterNodepoolConfigGvnicConfig) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProjectClusterNodepoolConfigConfidentialNodes) id() (string, error) {
id, err := g.Id()
if err != nil {
return "", err
}
return id, nil
return g.Id()
}

func (g *mqlGcpProject) GetClusters() ([]interface{}, error) {
Expand All @@ -178,6 +118,7 @@ func (g *mqlGcpProject) GetClusters() ([]interface{}, error) {
if err != nil {
return nil, err
}
defer containerSvc.Close()

// List the clusters in the current projects for all locations
resp, err := containerSvc.ListClusters(ctx, &containerpb.ListClustersRequest{Parent: fmt.Sprintf("projects/%s/locations/-", projectId)})
Expand Down

0 comments on commit db52aef

Please sign in to comment.