Skip to content

Commit ad29b60

Browse files
committed
Generate objects for SDK 0.4.4 release
Signed-off-by: Anish Asthana <[email protected]>
1 parent e1d404b commit ad29b60

File tree

6 files changed

+367
-6
lines changed

6 files changed

+367
-6
lines changed

Diff for: docs/cluster/awload.html

+355
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,355 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
6+
<meta name="generator" content="pdoc 0.10.0" />
7+
<title>codeflare_sdk.cluster.awload API documentation</title>
8+
<meta name="description" content="The awload sub-module contains the definition of the AWManager object, which handles
9+
submission and deletion of existing AppWrappers from a user&#39;s …" />
10+
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
11+
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
12+
<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
13+
<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
14+
<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
15+
<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
16+
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
17+
<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
18+
</head>
19+
<body>
20+
<main>
21+
<article id="content">
22+
<header>
23+
<h1 class="title">Module <code>codeflare_sdk.cluster.awload</code></h1>
24+
</header>
25+
<section id="section-intro">
26+
<p>The awload sub-module contains the definition of the AWManager object, which handles
27+
submission and deletion of existing AppWrappers from a user's file system.</p>
28+
<details class="source">
29+
<summary>
30+
<span>Expand source code</span>
31+
</summary>
32+
<pre><code class="python"># Copyright 2022 IBM, Red Hat
33+
#
34+
# Licensed under the Apache License, Version 2.0 (the &#34;License&#34;);
35+
# you may not use this file except in compliance with the License.
36+
# You may obtain a copy of the License at
37+
#
38+
# http://www.apache.org/licenses/LICENSE-2.0
39+
#
40+
# Unless required by applicable law or agreed to in writing, software
41+
# distributed under the License is distributed on an &#34;AS IS&#34; BASIS,
42+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
43+
# See the License for the specific language governing permissions and
44+
# limitations under the License.
45+
46+
&#34;&#34;&#34;
47+
The awload sub-module contains the definition of the AWManager object, which handles
48+
submission and deletion of existing AppWrappers from a user&#39;s file system.
49+
&#34;&#34;&#34;
50+
51+
from os.path import isfile
52+
import errno
53+
import os
54+
import openshift as oc
55+
import yaml
56+
57+
58+
class AWManager:
59+
&#34;&#34;&#34;
60+
An object for submitting and removing existing AppWrapper yamls
61+
to be added to the MCAD queue.
62+
&#34;&#34;&#34;
63+
64+
def __init__(self, filename: str) -&gt; None:
65+
&#34;&#34;&#34;
66+
Create the AppWrapper Manager object by passing in an
67+
AppWrapper yaml file
68+
&#34;&#34;&#34;
69+
if not isfile(filename):
70+
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), filename)
71+
self.filename = filename
72+
try:
73+
with open(self.filename) as f:
74+
awyaml = yaml.load(f, Loader=yaml.FullLoader)
75+
assert awyaml[&#34;kind&#34;] == &#34;AppWrapper&#34;
76+
self.name = awyaml[&#34;metadata&#34;][&#34;name&#34;]
77+
self.namespace = awyaml[&#34;metadata&#34;][&#34;namespace&#34;]
78+
except:
79+
raise ValueError(
80+
f&#34;{filename } is not a correctly formatted AppWrapper yaml&#34;
81+
)
82+
self.submitted = False
83+
84+
def submit(self) -&gt; None:
85+
&#34;&#34;&#34;
86+
Attempts to create the AppWrapper custom resource using the yaml file
87+
&#34;&#34;&#34;
88+
try:
89+
with oc.project(self.namespace):
90+
oc.invoke(&#34;create&#34;, [&#34;-f&#34;, self.filename])
91+
except oc.OpenShiftPythonException as osp: # pragma: no cover
92+
error_msg = osp.result.err()
93+
if &#34;Unauthorized&#34; in error_msg or &#34;Forbidden&#34; in error_msg:
94+
raise PermissionError(
95+
&#34;Action not permitted, have you put in correct/up-to-date auth credentials?&#34;
96+
)
97+
elif &#34;AlreadyExists&#34; in error_msg:
98+
raise FileExistsError(
99+
f&#34;An AppWrapper of the name {self.name} already exists in namespace {self.namespace}&#34;
100+
)
101+
raise osp
102+
103+
self.submitted = True
104+
print(f&#34;AppWrapper {self.filename} submitted!&#34;)
105+
106+
def remove(self) -&gt; None:
107+
&#34;&#34;&#34;
108+
Attempts to delete the AppWrapper custom resource matching the name in the yaml,
109+
if submitted by this manager.
110+
&#34;&#34;&#34;
111+
if not self.submitted:
112+
print(&#34;AppWrapper not submitted by this manager yet, nothing to remove&#34;)
113+
return
114+
115+
try:
116+
with oc.project(self.namespace):
117+
oc.invoke(&#34;delete&#34;, [&#34;AppWrapper&#34;, self.name])
118+
except oc.OpenShiftPythonException as osp: # pragma: no cover
119+
error_msg = osp.result.err()
120+
if (
121+
&#39;the server doesn\&#39;t have a resource type &#34;AppWrapper&#34;&#39; in error_msg
122+
or &#34;forbidden&#34; in error_msg
123+
or &#34;Unauthorized&#34; in error_msg
124+
or &#34;Missing or incomplete configuration&#34; in error_msg
125+
):
126+
raise PermissionError(
127+
&#34;Action not permitted, have you put in correct/up-to-date auth credentials?&#34;
128+
)
129+
elif &#34;not found&#34; in error_msg:
130+
self.submitted = False
131+
print(&#34;AppWrapper not found, was deleted in another manner&#34;)
132+
return
133+
else:
134+
raise osp
135+
136+
self.submitted = False
137+
print(f&#34;AppWrapper {self.name} removed!&#34;)</code></pre>
138+
</details>
139+
</section>
140+
<section>
141+
</section>
142+
<section>
143+
</section>
144+
<section>
145+
</section>
146+
<section>
147+
<h2 class="section-title" id="header-classes">Classes</h2>
148+
<dl>
149+
<dt id="codeflare_sdk.cluster.awload.AWManager"><code class="flex name class">
150+
<span>class <span class="ident">AWManager</span></span>
151+
<span>(</span><span>filename: str)</span>
152+
</code></dt>
153+
<dd>
154+
<div class="desc"><p>An object for submitting and removing existing AppWrapper yamls
155+
to be added to the MCAD queue.</p>
156+
<p>Create the AppWrapper Manager object by passing in an
157+
AppWrapper yaml file</p></div>
158+
<details class="source">
159+
<summary>
160+
<span>Expand source code</span>
161+
</summary>
162+
<pre><code class="python">class AWManager:
163+
&#34;&#34;&#34;
164+
An object for submitting and removing existing AppWrapper yamls
165+
to be added to the MCAD queue.
166+
&#34;&#34;&#34;
167+
168+
def __init__(self, filename: str) -&gt; None:
169+
&#34;&#34;&#34;
170+
Create the AppWrapper Manager object by passing in an
171+
AppWrapper yaml file
172+
&#34;&#34;&#34;
173+
if not isfile(filename):
174+
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), filename)
175+
self.filename = filename
176+
try:
177+
with open(self.filename) as f:
178+
awyaml = yaml.load(f, Loader=yaml.FullLoader)
179+
assert awyaml[&#34;kind&#34;] == &#34;AppWrapper&#34;
180+
self.name = awyaml[&#34;metadata&#34;][&#34;name&#34;]
181+
self.namespace = awyaml[&#34;metadata&#34;][&#34;namespace&#34;]
182+
except:
183+
raise ValueError(
184+
f&#34;{filename } is not a correctly formatted AppWrapper yaml&#34;
185+
)
186+
self.submitted = False
187+
188+
def submit(self) -&gt; None:
189+
&#34;&#34;&#34;
190+
Attempts to create the AppWrapper custom resource using the yaml file
191+
&#34;&#34;&#34;
192+
try:
193+
with oc.project(self.namespace):
194+
oc.invoke(&#34;create&#34;, [&#34;-f&#34;, self.filename])
195+
except oc.OpenShiftPythonException as osp: # pragma: no cover
196+
error_msg = osp.result.err()
197+
if &#34;Unauthorized&#34; in error_msg or &#34;Forbidden&#34; in error_msg:
198+
raise PermissionError(
199+
&#34;Action not permitted, have you put in correct/up-to-date auth credentials?&#34;
200+
)
201+
elif &#34;AlreadyExists&#34; in error_msg:
202+
raise FileExistsError(
203+
f&#34;An AppWrapper of the name {self.name} already exists in namespace {self.namespace}&#34;
204+
)
205+
raise osp
206+
207+
self.submitted = True
208+
print(f&#34;AppWrapper {self.filename} submitted!&#34;)
209+
210+
def remove(self) -&gt; None:
211+
&#34;&#34;&#34;
212+
Attempts to delete the AppWrapper custom resource matching the name in the yaml,
213+
if submitted by this manager.
214+
&#34;&#34;&#34;
215+
if not self.submitted:
216+
print(&#34;AppWrapper not submitted by this manager yet, nothing to remove&#34;)
217+
return
218+
219+
try:
220+
with oc.project(self.namespace):
221+
oc.invoke(&#34;delete&#34;, [&#34;AppWrapper&#34;, self.name])
222+
except oc.OpenShiftPythonException as osp: # pragma: no cover
223+
error_msg = osp.result.err()
224+
if (
225+
&#39;the server doesn\&#39;t have a resource type &#34;AppWrapper&#34;&#39; in error_msg
226+
or &#34;forbidden&#34; in error_msg
227+
or &#34;Unauthorized&#34; in error_msg
228+
or &#34;Missing or incomplete configuration&#34; in error_msg
229+
):
230+
raise PermissionError(
231+
&#34;Action not permitted, have you put in correct/up-to-date auth credentials?&#34;
232+
)
233+
elif &#34;not found&#34; in error_msg:
234+
self.submitted = False
235+
print(&#34;AppWrapper not found, was deleted in another manner&#34;)
236+
return
237+
else:
238+
raise osp
239+
240+
self.submitted = False
241+
print(f&#34;AppWrapper {self.name} removed!&#34;)</code></pre>
242+
</details>
243+
<h3>Methods</h3>
244+
<dl>
245+
<dt id="codeflare_sdk.cluster.awload.AWManager.remove"><code class="name flex">
246+
<span>def <span class="ident">remove</span></span>(<span>self) ‑> None</span>
247+
</code></dt>
248+
<dd>
249+
<div class="desc"><p>Attempts to delete the AppWrapper custom resource matching the name in the yaml,
250+
if submitted by this manager.</p></div>
251+
<details class="source">
252+
<summary>
253+
<span>Expand source code</span>
254+
</summary>
255+
<pre><code class="python">def remove(self) -&gt; None:
256+
&#34;&#34;&#34;
257+
Attempts to delete the AppWrapper custom resource matching the name in the yaml,
258+
if submitted by this manager.
259+
&#34;&#34;&#34;
260+
if not self.submitted:
261+
print(&#34;AppWrapper not submitted by this manager yet, nothing to remove&#34;)
262+
return
263+
264+
try:
265+
with oc.project(self.namespace):
266+
oc.invoke(&#34;delete&#34;, [&#34;AppWrapper&#34;, self.name])
267+
except oc.OpenShiftPythonException as osp: # pragma: no cover
268+
error_msg = osp.result.err()
269+
if (
270+
&#39;the server doesn\&#39;t have a resource type &#34;AppWrapper&#34;&#39; in error_msg
271+
or &#34;forbidden&#34; in error_msg
272+
or &#34;Unauthorized&#34; in error_msg
273+
or &#34;Missing or incomplete configuration&#34; in error_msg
274+
):
275+
raise PermissionError(
276+
&#34;Action not permitted, have you put in correct/up-to-date auth credentials?&#34;
277+
)
278+
elif &#34;not found&#34; in error_msg:
279+
self.submitted = False
280+
print(&#34;AppWrapper not found, was deleted in another manner&#34;)
281+
return
282+
else:
283+
raise osp
284+
285+
self.submitted = False
286+
print(f&#34;AppWrapper {self.name} removed!&#34;)</code></pre>
287+
</details>
288+
</dd>
289+
<dt id="codeflare_sdk.cluster.awload.AWManager.submit"><code class="name flex">
290+
<span>def <span class="ident">submit</span></span>(<span>self) ‑> None</span>
291+
</code></dt>
292+
<dd>
293+
<div class="desc"><p>Attempts to create the AppWrapper custom resource using the yaml file</p></div>
294+
<details class="source">
295+
<summary>
296+
<span>Expand source code</span>
297+
</summary>
298+
<pre><code class="python">def submit(self) -&gt; None:
299+
&#34;&#34;&#34;
300+
Attempts to create the AppWrapper custom resource using the yaml file
301+
&#34;&#34;&#34;
302+
try:
303+
with oc.project(self.namespace):
304+
oc.invoke(&#34;create&#34;, [&#34;-f&#34;, self.filename])
305+
except oc.OpenShiftPythonException as osp: # pragma: no cover
306+
error_msg = osp.result.err()
307+
if &#34;Unauthorized&#34; in error_msg or &#34;Forbidden&#34; in error_msg:
308+
raise PermissionError(
309+
&#34;Action not permitted, have you put in correct/up-to-date auth credentials?&#34;
310+
)
311+
elif &#34;AlreadyExists&#34; in error_msg:
312+
raise FileExistsError(
313+
f&#34;An AppWrapper of the name {self.name} already exists in namespace {self.namespace}&#34;
314+
)
315+
raise osp
316+
317+
self.submitted = True
318+
print(f&#34;AppWrapper {self.filename} submitted!&#34;)</code></pre>
319+
</details>
320+
</dd>
321+
</dl>
322+
</dd>
323+
</dl>
324+
</section>
325+
</article>
326+
<nav id="sidebar">
327+
<h1>Index</h1>
328+
<div class="toc">
329+
<ul></ul>
330+
</div>
331+
<ul id="index">
332+
<li><h3>Super-module</h3>
333+
<ul>
334+
<li><code><a title="codeflare_sdk.cluster" href="index.html">codeflare_sdk.cluster</a></code></li>
335+
</ul>
336+
</li>
337+
<li><h3><a href="#header-classes">Classes</a></h3>
338+
<ul>
339+
<li>
340+
<h4><code><a title="codeflare_sdk.cluster.awload.AWManager" href="#codeflare_sdk.cluster.awload.AWManager">AWManager</a></code></h4>
341+
<ul class="">
342+
<li><code><a title="codeflare_sdk.cluster.awload.AWManager.remove" href="#codeflare_sdk.cluster.awload.AWManager.remove">remove</a></code></li>
343+
<li><code><a title="codeflare_sdk.cluster.awload.AWManager.submit" href="#codeflare_sdk.cluster.awload.AWManager.submit">submit</a></code></li>
344+
</ul>
345+
</li>
346+
</ul>
347+
</li>
348+
</ul>
349+
</nav>
350+
</main>
351+
<footer id="footer">
352+
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
353+
</footer>
354+
</body>
355+
</html>

0 commit comments

Comments
 (0)