-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdatabase_snapshots_default.go
More file actions
50 lines (40 loc) · 2.2 KB
/
database_snapshots_default.go
File metadata and controls
50 lines (40 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Code generated by go generate; DO NOT EDIT.
package brightbox
import "context"
import "path"
const (
// databasesnapshotAPIPath returns the relative URL path to the DatabaseSnapshot endpoint
databasesnapshotAPIPath = "database_snapshots"
)
// DatabaseSnapshots returns the collection view for DatabaseSnapshot
func (c *Client) DatabaseSnapshots(ctx context.Context) ([]DatabaseSnapshot, error) {
return apiGetCollection[[]DatabaseSnapshot](ctx, c, databasesnapshotAPIPath)
}
// DatabaseSnapshot retrieves a detailed view of one resource
func (c *Client) DatabaseSnapshot(ctx context.Context, identifier string) (*DatabaseSnapshot, error) {
return apiGet[DatabaseSnapshot](ctx, c, path.Join(databasesnapshotAPIPath, identifier))
}
// UpdateDatabaseSnapshot updates an existing resources's attributes. Not all
// attributes can be changed (such as ID).
//
// It takes an instance of DatabaseSnapshotOptions. Specify the resource you
// want to update using the ID field.
func (c *Client) UpdateDatabaseSnapshot(ctx context.Context, updateDatabaseSnapshot DatabaseSnapshotOptions) (*DatabaseSnapshot, error) {
return apiPut[DatabaseSnapshot](ctx, c, path.Join(databasesnapshotAPIPath, updateDatabaseSnapshot.ID), updateDatabaseSnapshot)
}
// DestroyDatabaseSnapshot destroys an existing resource.
func (c *Client) DestroyDatabaseSnapshot(ctx context.Context, identifier string) (*DatabaseSnapshot, error) {
return apiDelete[DatabaseSnapshot](ctx, c, path.Join(databasesnapshotAPIPath, identifier))
}
// LockDatabaseSnapshot locks a resource against destroy requests
func (c *Client) LockDatabaseSnapshot(ctx context.Context, identifier string) (*DatabaseSnapshot, error) {
return apiPut[DatabaseSnapshot](ctx, c, path.Join(databasesnapshotAPIPath, identifier, "lock_resource"), nil)
}
// UnlockDatabaseSnapshot unlocks a resource, re-enabling destroy requests
func (c *Client) UnlockDatabaseSnapshot(ctx context.Context, identifier string) (*DatabaseSnapshot, error) {
return apiPut[DatabaseSnapshot](ctx, c, path.Join(databasesnapshotAPIPath, identifier, "unlock_resource"), nil)
}
// CreatedAt implements the CreateDated interface for DatabaseSnapshot
func (s DatabaseSnapshot) CreatedAtUnix() int64 {
return s.CreatedAt.Unix()
}