File: doc.go

package info (click to toggle)
golang-github-gophercloud-utils 0.0~git20231010.80377ec-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 816 kB
  • sloc: sh: 20; makefile: 7
file content (81 lines) | stat: -rw-r--r-- 1,855 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
Package archivepolicies provides the ability to retrieve archive policies
through the Gnocchi API.

Example of Listing archive policies

	allPages, err := archivepolicies.List(gnocchiClient).AllPages()
	if err != nil {
		panic(err)
	}

	allArchivePolicies, err := archivepolicies.ExtractArchivePolicies(allPages)
	if err != nil {
		panic(err)
	}

	for _, archivePolicy := range allArchivePolicies {
		fmt.Printf("%+v\n", archivePolicy)
	}

Example of Getting an archive policy

	archivePolicyName = "my_policy"
	archivePolicy, err := archivepolicies.Get(gnocchiClient, archivePolicyName).Extract()
	if err != nil {
	  panic(err)
	}

Example of Creating an archive policy

	createOpts := archivepolicies.CreateOpts{
	  BackWindow: 31,
	  AggregationMethods: []string{
	    "sum",
	    "mean",
	    "count",
	  },
	  Definition: []archivepolicies.ArchivePolicyDefinitionOpts{
	    {
	      Granularity: "1:00:00",
	      TimeSpan:    "90 days, 0:00:00",
	    },
	    {
	      Granularity: "1 day, 0:00:00",
	      TimeSpan:    "100 days, 0:00:00",
	    },
	  },
	  Name: "test_policy",
	}
	archivePolicy, err := archivepolicies.Create(gnocchiClient, createOpts).Extract()
	if err != nil {
	  panic(err)
	}

Example of Updating an archive policy

	updateOpts := archivepolicies.UpdateOpts{
	  Definition: []archivepolicies.ArchivePolicyDefinitionOpts{
	    {
	      Granularity: "12:00:00",
	      TimeSpan:    "30 days, 0:00:00",
	    },
	    {
	      Granularity: "1 day, 0:00:00",
	      TimeSpan:    "90 days, 0:00:00",
	    },
	  },
	}
	archivePolicy, err := archivepolicies.Update(gnocchiClient, "test_policy", updateOpts).Extract()
	if err != nil {
	  panic(err)
	}

Example of Deleting a Gnocchi archive policy

	err := archivepolicies.Delete(gnocchiClient, "test_policy").ExtractErr()
	if err != nil {
	  panic(err)
	}
*/
package archivepolicies