helpers

package
Version: v0.0.0-...-d708520 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package helpers collects generic functionality over the Gophercloud OpenStack Go SDK.

OpenStack Project Purge

Set of method to purge resources associated to an OpenStack project. This is partially inspired on the following projects:

- https://docs.openstack.org/python-openstackclient/latest/cli/command-objects/project-purge.html

- https://docs.openstack.org/neutron/latest/admin/ops-resource-purge.html

- https://opendev.org/x/ospurge

Example to Purge all the resources and Delete a Project

purgeOpts := ProjectPurgeOpts {
	StoragePurgeOpts: &StoragePurgeOpts{storageClient},
	ComputePurgeOpts: &ComputePurgeOpts{computeClient},
	NetworkPurgeOpts: &NetworkPurgeOpts{networkClient},
}
projectID := "966b3c7d36a24facaf20b7e458bf2192"

err := helpers.ProjectPurgeAll(projectID, opts)
if err != nil {
	panic(err)
} else {
	err = projects.Delete(identityClient, projectID).ExtractErr()
	if err != nil {
		panic(err)
	}
}

Example to Purge storage and networking resources on a Project but keep the Project itself

purgeOpts := ProjectPurgeOpts {
	StoragePurgeOpts: &StoragePurgeOpts{storageClient},
	NetworkPurgeOpts: &NetworkPurgeOpts{networkClient},
}
projectID := "966b3c7d36a24facaf20b7e458bf2192"

err := helpers.ProjectPurgeAll(projectID, opts)
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProjectPurgeAll

func ProjectPurgeAll(projectID string, purgeOpts ProjectPurgeOpts) (err error)

ProjectPurgeAll purges all the resources associated with a project. This includes: servers, snapshosts, volumes, floating IPs, routers, networks, sub-networks and security groups

func ProjectPurgeCompute

func ProjectPurgeCompute(projectID string, purgeOpts ComputePurgeOpts) (err error)

ProjectPurgeCompute purges the Compute v2 resources associated with a project. This includes: servers

func ProjectPurgeNetwork

func ProjectPurgeNetwork(projectID string, purgeOpts NetworkPurgeOpts) (err error)

ProjectPurgeNetwork purges the Networking v2 resources associated with a project. This includes: floating IPs, routers, networks, sub-networks and security groups

func ProjectPurgeStorage

func ProjectPurgeStorage(projectID string, purgeOpts StoragePurgeOpts) (err error)

ProjectPurgeStorage purges the Blockstorage v3 resources associated with a project. This includes: snapshosts and volumes

Types

type ComputePurgeOpts

type ComputePurgeOpts struct {
	// Client is a reference to a specific compute service client.
	Client *gophercloud.ServiceClient
}

type NetworkPurgeOpts

type NetworkPurgeOpts struct {
	// Client is a reference to a specific networking service client.
	Client *gophercloud.ServiceClient
}

type ProjectPurgeOpts

type ProjectPurgeOpts struct {
	ComputePurgeOpts *ComputePurgeOpts
	StoragePurgeOpts *StoragePurgeOpts
	NetworkPurgeOpts *NetworkPurgeOpts
}

type StoragePurgeOpts

type StoragePurgeOpts struct {
	// Client is a reference to a specific storage service client.
	Client *gophercloud.ServiceClient
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL