/
LimitRange.purs
258 lines (231 loc) · 19.2 KB
/
LimitRange.purs
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
module Kubernetes.Api.CoreV1.LimitRange where
import Prelude
import Control.Monad.Aff (Aff)
import Data.Either (Either(Left,Right))
import Data.Foreign.Class (class Decode, class Encode, encode, decode)
import Data.Foreign.Generic (encodeJSON, genericEncode, genericDecode)
import Data.Foreign.Index (readProp)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(Just,Nothing))
import Data.Newtype (class Newtype)
import Data.StrMap (StrMap)
import Data.StrMap as StrMap
import Data.Tuple (Tuple(Tuple))
import Node.HTTP (HTTP)
import Kubernetes.Client as Client
import Kubernetes.Config (Config)
import Kubernetes.Default (class Default)
import Kubernetes.Json (assertPropEq, decodeMaybe, encodeMaybe, jsonOptions)
import Kubernetes.Api.CoreV1 as CoreV1
import Kubernetes.Api.MetaV1 as MetaV1
-- | create a LimitRange
createNamespaced :: forall e. Config -> String -> CoreV1.LimitRange -> Aff (http :: HTTP | e) (Either MetaV1.Status CoreV1.LimitRange)
createNamespaced cfg namespace body = Client.makeRequest (Client.post cfg url (Just encodedBody))
where
url = "/api/v1/namespaces/" <> namespace <> "/limitranges"
encodedBody = encodeJSON body
-- | Fields:
-- | - `continue`: The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server the server will respond with a 410 ResourceExpired error indicating the client must restart their list without the continue field. This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
-- | - `fieldSelector`: A selector to restrict the list of returned objects by their fields. Defaults to everything.
-- | - `includeUninitialized`: If true, partially initialized resources are included in the response.
-- | - `labelSelector`: A selector to restrict the list of returned objects by their labels. Defaults to everything.
-- | - `limit`: limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.
-- |
-- | The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
-- | - `resourceVersion`: When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
-- | - `timeoutSeconds`: Timeout for the list/watch call.
-- | - `watch`: Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
newtype DeleteCollectionNamespacedOptions = DeleteCollectionNamespacedOptions
{ continue :: (Maybe String)
, fieldSelector :: (Maybe String)
, includeUninitialized :: (Maybe Boolean)
, labelSelector :: (Maybe String)
, limit :: (Maybe Int)
, resourceVersion :: (Maybe String)
, timeoutSeconds :: (Maybe Int)
, watch :: (Maybe Boolean) }
derive instance newtypeDeleteCollectionNamespacedOptions :: Newtype DeleteCollectionNamespacedOptions _
derive instance genericDeleteCollectionNamespacedOptions :: Generic DeleteCollectionNamespacedOptions _
instance showDeleteCollectionNamespacedOptions :: Show DeleteCollectionNamespacedOptions where show a = genericShow a
instance decodeDeleteCollectionNamespacedOptions :: Decode DeleteCollectionNamespacedOptions where
decode a = do
continue <- decodeMaybe "continue" a
fieldSelector <- decodeMaybe "fieldSelector" a
includeUninitialized <- decodeMaybe "includeUninitialized" a
labelSelector <- decodeMaybe "labelSelector" a
limit <- decodeMaybe "limit" a
resourceVersion <- decodeMaybe "resourceVersion" a
timeoutSeconds <- decodeMaybe "timeoutSeconds" a
watch <- decodeMaybe "watch" a
pure $ DeleteCollectionNamespacedOptions { continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch }
instance encodeDeleteCollectionNamespacedOptions :: Encode DeleteCollectionNamespacedOptions where
encode (DeleteCollectionNamespacedOptions a) = encode $ StrMap.fromFoldable $
[ Tuple "continue" (encodeMaybe a.continue)
, Tuple "fieldSelector" (encodeMaybe a.fieldSelector)
, Tuple "includeUninitialized" (encodeMaybe a.includeUninitialized)
, Tuple "labelSelector" (encodeMaybe a.labelSelector)
, Tuple "limit" (encodeMaybe a.limit)
, Tuple "resourceVersion" (encodeMaybe a.resourceVersion)
, Tuple "timeoutSeconds" (encodeMaybe a.timeoutSeconds)
, Tuple "watch" (encodeMaybe a.watch) ]
instance defaultDeleteCollectionNamespacedOptions :: Default DeleteCollectionNamespacedOptions where
default = DeleteCollectionNamespacedOptions
{ continue: Nothing
, fieldSelector: Nothing
, includeUninitialized: Nothing
, labelSelector: Nothing
, limit: Nothing
, resourceVersion: Nothing
, timeoutSeconds: Nothing
, watch: Nothing }
-- | delete collection of LimitRange
deleteCollectionNamespaced :: forall e. Config -> String -> DeleteCollectionNamespacedOptions -> Aff (http :: HTTP | e) (Either MetaV1.Status MetaV1.Status)
deleteCollectionNamespaced cfg namespace options = Client.makeRequest (Client.delete cfg url Nothing)
where
url = "/api/v1/namespaces/" <> namespace <> "/limitranges" <> Client.formatQueryString options
-- | Fields:
-- | - `gracePeriodSeconds`: The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
-- | - `orphanDependents`: Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
-- | - `propagationPolicy`: Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
newtype DeleteNamespacedOptions = DeleteNamespacedOptions
{ gracePeriodSeconds :: (Maybe Int)
, orphanDependents :: (Maybe Boolean)
, propagationPolicy :: (Maybe String) }
derive instance newtypeDeleteNamespacedOptions :: Newtype DeleteNamespacedOptions _
derive instance genericDeleteNamespacedOptions :: Generic DeleteNamespacedOptions _
instance showDeleteNamespacedOptions :: Show DeleteNamespacedOptions where show a = genericShow a
instance decodeDeleteNamespacedOptions :: Decode DeleteNamespacedOptions where
decode a = do
gracePeriodSeconds <- decodeMaybe "gracePeriodSeconds" a
orphanDependents <- decodeMaybe "orphanDependents" a
propagationPolicy <- decodeMaybe "propagationPolicy" a
pure $ DeleteNamespacedOptions { gracePeriodSeconds, orphanDependents, propagationPolicy }
instance encodeDeleteNamespacedOptions :: Encode DeleteNamespacedOptions where
encode (DeleteNamespacedOptions a) = encode $ StrMap.fromFoldable $
[ Tuple "gracePeriodSeconds" (encodeMaybe a.gracePeriodSeconds)
, Tuple "orphanDependents" (encodeMaybe a.orphanDependents)
, Tuple "propagationPolicy" (encodeMaybe a.propagationPolicy) ]
instance defaultDeleteNamespacedOptions :: Default DeleteNamespacedOptions where
default = DeleteNamespacedOptions
{ gracePeriodSeconds: Nothing
, orphanDependents: Nothing
, propagationPolicy: Nothing }
-- | delete a LimitRange
deleteNamespaced :: forall e. Config -> String -> String -> MetaV1.DeleteOptions -> DeleteNamespacedOptions -> Aff (http :: HTTP | e) (Either MetaV1.Status MetaV1.Status)
deleteNamespaced cfg namespace name body options = Client.makeRequest (Client.delete cfg url (Just encodedBody))
where
url = "/api/v1/namespaces/" <> namespace <> "/limitranges/" <> name <> "" <> Client.formatQueryString options
encodedBody = encodeJSON body
-- | list or watch objects of kind LimitRange
listForAllNamespaces :: forall e. Config -> Aff (http :: HTTP | e) (Either MetaV1.Status CoreV1.LimitRangeList)
listForAllNamespaces cfg = Client.makeRequest (Client.get cfg url Nothing)
where
url = "/api/v1/limitranges"
-- | Fields:
-- | - `continue`: The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server the server will respond with a 410 ResourceExpired error indicating the client must restart their list without the continue field. This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
-- | - `fieldSelector`: A selector to restrict the list of returned objects by their fields. Defaults to everything.
-- | - `includeUninitialized`: If true, partially initialized resources are included in the response.
-- | - `labelSelector`: A selector to restrict the list of returned objects by their labels. Defaults to everything.
-- | - `limit`: limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.
-- |
-- | The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
-- | - `resourceVersion`: When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
-- | - `timeoutSeconds`: Timeout for the list/watch call.
-- | - `watch`: Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
newtype ListNamespacedOptions = ListNamespacedOptions
{ continue :: (Maybe String)
, fieldSelector :: (Maybe String)
, includeUninitialized :: (Maybe Boolean)
, labelSelector :: (Maybe String)
, limit :: (Maybe Int)
, resourceVersion :: (Maybe String)
, timeoutSeconds :: (Maybe Int)
, watch :: (Maybe Boolean) }
derive instance newtypeListNamespacedOptions :: Newtype ListNamespacedOptions _
derive instance genericListNamespacedOptions :: Generic ListNamespacedOptions _
instance showListNamespacedOptions :: Show ListNamespacedOptions where show a = genericShow a
instance decodeListNamespacedOptions :: Decode ListNamespacedOptions where
decode a = do
continue <- decodeMaybe "continue" a
fieldSelector <- decodeMaybe "fieldSelector" a
includeUninitialized <- decodeMaybe "includeUninitialized" a
labelSelector <- decodeMaybe "labelSelector" a
limit <- decodeMaybe "limit" a
resourceVersion <- decodeMaybe "resourceVersion" a
timeoutSeconds <- decodeMaybe "timeoutSeconds" a
watch <- decodeMaybe "watch" a
pure $ ListNamespacedOptions { continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch }
instance encodeListNamespacedOptions :: Encode ListNamespacedOptions where
encode (ListNamespacedOptions a) = encode $ StrMap.fromFoldable $
[ Tuple "continue" (encodeMaybe a.continue)
, Tuple "fieldSelector" (encodeMaybe a.fieldSelector)
, Tuple "includeUninitialized" (encodeMaybe a.includeUninitialized)
, Tuple "labelSelector" (encodeMaybe a.labelSelector)
, Tuple "limit" (encodeMaybe a.limit)
, Tuple "resourceVersion" (encodeMaybe a.resourceVersion)
, Tuple "timeoutSeconds" (encodeMaybe a.timeoutSeconds)
, Tuple "watch" (encodeMaybe a.watch) ]
instance defaultListNamespacedOptions :: Default ListNamespacedOptions where
default = ListNamespacedOptions
{ continue: Nothing
, fieldSelector: Nothing
, includeUninitialized: Nothing
, labelSelector: Nothing
, limit: Nothing
, resourceVersion: Nothing
, timeoutSeconds: Nothing
, watch: Nothing }
-- | list or watch objects of kind LimitRange
listNamespaced :: forall e. Config -> String -> ListNamespacedOptions -> Aff (http :: HTTP | e) (Either MetaV1.Status CoreV1.LimitRangeList)
listNamespaced cfg namespace options = Client.makeRequest (Client.get cfg url Nothing)
where
url = "/api/v1/namespaces/" <> namespace <> "/limitranges" <> Client.formatQueryString options
-- | Fields:
-- | - `exact`: Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'.
-- | - `export`: Should this value be exported. Export strips fields that a user can not specify.
newtype ReadNamespacedOptions = ReadNamespacedOptions
{ exact :: (Maybe Boolean)
, export :: (Maybe Boolean) }
derive instance newtypeReadNamespacedOptions :: Newtype ReadNamespacedOptions _
derive instance genericReadNamespacedOptions :: Generic ReadNamespacedOptions _
instance showReadNamespacedOptions :: Show ReadNamespacedOptions where show a = genericShow a
instance decodeReadNamespacedOptions :: Decode ReadNamespacedOptions where
decode a = do
exact <- decodeMaybe "exact" a
export <- decodeMaybe "export" a
pure $ ReadNamespacedOptions { exact, export }
instance encodeReadNamespacedOptions :: Encode ReadNamespacedOptions where
encode (ReadNamespacedOptions a) = encode $ StrMap.fromFoldable $
[ Tuple "exact" (encodeMaybe a.exact)
, Tuple "export" (encodeMaybe a.export) ]
instance defaultReadNamespacedOptions :: Default ReadNamespacedOptions where
default = ReadNamespacedOptions
{ exact: Nothing
, export: Nothing }
-- | read the specified LimitRange
readNamespaced :: forall e. Config -> String -> String -> ReadNamespacedOptions -> Aff (http :: HTTP | e) (Either MetaV1.Status CoreV1.LimitRange)
readNamespaced cfg namespace name options = Client.makeRequest (Client.get cfg url Nothing)
where
url = "/api/v1/namespaces/" <> namespace <> "/limitranges/" <> name <> "" <> Client.formatQueryString options
-- | replace the specified LimitRange
replaceNamespaced :: forall e. Config -> String -> String -> CoreV1.LimitRange -> Aff (http :: HTTP | e) (Either MetaV1.Status CoreV1.LimitRange)
replaceNamespaced cfg namespace name body = Client.makeRequest (Client.put cfg url (Just encodedBody))
where
url = "/api/v1/namespaces/" <> namespace <> "/limitranges/" <> name <> ""
encodedBody = encodeJSON body
-- | watch individual changes to a list of LimitRange
watchListForAllNamespaces :: forall e. Config -> Aff (http :: HTTP | e) (Either MetaV1.Status MetaV1.WatchEvent)
watchListForAllNamespaces cfg = Client.makeRequest (Client.get cfg url Nothing)
where
url = "/api/v1/watch/limitranges"
-- | watch changes to an object of kind LimitRange
watchNamespaced :: forall e. Config -> String -> String -> Aff (http :: HTTP | e) (Either MetaV1.Status MetaV1.WatchEvent)
watchNamespaced cfg namespace name = Client.makeRequest (Client.get cfg url Nothing)
where
url = "/api/v1/watch/namespaces/" <> namespace <> "/limitranges/" <> name <> ""
-- | watch individual changes to a list of LimitRange
watchNamespacedList :: forall e. Config -> String -> Aff (http :: HTTP | e) (Either MetaV1.Status MetaV1.WatchEvent)
watchNamespacedList cfg namespace = Client.makeRequest (Client.get cfg url Nothing)
where
url = "/api/v1/watch/namespaces/" <> namespace <> "/limitranges"