zowe-python-sdk-bundle 1.0.0.dev16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zowe-python-sdk-bundle-1.0.0.dev16/PKG-INFO +279 -0
- zowe-python-sdk-bundle-1.0.0.dev16/README.md +19 -0
- zowe-python-sdk-bundle-1.0.0.dev16/setup.cfg +4 -0
- zowe-python-sdk-bundle-1.0.0.dev16/setup.py +46 -0
- zowe-python-sdk-bundle-1.0.0.dev16/zowe_python_sdk_bundle.egg-info/PKG-INFO +279 -0
- zowe-python-sdk-bundle-1.0.0.dev16/zowe_python_sdk_bundle.egg-info/SOURCES.txt +7 -0
- zowe-python-sdk-bundle-1.0.0.dev16/zowe_python_sdk_bundle.egg-info/dependency_links.txt +1 -0
- zowe-python-sdk-bundle-1.0.0.dev16/zowe_python_sdk_bundle.egg-info/requires.txt +5 -0
- zowe-python-sdk-bundle-1.0.0.dev16/zowe_python_sdk_bundle.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: zowe-python-sdk-bundle
|
|
3
|
+
Version: 1.0.0.dev16
|
|
4
|
+
Summary: Zowe Python SDK
|
|
5
|
+
Home-page: https://github.com/zowe/zowe-client-python-sdk
|
|
6
|
+
Author: Guilherme Cartier
|
|
7
|
+
Author-email: gcartier94@gmail.com
|
|
8
|
+
License: EPL-2.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
11
|
+
Classifier: License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# Zowe Python Client SDK
|
|
15
|
+
|
|
16
|
+
 [](https://github.com/zowe/zowe-client-python-sdk/releases/latest) [](https://zowe-client-python-sdk.readthedocs.io/en/latest/index.html)
|
|
17
|
+
|
|
18
|
+
The Zowe Client Python SDK, is a set of Python packages designed to allow programmatic
|
|
19
|
+
interactions with z/OS REST API interfaces with minimal effort.
|
|
20
|
+
|
|
21
|
+
Python developers can leverage the Zowe SDK in order to create powerful scripts/applications
|
|
22
|
+
that can interact with z/OS components.
|
|
23
|
+
|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
When installing the Zowe Client Python SDK, you have two options:
|
|
29
|
+
|
|
30
|
+
- Install all the Zowe packages
|
|
31
|
+
- Install a single sub-package
|
|
32
|
+
|
|
33
|
+
The choice depends on your intentions. If you choose to install all Zowe SDK packages,
|
|
34
|
+
this means that you will install everything under the `zowe` namespace in PyPi.
|
|
35
|
+
|
|
36
|
+
Alternatively, you can choose to install only a single subpackage for a smaller installation.
|
|
37
|
+
|
|
38
|
+
To install all Zowe SDK packages using pip:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
pip install -U --pre zowe-python-sdk-bundle
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or, to install a subpackage using pip:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
pip install -U --pre zowe.<subpackage>_for_zowe_sdk
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For more information on the available sub-packages click [HERE](https://zowe-client-python-sdk.readthedocs.io/en/latest/packages/packages.html)
|
|
51
|
+
|
|
52
|
+
<!--
|
|
53
|
+
**Note**: If you want to stay on the bleeding edge, install the Zowe SDK from the `main` branch with the following command:
|
|
54
|
+
```
|
|
55
|
+
pip install zowe@git+https://github.com/zowe/zowe-client-python-sdk@main#subdirectory=src
|
|
56
|
+
```
|
|
57
|
+
-->
|
|
58
|
+
|
|
59
|
+
## Requirements
|
|
60
|
+
|
|
61
|
+
The Zowe core package has dependencies on the packages listed below:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
commentjson
|
|
65
|
+
deepmerge
|
|
66
|
+
jsonschema
|
|
67
|
+
pyyaml
|
|
68
|
+
requests>=2.22
|
|
69
|
+
urllib3
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
It also has an optional dependency on the Zowe Secrets SDK for storing client secrets which can be installed with the `secrets` extra:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
pip install -U --pre zowe.core-for-zowe-sdk[secrets]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Developer setup
|
|
79
|
+
|
|
80
|
+
Ensure the following prerequisites are installed and on your PATH:
|
|
81
|
+
|
|
82
|
+
- Python >= 3.8 and `pip`
|
|
83
|
+
- Cargo >= 1.72 (to build Rust bindings for Secrets SDK)
|
|
84
|
+
- Visual Studio Build Tools >= 2015 (Windows only)
|
|
85
|
+
|
|
86
|
+
Clone the repository using `git`:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
git clone https://github.com/zowe/zowe-client-python-sdk.git
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Navigate to the root of the repository and checkout the desired branch. Currently, active development is on the `main` branch:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
cd zowe-client-python-sdk/
|
|
96
|
+
git checkout main
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
We recommend that developers make a virtual environment to install all required dependencies.
|
|
100
|
+
|
|
101
|
+
Create a virtual environment in the root of the repository folder using the `venv` module.
|
|
102
|
+
The command below assumes that `python` is a version of Python3:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
python -m venv venv
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
_(If this isn't the case for your environment, use the appropriate command alias for Python3)_
|
|
109
|
+
|
|
110
|
+
Activate your virtual environment so that Python uses it to manage dependencies.
|
|
111
|
+
Assuming that you are using Bash shell, reference the command below:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
source venv/bin/activate
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Otherwise, check the table titled "Command to activate virtual environment" [here](https://docs.python.org/3/library/venv.html#how-venvs-work) to find the command that works for your shell.
|
|
118
|
+
|
|
119
|
+
Install the dependencies listed in `requirements.txt` using `pip`:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
pip install -r requirements.txt
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
You can now develop the Python SDK with the installed dependencies.
|
|
126
|
+
When you are finished with your development session, deactivate your virtual environment:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
deactivate
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Quickstart
|
|
133
|
+
|
|
134
|
+
After you install the package in your project, import the class for the required sub-package (i.e `Console` class for z/OS Console commands).
|
|
135
|
+
Create a dictionary to handle communication with the plug-in:
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
from zowe.zos_console_for_zowe_sdk import Console
|
|
139
|
+
profile = {
|
|
140
|
+
"host": "example.com",
|
|
141
|
+
"port": 443,
|
|
142
|
+
"user": "<user>",
|
|
143
|
+
"password": "<password>"
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
my_console = Console(profile)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Alternatively, you can use an existing Zowe CLI profile instead:
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from zowe.zos_core_for_zowe_sdk import ProfileManager
|
|
153
|
+
from zowe.zos_console_for_zowe_sdk import Console
|
|
154
|
+
|
|
155
|
+
profile = ProfileManager().load(profile_type="zosmf")
|
|
156
|
+
my_console = Console(profile)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Important**: If your z/OSMF profile uses a credentials manager, this approach may not work depending on your operating system. Support for loading secure profiles has only been tested on Windows and Ubuntu so far.
|
|
160
|
+
|
|
161
|
+
# Available options
|
|
162
|
+
|
|
163
|
+
Currently, the Zowe Python SDK supports the following interfaces:
|
|
164
|
+
|
|
165
|
+
- Console commands
|
|
166
|
+
- z/OSMF Information retrieval
|
|
167
|
+
- Submit job from a dataset
|
|
168
|
+
- Submit job from local file
|
|
169
|
+
- Submit job as plain text JCL
|
|
170
|
+
- Retrieve job status
|
|
171
|
+
- Retrieve job list from JES spool
|
|
172
|
+
- Start/End TSO address space
|
|
173
|
+
- Ping TSO address space
|
|
174
|
+
- Issue TSO command
|
|
175
|
+
|
|
176
|
+
**Important**: Notice that the below examples assume that you have already created
|
|
177
|
+
an object for the sub-package of your preference just like in the quickstart example.
|
|
178
|
+
|
|
179
|
+
## Console
|
|
180
|
+
|
|
181
|
+
Usage of the console api:
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
result = my_console.issue_command("<command>")
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
The result will be a JSON object containing the result from the console command.
|
|
188
|
+
|
|
189
|
+
## Job
|
|
190
|
+
|
|
191
|
+
To retrieve the status of a job on JES
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
result = my_jobs.get_job_status("<jobname>", "<jobid>")
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
To retrieve list of jobs in JES spool
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
result = my_jobs.list_jobs(owner="<user>", prefix="<job-prefix>")
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Additional parameters available are:
|
|
204
|
+
|
|
205
|
+
- max_jobs
|
|
206
|
+
- user_correlator
|
|
207
|
+
|
|
208
|
+
To submit a job from a dataset:
|
|
209
|
+
|
|
210
|
+
```python
|
|
211
|
+
result = my_jobs.submit_from_mainframe("<dataset-name>")
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
To submit a job from a local file:
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
result = my_jobs.submit_from_local_file("<file-path>")
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
To submit from plain text:
|
|
221
|
+
|
|
222
|
+
```python
|
|
223
|
+
jcl = '''
|
|
224
|
+
//IEFBR14Q JOB (AUTOMATION),CLASS=A,MSGCLASS=0,
|
|
225
|
+
// MSGLEVEL=(1,1),REGION=0M,NOTIFY=&SYSUID
|
|
226
|
+
//STEP1 EXEC PGM=IEFBR14
|
|
227
|
+
'''
|
|
228
|
+
|
|
229
|
+
result = my_jobs.submit_from_plaintext(jcl)
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## TSO
|
|
234
|
+
|
|
235
|
+
Starting a TSO address space
|
|
236
|
+
|
|
237
|
+
```python
|
|
238
|
+
|
|
239
|
+
session_parameters = {
|
|
240
|
+
'proc': 'IZUFPROC',
|
|
241
|
+
'chset': '697',
|
|
242
|
+
'cpage': '1047',
|
|
243
|
+
'rows': '204',
|
|
244
|
+
'cols': '160',
|
|
245
|
+
'rsize': '4096',
|
|
246
|
+
'acct': 'DEFAULT'
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
session_key = my_tso.start_tso_session(**session_parameters)
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
If you don't provide any session parameter ZoweSDK will attempt to start a session with default parameters.
|
|
253
|
+
|
|
254
|
+
To end a TSO address space
|
|
255
|
+
|
|
256
|
+
```python
|
|
257
|
+
my_tso.end_tso_session("<session-key>")
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
In order to issue a TSO command
|
|
261
|
+
|
|
262
|
+
```python
|
|
263
|
+
tso_output = my_tso.issue_command("<tso-command>")
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## z/OSMF
|
|
267
|
+
|
|
268
|
+
Usage of the z/OSMF api
|
|
269
|
+
|
|
270
|
+
```python
|
|
271
|
+
result = my_zosmf.get_info()
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
The result will be a JSON object containing z/OSMF information
|
|
275
|
+
|
|
276
|
+
# Acknowledgments
|
|
277
|
+
|
|
278
|
+
- Make sure to check out the [Zowe project](https://github.com/zowe)!
|
|
279
|
+
- For further information on z/OSMF REST API, click [HERE](https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.izua700/IZUHPINFO_RESTServices.htm)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Zowe Python Client SDK
|
|
2
|
+
======================
|
|
3
|
+
|
|
4
|
+
The Zowe Python Client SDK consists of Python packages that enable programmatic interactions with z/OS REST API interfaces.
|
|
5
|
+
|
|
6
|
+
[Zowe Docs](https://docs.zowe.org/stable/user-guide/sdks-using) provide more information on installing and using the SDK.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
SDK Usage
|
|
10
|
+
-----------------
|
|
11
|
+
|
|
12
|
+
For more information and syntax examples, refer to the readme file in each package:
|
|
13
|
+
|
|
14
|
+
- [Core](core/README.md): Shared functionality across all other Python SDK packages.
|
|
15
|
+
- [z/OS Console](zos_console/README.md): Perform z/OS console operations.
|
|
16
|
+
- [z/OS Files](zos_files/README.md): Work with data sets on z/OS.
|
|
17
|
+
- [z/OS Jobs](zos_jobs/README.md): Work with batch jobs on z/OS.
|
|
18
|
+
- [z/OS TSO](zos_tso/README.md): Interact with TSO/E adress spaces on z/OS.
|
|
19
|
+
- [z/OSMF](zosmf/README.md): Query z/OSMF data (e.g.: connection status, list of available systems).
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import os.path
|
|
2
|
+
import uuid
|
|
3
|
+
|
|
4
|
+
from setuptools import setup
|
|
5
|
+
|
|
6
|
+
from _version import __version__
|
|
7
|
+
|
|
8
|
+
src_dir = os.path.realpath(os.path.dirname(__file__))
|
|
9
|
+
uuid4 = uuid.uuid4()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def resolve_sdk_dep(sdk_name, version_spec):
|
|
13
|
+
# if os.path.exists(os.path.join(src_dir, sdk_name, "zowe")):
|
|
14
|
+
# # Handle building from a Git checkout
|
|
15
|
+
# # Based on https://github.com/lab-cosmo/equistore/blob/master/python/equistore-torch/setup.py#L212
|
|
16
|
+
# sdk_dir = os.path.realpath(os.path.join(src_dir, sdk_name))
|
|
17
|
+
# return f"zowe.{sdk_name}_for_zowe_sdk@file://{sdk_dir}"
|
|
18
|
+
# else:
|
|
19
|
+
return f"zowe.{sdk_name}_for_zowe_sdk{version_spec}"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
if __name__ == "__main__":
|
|
23
|
+
setup(
|
|
24
|
+
name="zowe-python-sdk-bundle",
|
|
25
|
+
version=__version__,
|
|
26
|
+
description="Zowe Python SDK",
|
|
27
|
+
long_description=open("../README.md", "r").read(),
|
|
28
|
+
long_description_content_type="text/markdown",
|
|
29
|
+
url="https://github.com/zowe/zowe-client-python-sdk",
|
|
30
|
+
author="Guilherme Cartier",
|
|
31
|
+
author_email="gcartier94@gmail.com",
|
|
32
|
+
license="EPL-2.0",
|
|
33
|
+
classifiers=[
|
|
34
|
+
"Programming Language :: Python :: 3",
|
|
35
|
+
"Programming Language :: Python :: 3.8",
|
|
36
|
+
"License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)",
|
|
37
|
+
],
|
|
38
|
+
install_requires=[
|
|
39
|
+
resolve_sdk_dep("zos_console", "==" + __version__),
|
|
40
|
+
resolve_sdk_dep("zos_files", "==" + __version__),
|
|
41
|
+
resolve_sdk_dep("zos_tso", "==" + __version__),
|
|
42
|
+
resolve_sdk_dep("zos_jobs", "==" + __version__),
|
|
43
|
+
resolve_sdk_dep("zosmf", "==" + __version__),
|
|
44
|
+
],
|
|
45
|
+
py_modules=[],
|
|
46
|
+
)
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: zowe-python-sdk-bundle
|
|
3
|
+
Version: 1.0.0.dev16
|
|
4
|
+
Summary: Zowe Python SDK
|
|
5
|
+
Home-page: https://github.com/zowe/zowe-client-python-sdk
|
|
6
|
+
Author: Guilherme Cartier
|
|
7
|
+
Author-email: gcartier94@gmail.com
|
|
8
|
+
License: EPL-2.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
11
|
+
Classifier: License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# Zowe Python Client SDK
|
|
15
|
+
|
|
16
|
+
 [](https://github.com/zowe/zowe-client-python-sdk/releases/latest) [](https://zowe-client-python-sdk.readthedocs.io/en/latest/index.html)
|
|
17
|
+
|
|
18
|
+
The Zowe Client Python SDK, is a set of Python packages designed to allow programmatic
|
|
19
|
+
interactions with z/OS REST API interfaces with minimal effort.
|
|
20
|
+
|
|
21
|
+
Python developers can leverage the Zowe SDK in order to create powerful scripts/applications
|
|
22
|
+
that can interact with z/OS components.
|
|
23
|
+
|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
When installing the Zowe Client Python SDK, you have two options:
|
|
29
|
+
|
|
30
|
+
- Install all the Zowe packages
|
|
31
|
+
- Install a single sub-package
|
|
32
|
+
|
|
33
|
+
The choice depends on your intentions. If you choose to install all Zowe SDK packages,
|
|
34
|
+
this means that you will install everything under the `zowe` namespace in PyPi.
|
|
35
|
+
|
|
36
|
+
Alternatively, you can choose to install only a single subpackage for a smaller installation.
|
|
37
|
+
|
|
38
|
+
To install all Zowe SDK packages using pip:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
pip install -U --pre zowe-python-sdk-bundle
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or, to install a subpackage using pip:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
pip install -U --pre zowe.<subpackage>_for_zowe_sdk
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For more information on the available sub-packages click [HERE](https://zowe-client-python-sdk.readthedocs.io/en/latest/packages/packages.html)
|
|
51
|
+
|
|
52
|
+
<!--
|
|
53
|
+
**Note**: If you want to stay on the bleeding edge, install the Zowe SDK from the `main` branch with the following command:
|
|
54
|
+
```
|
|
55
|
+
pip install zowe@git+https://github.com/zowe/zowe-client-python-sdk@main#subdirectory=src
|
|
56
|
+
```
|
|
57
|
+
-->
|
|
58
|
+
|
|
59
|
+
## Requirements
|
|
60
|
+
|
|
61
|
+
The Zowe core package has dependencies on the packages listed below:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
commentjson
|
|
65
|
+
deepmerge
|
|
66
|
+
jsonschema
|
|
67
|
+
pyyaml
|
|
68
|
+
requests>=2.22
|
|
69
|
+
urllib3
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
It also has an optional dependency on the Zowe Secrets SDK for storing client secrets which can be installed with the `secrets` extra:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
pip install -U --pre zowe.core-for-zowe-sdk[secrets]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Developer setup
|
|
79
|
+
|
|
80
|
+
Ensure the following prerequisites are installed and on your PATH:
|
|
81
|
+
|
|
82
|
+
- Python >= 3.8 and `pip`
|
|
83
|
+
- Cargo >= 1.72 (to build Rust bindings for Secrets SDK)
|
|
84
|
+
- Visual Studio Build Tools >= 2015 (Windows only)
|
|
85
|
+
|
|
86
|
+
Clone the repository using `git`:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
git clone https://github.com/zowe/zowe-client-python-sdk.git
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Navigate to the root of the repository and checkout the desired branch. Currently, active development is on the `main` branch:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
cd zowe-client-python-sdk/
|
|
96
|
+
git checkout main
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
We recommend that developers make a virtual environment to install all required dependencies.
|
|
100
|
+
|
|
101
|
+
Create a virtual environment in the root of the repository folder using the `venv` module.
|
|
102
|
+
The command below assumes that `python` is a version of Python3:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
python -m venv venv
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
_(If this isn't the case for your environment, use the appropriate command alias for Python3)_
|
|
109
|
+
|
|
110
|
+
Activate your virtual environment so that Python uses it to manage dependencies.
|
|
111
|
+
Assuming that you are using Bash shell, reference the command below:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
source venv/bin/activate
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Otherwise, check the table titled "Command to activate virtual environment" [here](https://docs.python.org/3/library/venv.html#how-venvs-work) to find the command that works for your shell.
|
|
118
|
+
|
|
119
|
+
Install the dependencies listed in `requirements.txt` using `pip`:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
pip install -r requirements.txt
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
You can now develop the Python SDK with the installed dependencies.
|
|
126
|
+
When you are finished with your development session, deactivate your virtual environment:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
deactivate
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Quickstart
|
|
133
|
+
|
|
134
|
+
After you install the package in your project, import the class for the required sub-package (i.e `Console` class for z/OS Console commands).
|
|
135
|
+
Create a dictionary to handle communication with the plug-in:
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
from zowe.zos_console_for_zowe_sdk import Console
|
|
139
|
+
profile = {
|
|
140
|
+
"host": "example.com",
|
|
141
|
+
"port": 443,
|
|
142
|
+
"user": "<user>",
|
|
143
|
+
"password": "<password>"
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
my_console = Console(profile)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Alternatively, you can use an existing Zowe CLI profile instead:
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from zowe.zos_core_for_zowe_sdk import ProfileManager
|
|
153
|
+
from zowe.zos_console_for_zowe_sdk import Console
|
|
154
|
+
|
|
155
|
+
profile = ProfileManager().load(profile_type="zosmf")
|
|
156
|
+
my_console = Console(profile)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Important**: If your z/OSMF profile uses a credentials manager, this approach may not work depending on your operating system. Support for loading secure profiles has only been tested on Windows and Ubuntu so far.
|
|
160
|
+
|
|
161
|
+
# Available options
|
|
162
|
+
|
|
163
|
+
Currently, the Zowe Python SDK supports the following interfaces:
|
|
164
|
+
|
|
165
|
+
- Console commands
|
|
166
|
+
- z/OSMF Information retrieval
|
|
167
|
+
- Submit job from a dataset
|
|
168
|
+
- Submit job from local file
|
|
169
|
+
- Submit job as plain text JCL
|
|
170
|
+
- Retrieve job status
|
|
171
|
+
- Retrieve job list from JES spool
|
|
172
|
+
- Start/End TSO address space
|
|
173
|
+
- Ping TSO address space
|
|
174
|
+
- Issue TSO command
|
|
175
|
+
|
|
176
|
+
**Important**: Notice that the below examples assume that you have already created
|
|
177
|
+
an object for the sub-package of your preference just like in the quickstart example.
|
|
178
|
+
|
|
179
|
+
## Console
|
|
180
|
+
|
|
181
|
+
Usage of the console api:
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
result = my_console.issue_command("<command>")
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
The result will be a JSON object containing the result from the console command.
|
|
188
|
+
|
|
189
|
+
## Job
|
|
190
|
+
|
|
191
|
+
To retrieve the status of a job on JES
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
result = my_jobs.get_job_status("<jobname>", "<jobid>")
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
To retrieve list of jobs in JES spool
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
result = my_jobs.list_jobs(owner="<user>", prefix="<job-prefix>")
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Additional parameters available are:
|
|
204
|
+
|
|
205
|
+
- max_jobs
|
|
206
|
+
- user_correlator
|
|
207
|
+
|
|
208
|
+
To submit a job from a dataset:
|
|
209
|
+
|
|
210
|
+
```python
|
|
211
|
+
result = my_jobs.submit_from_mainframe("<dataset-name>")
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
To submit a job from a local file:
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
result = my_jobs.submit_from_local_file("<file-path>")
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
To submit from plain text:
|
|
221
|
+
|
|
222
|
+
```python
|
|
223
|
+
jcl = '''
|
|
224
|
+
//IEFBR14Q JOB (AUTOMATION),CLASS=A,MSGCLASS=0,
|
|
225
|
+
// MSGLEVEL=(1,1),REGION=0M,NOTIFY=&SYSUID
|
|
226
|
+
//STEP1 EXEC PGM=IEFBR14
|
|
227
|
+
'''
|
|
228
|
+
|
|
229
|
+
result = my_jobs.submit_from_plaintext(jcl)
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## TSO
|
|
234
|
+
|
|
235
|
+
Starting a TSO address space
|
|
236
|
+
|
|
237
|
+
```python
|
|
238
|
+
|
|
239
|
+
session_parameters = {
|
|
240
|
+
'proc': 'IZUFPROC',
|
|
241
|
+
'chset': '697',
|
|
242
|
+
'cpage': '1047',
|
|
243
|
+
'rows': '204',
|
|
244
|
+
'cols': '160',
|
|
245
|
+
'rsize': '4096',
|
|
246
|
+
'acct': 'DEFAULT'
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
session_key = my_tso.start_tso_session(**session_parameters)
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
If you don't provide any session parameter ZoweSDK will attempt to start a session with default parameters.
|
|
253
|
+
|
|
254
|
+
To end a TSO address space
|
|
255
|
+
|
|
256
|
+
```python
|
|
257
|
+
my_tso.end_tso_session("<session-key>")
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
In order to issue a TSO command
|
|
261
|
+
|
|
262
|
+
```python
|
|
263
|
+
tso_output = my_tso.issue_command("<tso-command>")
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## z/OSMF
|
|
267
|
+
|
|
268
|
+
Usage of the z/OSMF api
|
|
269
|
+
|
|
270
|
+
```python
|
|
271
|
+
result = my_zosmf.get_info()
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
The result will be a JSON object containing z/OSMF information
|
|
275
|
+
|
|
276
|
+
# Acknowledgments
|
|
277
|
+
|
|
278
|
+
- Make sure to check out the [Zowe project](https://github.com/zowe)!
|
|
279
|
+
- For further information on z/OSMF REST API, click [HERE](https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.izua700/IZUHPINFO_RESTServices.htm)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|