File: object_storage_bucket_certs.go

package info (click to toggle)
golang-github-linode-linodego 1.55.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,112 kB
  • sloc: makefile: 96; sh: 52; python: 24
file content (59 lines) | stat: -rw-r--r-- 2,422 bytes parent folder | download
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
51
52
53
54
55
56
57
58
59
package linodego

import (
	"context"
)

// Deprecated: Please use ObjectStorageBucketCertV2 for all new implementations.
type ObjectStorageBucketCert struct {
	SSL bool `json:"ssl"`
}

type ObjectStorageBucketCertV2 struct {
	SSL *bool `json:"ssl"`
}

type ObjectStorageBucketCertUploadOptions struct {
	Certificate string `json:"certificate"`
	PrivateKey  string `json:"private_key"`
}

// UploadObjectStorageBucketCert uploads a TLS/SSL Cert to be used with an Object Storage Bucket.
// Deprecated: Please use UploadObjectStorageBucketCertV2 for all new implementations.
func (c *Client) UploadObjectStorageBucketCert(
	ctx context.Context,
	clusterOrRegionID, bucket string,
	opts ObjectStorageBucketCertUploadOptions,
) (*ObjectStorageBucketCert, error) {
	e := formatAPIPath("object-storage/buckets/%s/%s/ssl", clusterOrRegionID, bucket)
	return doPOSTRequest[ObjectStorageBucketCert](ctx, c, e, opts)
}

// GetObjectStorageBucketCert gets an ObjectStorageBucketCert
// Deprecated: Please use GetObjectStorageBucketCertV2 for all new implementations.
func (c *Client) GetObjectStorageBucketCert(ctx context.Context, clusterOrRegionID, bucket string) (*ObjectStorageBucketCert, error) {
	e := formatAPIPath("object-storage/buckets/%s/%s/ssl", clusterOrRegionID, bucket)
	return doGETRequest[ObjectStorageBucketCert](ctx, c, e)
}

// UploadObjectStorageBucketCert uploads a TLS/SSL Cert to be used with an Object Storage Bucket.
func (c *Client) UploadObjectStorageBucketCertV2(
	ctx context.Context,
	clusterOrRegionID, bucket string,
	opts ObjectStorageBucketCertUploadOptions,
) (*ObjectStorageBucketCertV2, error) {
	e := formatAPIPath("object-storage/buckets/%s/%s/ssl", clusterOrRegionID, bucket)
	return doPOSTRequest[ObjectStorageBucketCertV2](ctx, c, e, opts)
}

// GetObjectStorageBucketCertV2 gets an ObjectStorageBucketCert
func (c *Client) GetObjectStorageBucketCertV2(ctx context.Context, clusterOrRegionID, bucket string) (*ObjectStorageBucketCertV2, error) {
	e := formatAPIPath("object-storage/buckets/%s/%s/ssl", clusterOrRegionID, bucket)
	return doGETRequest[ObjectStorageBucketCertV2](ctx, c, e)
}

// DeleteObjectStorageBucketCert deletes an ObjectStorageBucketCert
func (c *Client) DeleteObjectStorageBucketCert(ctx context.Context, clusterOrRegionID, bucket string) error {
	e := formatAPIPath("object-storage/buckets/%s/%s/ssl", clusterOrRegionID, bucket)
	return doDELETERequest(ctx, c, e)
}