oci-cli 3.71.1__py3-none-any.whl → 3.71.2__py3-none-any.whl

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.
Files changed (130) hide show
  1. oci_cli/bin/batch.psm1 +122 -0
  2. oci_cli/bin/integration.psm1 +6 -2
  3. oci_cli/cli_util.py +2 -4
  4. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-context/change-compartment.txt +140 -0
  5. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-context/create-oci-logging-configuration.txt +210 -0
  6. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-context/create.txt +237 -0
  7. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-context/delete.txt +139 -0
  8. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-context/get.txt +100 -0
  9. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-context/list.txt +131 -0
  10. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-context/start.txt +134 -0
  11. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-context/stop.txt +134 -0
  12. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-context/update.txt +213 -0
  13. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-context-shape-collection/list.txt +101 -0
  14. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-context-shape-collection.txt +14 -0
  15. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-context.txt +35 -0
  16. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job/cancel.txt +144 -0
  17. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job/change-compartment.txt +146 -0
  18. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job/create.txt +215 -0
  19. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job/get.txt +106 -0
  20. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job/list.txt +135 -0
  21. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job/pause.txt +140 -0
  22. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job/unpause.txt +140 -0
  23. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job/update.txt +191 -0
  24. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job-pool/change-compartment.txt +142 -0
  25. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job-pool/create.txt +180 -0
  26. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job-pool/delete.txt +141 -0
  27. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job-pool/get.txt +102 -0
  28. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job-pool/list.txt +135 -0
  29. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job-pool/start.txt +136 -0
  30. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job-pool/stop.txt +136 -0
  31. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job-pool/update.txt +186 -0
  32. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job-pool.txt +33 -0
  33. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-job.txt +35 -0
  34. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task/get.txt +111 -0
  35. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task/list-batch-tasks.txt +125 -0
  36. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task/list.txt +132 -0
  37. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task-environment/change-compartment.txt +135 -0
  38. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task-environment/create.txt +207 -0
  39. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task-environment/delete.txt +134 -0
  40. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task-environment/get.txt +95 -0
  41. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task-environment/list.txt +131 -0
  42. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task-environment/update.txt +179 -0
  43. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task-environment.txt +31 -0
  44. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task-profile/change-compartment.txt +136 -0
  45. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task-profile/create.txt +178 -0
  46. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task-profile/delete.txt +135 -0
  47. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task-profile/get.txt +96 -0
  48. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task-profile/list.txt +131 -0
  49. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task-profile/update.txt +180 -0
  50. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task-profile.txt +30 -0
  51. oci_cli/help_text_producer/data_files/text/cmdref/batch/batch-task.txt +18 -0
  52. oci_cli/help_text_producer/data_files/text/cmdref/batch/work-request/get.txt +92 -0
  53. oci_cli/help_text_producer/data_files/text/cmdref/batch/work-request/list.txt +141 -0
  54. oci_cli/help_text_producer/data_files/text/cmdref/batch/work-request-error/list.txt +132 -0
  55. oci_cli/help_text_producer/data_files/text/cmdref/batch/work-request-error.txt +15 -0
  56. oci_cli/help_text_producer/data_files/text/cmdref/batch/work-request-log-entry/list-work-request-logs.txt +132 -0
  57. oci_cli/help_text_producer/data_files/text/cmdref/batch/work-request-log-entry.txt +15 -0
  58. oci_cli/help_text_producer/data_files/text/cmdref/batch/work-request.txt +21 -0
  59. oci_cli/help_text_producer/data_files/text/cmdref/batch.txt +123 -0
  60. oci_cli/help_text_producer/data_files/text/cmdref/ce/virtual-node-pool/create.txt +14 -13
  61. oci_cli/help_text_producer/data_files/text/cmdref/ce/virtual-node-pool/delete.txt +2 -1
  62. oci_cli/help_text_producer/data_files/text/cmdref/ce/virtual-node-pool/get-virtual-node.txt +2 -1
  63. oci_cli/help_text_producer/data_files/text/cmdref/ce/virtual-node-pool/get.txt +2 -1
  64. oci_cli/help_text_producer/data_files/text/cmdref/ce/virtual-node-pool/list-virtual-nodes.txt +2 -1
  65. oci_cli/help_text_producer/data_files/text/cmdref/ce/virtual-node-pool/update.txt +2 -1
  66. oci_cli/help_text_producer/data_files/text/cmdref/compute/compute-host/apply-host-configuration.txt +127 -0
  67. oci_cli/help_text_producer/data_files/text/cmdref/compute/compute-host/check-host-configuration.txt +127 -0
  68. oci_cli/help_text_producer/data_files/text/cmdref/compute/compute-host.txt +4 -0
  69. oci_cli/help_text_producer/data_files/text/cmdref/compute/firmware-bundle/get.txt +92 -0
  70. oci_cli/help_text_producer/data_files/text/cmdref/compute/firmware-bundle/list.txt +134 -0
  71. oci_cli/help_text_producer/data_files/text/cmdref/compute/firmware-bundle.txt +17 -0
  72. oci_cli/help_text_producer/data_files/text/cmdref/compute/shape/list.txt +4 -0
  73. oci_cli/help_text_producer/data_files/text/cmdref/compute.txt +10 -0
  74. oci_cli/help_text_producer/data_files/text/cmdref/data-science/ml-app-instance-view/list.txt +4 -0
  75. oci_cli/help_text_producer/data_files/text/cmdref/delegate-access-control/work-request/work-request-error/{list.txt → list-errors.txt} +5 -5
  76. oci_cli/help_text_producer/data_files/text/cmdref/delegate-access-control/work-request/work-request-error.txt +1 -1
  77. oci_cli/help_text_producer/data_files/text/cmdref/delegate-access-control/work-request/work-request-log-entry/{list-work-request-logs.txt → list-logs.txt} +5 -5
  78. oci_cli/help_text_producer/data_files/text/cmdref/delegate-access-control/work-request/work-request-log-entry.txt +1 -1
  79. oci_cli/help_text_producer/data_files/text/cmdref/delegate-access-control/work-request.txt +2 -2
  80. oci_cli/help_text_producer/data_files/text/cmdref/delegate-access-control.txt +2 -2
  81. oci_cli/help_text_producer/data_files/text/cmdref/disaster-recovery/dr-plan-execution/update.txt +1 -1
  82. oci_cli/help_text_producer/data_files/text/cmdref/governance-rules-control-plane/work-request/work-request-error/{list.txt → list-errors.txt} +5 -5
  83. oci_cli/help_text_producer/data_files/text/cmdref/governance-rules-control-plane/work-request/work-request-error.txt +1 -1
  84. oci_cli/help_text_producer/data_files/text/cmdref/governance-rules-control-plane/work-request/work-request-log-entry/{list-work-request-logs.txt → list-logs.txt} +5 -5
  85. oci_cli/help_text_producer/data_files/text/cmdref/governance-rules-control-plane/work-request/work-request-log-entry.txt +1 -1
  86. oci_cli/help_text_producer/data_files/text/cmdref/governance-rules-control-plane/work-request.txt +2 -2
  87. oci_cli/help_text_producer/data_files/text/cmdref/governance-rules-control-plane.txt +2 -2
  88. oci_cli/help_text_producer/data_files/text/cmdref/identity-domains/mapped-attribute/get.txt +136 -0
  89. oci_cli/help_text_producer/data_files/text/cmdref/identity-domains/mapped-attribute/list.txt +190 -0
  90. oci_cli/help_text_producer/data_files/text/cmdref/identity-domains/mapped-attribute/patch.txt +177 -0
  91. oci_cli/help_text_producer/data_files/text/cmdref/identity-domains/mapped-attribute/put.txt +385 -0
  92. oci_cli/help_text_producer/data_files/text/cmdref/identity-domains/mapped-attribute/search.txt +199 -0
  93. oci_cli/help_text_producer/data_files/text/cmdref/identity-domains/mapped-attribute.txt +22 -0
  94. oci_cli/help_text_producer/data_files/text/cmdref/identity-domains.txt +12 -0
  95. oci_cli/help_text_producer/data_files/text/cmdref/integration/integration-instance/change-private-endpoint-outbound-connection-private-endpoint-outbound-connection.txt +5 -0
  96. oci_cli/help_text_producer/data_files/text/cmdref/integration/integration-instance/convert-instance.txt +144 -0
  97. oci_cli/help_text_producer/data_files/text/cmdref/integration/integration-instance/disable-process-automation.txt +132 -0
  98. oci_cli/help_text_producer/data_files/text/cmdref/integration/integration-instance.txt +4 -0
  99. oci_cli/help_text_producer/data_files/text/cmdref/integration.txt +4 -0
  100. oci_cli/help_text_producer/data_files/text/cmdref/ocvs/work-request-error/{list.txt → list-errors.txt} +5 -5
  101. oci_cli/help_text_producer/data_files/text/cmdref/ocvs/work-request-error.txt +1 -1
  102. oci_cli/help_text_producer/data_files/text/cmdref/ocvs.txt +1 -1
  103. oci_cli/help_text_producer/data_files/text/cmdref/organizations/work-request-error/{list.txt → list-errors.txt} +5 -5
  104. oci_cli/help_text_producer/data_files/text/cmdref/organizations/work-request-error.txt +1 -1
  105. oci_cli/help_text_producer/data_files/text/cmdref/organizations.txt +1 -1
  106. oci_cli/help_text_producer/data_files/text/index.txt +2 -0
  107. oci_cli/service_mapping.py +5 -0
  108. oci_cli/version.py +1 -1
  109. {oci_cli-3.71.1.dist-info → oci_cli-3.71.2.dist-info}/METADATA +2 -2
  110. {oci_cli-3.71.1.dist-info → oci_cli-3.71.2.dist-info}/RECORD +130 -52
  111. services/batch/__init__.py +4 -0
  112. services/batch/src/__init__.py +4 -0
  113. services/batch/src/oci_cli_batch_computing/__init__.py +4 -0
  114. services/batch/src/oci_cli_batch_computing/batchcomputing_cli_extended.py +93 -0
  115. services/batch/src/oci_cli_batch_computing/generated/__init__.py +4 -0
  116. services/batch/src/oci_cli_batch_computing/generated/batchcomputing_cli.py +2855 -0
  117. services/batch/src/oci_cli_batch_computing/generated/client_mappings.py +14 -0
  118. services/batch/tests/__init__.py +4 -0
  119. services/container_engine/src/oci_cli_container_engine/generated/containerengine_cli.py +3 -5
  120. services/core/src/oci_cli_compute/computepic_cli_extended.py +9 -0
  121. services/core/src/oci_cli_compute/generated/compute_cli.py +201 -1
  122. services/data_science/src/oci_cli_data_science/generated/datascience_cli.py +4 -1
  123. services/disaster_recovery/src/oci_cli_disaster_recovery/generated/disasterrecovery_cli.py +1 -1
  124. services/identity_domains/src/oci_cli_identity_domains/generated/identitydomains_cli.py +371 -0
  125. services/integration/src/oci_cli_integration_instance/generated/integrationinstance_cli.py +259 -7
  126. {oci_cli-3.71.1.dist-info → oci_cli-3.71.2.dist-info}/LICENSE.txt +0 -0
  127. {oci_cli-3.71.1.dist-info → oci_cli-3.71.2.dist-info}/THIRD_PARTY_LICENSES.txt +0 -0
  128. {oci_cli-3.71.1.dist-info → oci_cli-3.71.2.dist-info}/WHEEL +0 -0
  129. {oci_cli-3.71.1.dist-info → oci_cli-3.71.2.dist-info}/entry_points.txt +0 -0
  130. {oci_cli-3.71.1.dist-info → oci_cli-3.71.2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,2855 @@
1
+ # coding: utf-8
2
+ # Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
3
+ # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
4
+ # NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20251031
5
+
6
+ from __future__ import print_function
7
+ import click
8
+ import oci # noqa: F401
9
+ import six # noqa: F401
10
+ import sys # noqa: F401
11
+ from oci_cli.cli_root import cli
12
+ from oci_cli import cli_constants # noqa: F401
13
+ from oci_cli import cli_util
14
+ from oci_cli import json_skeleton_utils
15
+ from oci_cli import custom_types # noqa: F401
16
+ from oci_cli.aliasing import CommandGroupWithAlias
17
+
18
+
19
+ @cli.command(cli_util.override('batch.batch_root_group.command_name', 'batch'), cls=CommandGroupWithAlias, help=cli_util.override('batch.batch_root_group.help', """Use the Batch Control Plane API to encapsulate and manage all aspects of computationally intensive jobs."""), short_help=cli_util.override('batch.batch_root_group.short_help', """Batch API"""))
20
+ @cli_util.help_option_group
21
+ def batch_root_group():
22
+ pass
23
+
24
+
25
+ @click.command(cli_util.override('batch.batch_task_profile_collection_group.command_name', 'batch-task-profile-collection'), cls=CommandGroupWithAlias, help="""Results of a batch task profile search. Contains both batch task profile summary items and other information, such as metadata.""")
26
+ @cli_util.help_option_group
27
+ def batch_task_profile_collection_group():
28
+ pass
29
+
30
+
31
+ @click.command(cli_util.override('batch.batch_context_shape_collection_group.command_name', 'batch-context-shape-collection'), cls=CommandGroupWithAlias, help="""A collection of container instance shapes.""")
32
+ @cli_util.help_option_group
33
+ def batch_context_shape_collection_group():
34
+ pass
35
+
36
+
37
+ @click.command(cli_util.override('batch.batch_task_environment_group.command_name', 'batch-task-environment'), cls=CommandGroupWithAlias, help="""A batch task environment resource defines the software that is used to execute tasks. It mainly contains a URL to a container image along with other configurations that are needed by the image.
38
+
39
+ To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see [Getting Started with Policies].""")
40
+ @cli_util.help_option_group
41
+ def batch_task_environment_group():
42
+ pass
43
+
44
+
45
+ @click.command(cli_util.override('batch.batch_task_profile_group.command_name', 'batch-task-profile'), cls=CommandGroupWithAlias, help="""A batch task profile resource describes the minimum hardware requirements requested for a task.
46
+
47
+ To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see [Getting Started with Policies].""")
48
+ @cli_util.help_option_group
49
+ def batch_task_profile_group():
50
+ pass
51
+
52
+
53
+ @click.command(cli_util.override('batch.work_request_log_entry_group.command_name', 'work-request-log-entry'), cls=CommandGroupWithAlias, help="""A log message from performing an operation that is tracked by a work request.""")
54
+ @cli_util.help_option_group
55
+ def work_request_log_entry_group():
56
+ pass
57
+
58
+
59
+ @click.command(cli_util.override('batch.work_request_group.command_name', 'work-request'), cls=CommandGroupWithAlias, help="""An asynchronous work request. Work requests help you monitor long-running operations. When you start a long-running operation, the service creates a work request. A work request is an activity log that lets you track each step in the operation's progress. Each work request has an OCID that lets you interact with it programmatically and use it for automation.""")
60
+ @cli_util.help_option_group
61
+ def work_request_group():
62
+ pass
63
+
64
+
65
+ @click.command(cli_util.override('batch.batch_task_group.command_name', 'batch-task'), cls=CommandGroupWithAlias, help="""A batch task contains common properties for all types of job tasks.""")
66
+ @cli_util.help_option_group
67
+ def batch_task_group():
68
+ pass
69
+
70
+
71
+ @click.command(cli_util.override('batch.batch_job_pool_collection_group.command_name', 'batch-job-pool-collection'), cls=CommandGroupWithAlias, help="""Results of a batch job pool search. Contains both batch job pool summary items and other information, such as metadata.""")
72
+ @cli_util.help_option_group
73
+ def batch_job_pool_collection_group():
74
+ pass
75
+
76
+
77
+ @click.command(cli_util.override('batch.batch_job_pool_group.command_name', 'batch-job-pool'), cls=CommandGroupWithAlias, help="""A batch job pool represents an abstract group for jobs.
78
+
79
+ To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see [Getting Started with Policies].""")
80
+ @cli_util.help_option_group
81
+ def batch_job_pool_group():
82
+ pass
83
+
84
+
85
+ @click.command(cli_util.override('batch.batch_job_collection_group.command_name', 'batch-job-collection'), cls=CommandGroupWithAlias, help="""Results of a batch job search. Contains both batch job summary items and other information, such as metadata.""")
86
+ @cli_util.help_option_group
87
+ def batch_job_collection_group():
88
+ pass
89
+
90
+
91
+ @click.command(cli_util.override('batch.batch_context_collection_group.command_name', 'batch-context-collection'), cls=CommandGroupWithAlias, help="""Results of a batch context search. Contains both batch context summary items and other information, such as metadata.""")
92
+ @cli_util.help_option_group
93
+ def batch_context_collection_group():
94
+ pass
95
+
96
+
97
+ @click.command(cli_util.override('batch.batch_job_group.command_name', 'batch-job'), cls=CommandGroupWithAlias, help="""A batch job represents the execution unit that is invoked on a batch's pools of compute resources. A job is composed of one or more tasks, which are the executable commands.
98
+
99
+ To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see [Getting Started with Policies].""")
100
+ @cli_util.help_option_group
101
+ def batch_job_group():
102
+ pass
103
+
104
+
105
+ @click.command(cli_util.override('batch.batch_task_environment_collection_group.command_name', 'batch-task-environment-collection'), cls=CommandGroupWithAlias, help="""Results of a batch task environment search. Contains both batch task environment summary items and other information, such as metadata.""")
106
+ @cli_util.help_option_group
107
+ def batch_task_environment_collection_group():
108
+ pass
109
+
110
+
111
+ @click.command(cli_util.override('batch.work_request_error_group.command_name', 'work-request-error'), cls=CommandGroupWithAlias, help="""An error encountered while performing an operation that is tracked by a work request.""")
112
+ @cli_util.help_option_group
113
+ def work_request_error_group():
114
+ pass
115
+
116
+
117
+ @click.command(cli_util.override('batch.batch_context_group.command_name', 'batch-context'), cls=CommandGroupWithAlias, help="""Representation of a batch context and its configurations.
118
+
119
+ To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see [Getting Started with Policies].""")
120
+ @cli_util.help_option_group
121
+ def batch_context_group():
122
+ pass
123
+
124
+
125
+ @click.command(cli_util.override('batch.batch_task_collection_group.command_name', 'batch-task-collection'), cls=CommandGroupWithAlias, help="""Results of a batch task search. Contains both batch task summary items and other information, such as metadata.""")
126
+ @cli_util.help_option_group
127
+ def batch_task_collection_group():
128
+ pass
129
+
130
+
131
+ batch_root_group.add_command(batch_task_profile_collection_group)
132
+ batch_root_group.add_command(batch_context_shape_collection_group)
133
+ batch_root_group.add_command(batch_task_environment_group)
134
+ batch_root_group.add_command(batch_task_profile_group)
135
+ batch_root_group.add_command(work_request_log_entry_group)
136
+ batch_root_group.add_command(work_request_group)
137
+ batch_root_group.add_command(batch_task_group)
138
+ batch_root_group.add_command(batch_job_pool_collection_group)
139
+ batch_root_group.add_command(batch_job_pool_group)
140
+ batch_root_group.add_command(batch_job_collection_group)
141
+ batch_root_group.add_command(batch_context_collection_group)
142
+ batch_root_group.add_command(batch_job_group)
143
+ batch_root_group.add_command(batch_task_environment_collection_group)
144
+ batch_root_group.add_command(work_request_error_group)
145
+ batch_root_group.add_command(batch_context_group)
146
+ batch_root_group.add_command(batch_task_collection_group)
147
+
148
+
149
+ @batch_job_group.command(name=cli_util.override('batch.cancel_batch_job.command_name', 'cancel'), help=u"""Cancels a batch job. \n[Command Reference](cancelBatchJob)""")
150
+ @cli_util.option('--batch-job-id', required=True, help=u"""The [OCID] of the batch job.""")
151
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
152
+ @cli_util.confirm_delete_option
153
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
154
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
155
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
156
+ @json_skeleton_utils.get_cli_json_input_option({})
157
+ @cli_util.help_option
158
+ @click.pass_context
159
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
160
+ @cli_util.wrap_exceptions
161
+ def cancel_batch_job(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_job_id, if_match):
162
+
163
+ if isinstance(batch_job_id, six.string_types) and len(batch_job_id.strip()) == 0:
164
+ raise click.UsageError('Parameter --batch-job-id cannot be whitespace or empty string')
165
+
166
+ kwargs = {}
167
+ if if_match is not None:
168
+ kwargs['if_match'] = if_match
169
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
170
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
171
+ result = client.cancel_batch_job(
172
+ batch_job_id=batch_job_id,
173
+ **kwargs
174
+ )
175
+ if wait_for_state:
176
+
177
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
178
+ try:
179
+ wait_period_kwargs = {}
180
+ if max_wait_seconds is not None:
181
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
182
+ if wait_interval_seconds is not None:
183
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
184
+ if 'opc-work-request-id' not in result.headers:
185
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
186
+ cli_util.render_response(result, ctx)
187
+ return
188
+
189
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
190
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
191
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
192
+ # If we fail, we should show an error, but we should still provide the information to the customer
193
+ click.echo('Failed to wait until the work request entered the specified state. Please retrieve the work request to find its current state', file=sys.stderr)
194
+ cli_util.render_response(result, ctx)
195
+ sys.exit(2)
196
+ except Exception:
197
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
198
+ cli_util.render_response(result, ctx)
199
+ raise
200
+ else:
201
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
202
+ cli_util.render_response(result, ctx)
203
+
204
+
205
+ @batch_context_group.command(name=cli_util.override('batch.change_batch_context_compartment.command_name', 'change-compartment'), help=u"""Moves a batch context into a different compartment within the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment]. \n[Command Reference](changeBatchContextCompartment)""")
206
+ @cli_util.option('--batch-context-id', required=True, help=u"""The [OCID] of the batch context.""")
207
+ @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the batch context to.""")
208
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
209
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
210
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
211
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
212
+ @json_skeleton_utils.get_cli_json_input_option({})
213
+ @cli_util.help_option
214
+ @click.pass_context
215
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
216
+ @cli_util.wrap_exceptions
217
+ def change_batch_context_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_context_id, compartment_id, if_match):
218
+
219
+ if isinstance(batch_context_id, six.string_types) and len(batch_context_id.strip()) == 0:
220
+ raise click.UsageError('Parameter --batch-context-id cannot be whitespace or empty string')
221
+
222
+ kwargs = {}
223
+ if if_match is not None:
224
+ kwargs['if_match'] = if_match
225
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
226
+
227
+ _details = {}
228
+ _details['compartmentId'] = compartment_id
229
+
230
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
231
+ result = client.change_batch_context_compartment(
232
+ batch_context_id=batch_context_id,
233
+ change_batch_context_compartment_details=_details,
234
+ **kwargs
235
+ )
236
+ if wait_for_state:
237
+
238
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
239
+ try:
240
+ wait_period_kwargs = {}
241
+ if max_wait_seconds is not None:
242
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
243
+ if wait_interval_seconds is not None:
244
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
245
+ if 'opc-work-request-id' not in result.headers:
246
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
247
+ cli_util.render_response(result, ctx)
248
+ return
249
+
250
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
251
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
252
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
253
+ # If we fail, we should show an error, but we should still provide the information to the customer
254
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
255
+ cli_util.render_response(result, ctx)
256
+ sys.exit(2)
257
+ except Exception:
258
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
259
+ cli_util.render_response(result, ctx)
260
+ raise
261
+ else:
262
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
263
+ cli_util.render_response(result, ctx)
264
+
265
+
266
+ @batch_job_group.command(name=cli_util.override('batch.change_batch_job_compartment.command_name', 'change-compartment'), help=u"""Moves a batch job into a different compartment within the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment]. \n[Command Reference](changeBatchJobCompartment)""")
267
+ @cli_util.option('--batch-job-id', required=True, help=u"""The [OCID] of the batch job.""")
268
+ @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment.""")
269
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
270
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
271
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
272
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
273
+ @json_skeleton_utils.get_cli_json_input_option({})
274
+ @cli_util.help_option
275
+ @click.pass_context
276
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
277
+ @cli_util.wrap_exceptions
278
+ def change_batch_job_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_job_id, compartment_id, if_match):
279
+
280
+ if isinstance(batch_job_id, six.string_types) and len(batch_job_id.strip()) == 0:
281
+ raise click.UsageError('Parameter --batch-job-id cannot be whitespace or empty string')
282
+
283
+ kwargs = {}
284
+ if if_match is not None:
285
+ kwargs['if_match'] = if_match
286
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
287
+
288
+ _details = {}
289
+ _details['compartmentId'] = compartment_id
290
+
291
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
292
+ result = client.change_batch_job_compartment(
293
+ batch_job_id=batch_job_id,
294
+ change_batch_job_compartment_details=_details,
295
+ **kwargs
296
+ )
297
+ if wait_for_state:
298
+
299
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
300
+ try:
301
+ wait_period_kwargs = {}
302
+ if max_wait_seconds is not None:
303
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
304
+ if wait_interval_seconds is not None:
305
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
306
+ if 'opc-work-request-id' not in result.headers:
307
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
308
+ cli_util.render_response(result, ctx)
309
+ return
310
+
311
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
312
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
313
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
314
+ # If we fail, we should show an error, but we should still provide the information to the customer
315
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
316
+ cli_util.render_response(result, ctx)
317
+ sys.exit(2)
318
+ except Exception:
319
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
320
+ cli_util.render_response(result, ctx)
321
+ raise
322
+ else:
323
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
324
+ cli_util.render_response(result, ctx)
325
+
326
+
327
+ @batch_job_pool_group.command(name=cli_util.override('batch.change_batch_job_pool_compartment.command_name', 'change-compartment'), help=u"""Moves a batch job pool into a different compartment within the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment]. \n[Command Reference](changeBatchJobPoolCompartment)""")
328
+ @cli_util.option('--batch-job-pool-id', required=True, help=u"""The [OCID] of the batch job pool.""")
329
+ @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment.""")
330
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
331
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
332
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
333
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
334
+ @json_skeleton_utils.get_cli_json_input_option({})
335
+ @cli_util.help_option
336
+ @click.pass_context
337
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
338
+ @cli_util.wrap_exceptions
339
+ def change_batch_job_pool_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_job_pool_id, compartment_id, if_match):
340
+
341
+ if isinstance(batch_job_pool_id, six.string_types) and len(batch_job_pool_id.strip()) == 0:
342
+ raise click.UsageError('Parameter --batch-job-pool-id cannot be whitespace or empty string')
343
+
344
+ kwargs = {}
345
+ if if_match is not None:
346
+ kwargs['if_match'] = if_match
347
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
348
+
349
+ _details = {}
350
+ _details['compartmentId'] = compartment_id
351
+
352
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
353
+ result = client.change_batch_job_pool_compartment(
354
+ batch_job_pool_id=batch_job_pool_id,
355
+ change_batch_job_pool_compartment_details=_details,
356
+ **kwargs
357
+ )
358
+ if wait_for_state:
359
+
360
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
361
+ try:
362
+ wait_period_kwargs = {}
363
+ if max_wait_seconds is not None:
364
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
365
+ if wait_interval_seconds is not None:
366
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
367
+ if 'opc-work-request-id' not in result.headers:
368
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
369
+ cli_util.render_response(result, ctx)
370
+ return
371
+
372
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
373
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
374
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
375
+ # If we fail, we should show an error, but we should still provide the information to the customer
376
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
377
+ cli_util.render_response(result, ctx)
378
+ sys.exit(2)
379
+ except Exception:
380
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
381
+ cli_util.render_response(result, ctx)
382
+ raise
383
+ else:
384
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
385
+ cli_util.render_response(result, ctx)
386
+
387
+
388
+ @batch_task_environment_group.command(name=cli_util.override('batch.change_batch_task_environment_compartment.command_name', 'change-compartment'), help=u"""Moves a batch task environment into a different compartment within the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment]. \n[Command Reference](changeBatchTaskEnvironmentCompartment)""")
389
+ @cli_util.option('--batch-task-environment-id', required=True, help=u"""The [OCID] of the batch task environment.""")
390
+ @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the batch task environment to.""")
391
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
392
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
393
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
394
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
395
+ @json_skeleton_utils.get_cli_json_input_option({})
396
+ @cli_util.help_option
397
+ @click.pass_context
398
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
399
+ @cli_util.wrap_exceptions
400
+ def change_batch_task_environment_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_task_environment_id, compartment_id, if_match):
401
+
402
+ if isinstance(batch_task_environment_id, six.string_types) and len(batch_task_environment_id.strip()) == 0:
403
+ raise click.UsageError('Parameter --batch-task-environment-id cannot be whitespace or empty string')
404
+
405
+ kwargs = {}
406
+ if if_match is not None:
407
+ kwargs['if_match'] = if_match
408
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
409
+
410
+ _details = {}
411
+ _details['compartmentId'] = compartment_id
412
+
413
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
414
+ result = client.change_batch_task_environment_compartment(
415
+ batch_task_environment_id=batch_task_environment_id,
416
+ change_batch_task_environment_compartment_details=_details,
417
+ **kwargs
418
+ )
419
+ if wait_for_state:
420
+
421
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
422
+ try:
423
+ wait_period_kwargs = {}
424
+ if max_wait_seconds is not None:
425
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
426
+ if wait_interval_seconds is not None:
427
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
428
+ if 'opc-work-request-id' not in result.headers:
429
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
430
+ cli_util.render_response(result, ctx)
431
+ return
432
+
433
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
434
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
435
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
436
+ # If we fail, we should show an error, but we should still provide the information to the customer
437
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
438
+ cli_util.render_response(result, ctx)
439
+ sys.exit(2)
440
+ except Exception:
441
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
442
+ cli_util.render_response(result, ctx)
443
+ raise
444
+ else:
445
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
446
+ cli_util.render_response(result, ctx)
447
+
448
+
449
+ @batch_task_profile_group.command(name=cli_util.override('batch.change_batch_task_profile_compartment.command_name', 'change-compartment'), help=u"""Moves a batch task profile into a different compartment within the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment]. \n[Command Reference](changeBatchTaskProfileCompartment)""")
450
+ @cli_util.option('--batch-task-profile-id', required=True, help=u"""The [OCID] of the batch task profile.""")
451
+ @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the batch task profile to.""")
452
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
453
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
454
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
455
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
456
+ @json_skeleton_utils.get_cli_json_input_option({})
457
+ @cli_util.help_option
458
+ @click.pass_context
459
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
460
+ @cli_util.wrap_exceptions
461
+ def change_batch_task_profile_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_task_profile_id, compartment_id, if_match):
462
+
463
+ if isinstance(batch_task_profile_id, six.string_types) and len(batch_task_profile_id.strip()) == 0:
464
+ raise click.UsageError('Parameter --batch-task-profile-id cannot be whitespace or empty string')
465
+
466
+ kwargs = {}
467
+ if if_match is not None:
468
+ kwargs['if_match'] = if_match
469
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
470
+
471
+ _details = {}
472
+ _details['compartmentId'] = compartment_id
473
+
474
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
475
+ result = client.change_batch_task_profile_compartment(
476
+ batch_task_profile_id=batch_task_profile_id,
477
+ change_batch_task_profile_compartment_details=_details,
478
+ **kwargs
479
+ )
480
+ if wait_for_state:
481
+
482
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
483
+ try:
484
+ wait_period_kwargs = {}
485
+ if max_wait_seconds is not None:
486
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
487
+ if wait_interval_seconds is not None:
488
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
489
+ if 'opc-work-request-id' not in result.headers:
490
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
491
+ cli_util.render_response(result, ctx)
492
+ return
493
+
494
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
495
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
496
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
497
+ # If we fail, we should show an error, but we should still provide the information to the customer
498
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
499
+ cli_util.render_response(result, ctx)
500
+ sys.exit(2)
501
+ except Exception:
502
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
503
+ cli_util.render_response(result, ctx)
504
+ raise
505
+ else:
506
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
507
+ cli_util.render_response(result, ctx)
508
+
509
+
510
+ @batch_context_group.command(name=cli_util.override('batch.create_batch_context.command_name', 'create'), help=u"""Creates a batch context. \n[Command Reference](createBatchContext)""")
511
+ @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment.""")
512
+ @cli_util.option('--network', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
513
+ @cli_util.option('--fleets', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of fleet configurations related to the batch context.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
514
+ @cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. If not specified or provided as null or empty string, it will be generated as \"<resourceType><timeCreated>\", where timeCreated corresponds with the resource creation time in ISO 8601 basic format, i.e. omitting separating punctuation, at second-level precision and no UTC offset. Example: batchcontext20250914115623.""")
515
+ @cli_util.option('--description', help=u"""Summarized information about the batch context.""")
516
+ @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
517
+
518
+ Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
519
+ @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
520
+
521
+ Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
522
+ @cli_util.option('--job-priority-configurations', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of job priority configurations related to the batch context.
523
+
524
+ This option is a JSON list with items of type JobPriorityConfiguration. For documentation on JobPriorityConfiguration please see our API reference: https://docs.cloud.oracle.com/api/#/en/batchcomputing/20251031/datatypes/JobPriorityConfiguration.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
525
+ @cli_util.option('--entitlements', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Mapping of concurrent/shared resources used in job tasks to their limits.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
526
+ @cli_util.option('--logging-configuration', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
527
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
528
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
529
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
530
+ @json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}, 'job-priority-configurations': {'module': 'batch', 'class': 'list[JobPriorityConfiguration]'}, 'network': {'module': 'batch', 'class': 'CreateNetworkDetails'}, 'fleets': {'module': 'batch', 'class': 'list[CreateFleetDetails]'}, 'entitlements': {'module': 'batch', 'class': 'dict(str, integer)'}, 'logging-configuration': {'module': 'batch', 'class': 'LoggingConfiguration'}})
531
+ @cli_util.help_option
532
+ @click.pass_context
533
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}, 'job-priority-configurations': {'module': 'batch', 'class': 'list[JobPriorityConfiguration]'}, 'network': {'module': 'batch', 'class': 'CreateNetworkDetails'}, 'fleets': {'module': 'batch', 'class': 'list[CreateFleetDetails]'}, 'entitlements': {'module': 'batch', 'class': 'dict(str, integer)'}, 'logging-configuration': {'module': 'batch', 'class': 'LoggingConfiguration'}}, output_type={'module': 'batch', 'class': 'BatchContext'})
534
+ @cli_util.wrap_exceptions
535
+ def create_batch_context(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, network, fleets, display_name, description, freeform_tags, defined_tags, job_priority_configurations, entitlements, logging_configuration):
536
+
537
+ kwargs = {}
538
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
539
+
540
+ _details = {}
541
+ _details['compartmentId'] = compartment_id
542
+ _details['network'] = cli_util.parse_json_parameter("network", network)
543
+ _details['fleets'] = cli_util.parse_json_parameter("fleets", fleets)
544
+
545
+ if display_name is not None:
546
+ _details['displayName'] = display_name
547
+
548
+ if description is not None:
549
+ _details['description'] = description
550
+
551
+ if freeform_tags is not None:
552
+ _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
553
+
554
+ if defined_tags is not None:
555
+ _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
556
+
557
+ if job_priority_configurations is not None:
558
+ _details['jobPriorityConfigurations'] = cli_util.parse_json_parameter("job_priority_configurations", job_priority_configurations)
559
+
560
+ if entitlements is not None:
561
+ _details['entitlements'] = cli_util.parse_json_parameter("entitlements", entitlements)
562
+
563
+ if logging_configuration is not None:
564
+ _details['loggingConfiguration'] = cli_util.parse_json_parameter("logging_configuration", logging_configuration)
565
+
566
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
567
+ result = client.create_batch_context(
568
+ create_batch_context_details=_details,
569
+ **kwargs
570
+ )
571
+ if wait_for_state:
572
+
573
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
574
+ try:
575
+ wait_period_kwargs = {}
576
+ if max_wait_seconds is not None:
577
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
578
+ if wait_interval_seconds is not None:
579
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
580
+ if 'opc-work-request-id' not in result.headers:
581
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
582
+ cli_util.render_response(result, ctx)
583
+ return
584
+
585
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
586
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
587
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
588
+ # If we fail, we should show an error, but we should still provide the information to the customer
589
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
590
+ cli_util.render_response(result, ctx)
591
+ sys.exit(2)
592
+ except Exception:
593
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
594
+ cli_util.render_response(result, ctx)
595
+ raise
596
+ else:
597
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
598
+ cli_util.render_response(result, ctx)
599
+
600
+
601
+ @batch_context_group.command(name=cli_util.override('batch.create_batch_context_oci_logging_configuration.command_name', 'create-batch-context-oci-logging-configuration'), help=u"""Creates a batch context. \n[Command Reference](createBatchContext)""")
602
+ @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment.""")
603
+ @cli_util.option('--network', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
604
+ @cli_util.option('--fleets', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of fleet configurations related to the batch context.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
605
+ @cli_util.option('--logging-configuration-log-group-id', required=True, help=u"""The [OCID] of the log group.""")
606
+ @cli_util.option('--logging-configuration-log-id', required=True, help=u"""The [OCID] of the log.""")
607
+ @cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. If not specified or provided as null or empty string, it will be generated as \"<resourceType><timeCreated>\", where timeCreated corresponds with the resource creation time in ISO 8601 basic format, i.e. omitting separating punctuation, at second-level precision and no UTC offset. Example: batchcontext20250914115623.""")
608
+ @cli_util.option('--description', help=u"""Summarized information about the batch context.""")
609
+ @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
610
+
611
+ Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
612
+ @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
613
+
614
+ Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
615
+ @cli_util.option('--job-priority-configurations', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of job priority configurations related to the batch context.
616
+
617
+ This option is a JSON list with items of type JobPriorityConfiguration. For documentation on JobPriorityConfiguration please see our API reference: https://docs.cloud.oracle.com/api/#/en/batchcomputing/20251031/datatypes/JobPriorityConfiguration.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
618
+ @cli_util.option('--entitlements', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Mapping of concurrent/shared resources used in job tasks to their limits.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
619
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
620
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
621
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
622
+ @json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}, 'job-priority-configurations': {'module': 'batch', 'class': 'list[JobPriorityConfiguration]'}, 'network': {'module': 'batch', 'class': 'CreateNetworkDetails'}, 'fleets': {'module': 'batch', 'class': 'list[CreateFleetDetails]'}, 'entitlements': {'module': 'batch', 'class': 'dict(str, integer)'}})
623
+ @cli_util.help_option
624
+ @click.pass_context
625
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}, 'job-priority-configurations': {'module': 'batch', 'class': 'list[JobPriorityConfiguration]'}, 'network': {'module': 'batch', 'class': 'CreateNetworkDetails'}, 'fleets': {'module': 'batch', 'class': 'list[CreateFleetDetails]'}, 'entitlements': {'module': 'batch', 'class': 'dict(str, integer)'}}, output_type={'module': 'batch', 'class': 'BatchContext'})
626
+ @cli_util.wrap_exceptions
627
+ def create_batch_context_oci_logging_configuration(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, network, fleets, logging_configuration_log_group_id, logging_configuration_log_id, display_name, description, freeform_tags, defined_tags, job_priority_configurations, entitlements):
628
+
629
+ kwargs = {}
630
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
631
+
632
+ _details = {}
633
+ _details['loggingConfiguration'] = {}
634
+ _details['compartmentId'] = compartment_id
635
+ _details['network'] = cli_util.parse_json_parameter("network", network)
636
+ _details['fleets'] = cli_util.parse_json_parameter("fleets", fleets)
637
+ _details['loggingConfiguration']['logGroupId'] = logging_configuration_log_group_id
638
+ _details['loggingConfiguration']['logId'] = logging_configuration_log_id
639
+
640
+ if display_name is not None:
641
+ _details['displayName'] = display_name
642
+
643
+ if description is not None:
644
+ _details['description'] = description
645
+
646
+ if freeform_tags is not None:
647
+ _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
648
+
649
+ if defined_tags is not None:
650
+ _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
651
+
652
+ if job_priority_configurations is not None:
653
+ _details['jobPriorityConfigurations'] = cli_util.parse_json_parameter("job_priority_configurations", job_priority_configurations)
654
+
655
+ if entitlements is not None:
656
+ _details['entitlements'] = cli_util.parse_json_parameter("entitlements", entitlements)
657
+
658
+ _details['loggingConfiguration']['type'] = 'OCI_LOGGING'
659
+
660
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
661
+ result = client.create_batch_context(
662
+ create_batch_context_details=_details,
663
+ **kwargs
664
+ )
665
+ if wait_for_state:
666
+
667
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
668
+ try:
669
+ wait_period_kwargs = {}
670
+ if max_wait_seconds is not None:
671
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
672
+ if wait_interval_seconds is not None:
673
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
674
+ if 'opc-work-request-id' not in result.headers:
675
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
676
+ cli_util.render_response(result, ctx)
677
+ return
678
+
679
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
680
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
681
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
682
+ # If we fail, we should show an error, but we should still provide the information to the customer
683
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
684
+ cli_util.render_response(result, ctx)
685
+ sys.exit(2)
686
+ except Exception:
687
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
688
+ cli_util.render_response(result, ctx)
689
+ raise
690
+ else:
691
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
692
+ cli_util.render_response(result, ctx)
693
+
694
+
695
+ @batch_job_group.command(name=cli_util.override('batch.create_batch_job.command_name', 'create'), help=u"""Creates a batch job. \n[Command Reference](createBatchJob)""")
696
+ @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment.""")
697
+ @cli_util.option('--batch-job-pool-id', required=True, help=u"""The [OCID] of the parent batch job pool.""")
698
+ @cli_util.option('--tasks', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of tasks to be executed within this job. Maximum number of tasks a job can have in total, across all nested levels, is 1000.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
699
+ @cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. If not specified or provided as null or empty string, it will be generated as \"<resourceType><timeCreated>\", where timeCreated corresponds with the resource creation time in ISO 8601 basic format, i.e. omitting separating punctuation, at second-level precision and no UTC offset. Example: batchjob20250914115623.""")
700
+ @cli_util.option('--description', help=u"""An optional description that provides additional context next to the displayName.""")
701
+ @cli_util.option('--environment-variables', type=custom_types.CLI_COMPLEX_TYPE, help=u"""An environment variables to use for the job's tasks (can be overridden by task's environment variables).
702
+
703
+ This option is a JSON list with items of type EnvironmentVariable. For documentation on EnvironmentVariable please see our API reference: https://docs.cloud.oracle.com/api/#/en/batchcomputing/20251031/datatypes/EnvironmentVariable.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
704
+ @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
705
+
706
+ Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
707
+ @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
708
+
709
+ Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
710
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
711
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
712
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
713
+ @json_skeleton_utils.get_cli_json_input_option({'environment-variables': {'module': 'batch', 'class': 'list[EnvironmentVariable]'}, 'tasks': {'module': 'batch', 'class': 'list[CreateBatchTaskDetails]'}, 'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}})
714
+ @cli_util.help_option
715
+ @click.pass_context
716
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'environment-variables': {'module': 'batch', 'class': 'list[EnvironmentVariable]'}, 'tasks': {'module': 'batch', 'class': 'list[CreateBatchTaskDetails]'}, 'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'batch', 'class': 'BatchJob'})
717
+ @cli_util.wrap_exceptions
718
+ def create_batch_job(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, batch_job_pool_id, tasks, display_name, description, environment_variables, freeform_tags, defined_tags):
719
+
720
+ kwargs = {}
721
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
722
+
723
+ _details = {}
724
+ _details['compartmentId'] = compartment_id
725
+ _details['batchJobPoolId'] = batch_job_pool_id
726
+ _details['tasks'] = cli_util.parse_json_parameter("tasks", tasks)
727
+
728
+ if display_name is not None:
729
+ _details['displayName'] = display_name
730
+
731
+ if description is not None:
732
+ _details['description'] = description
733
+
734
+ if environment_variables is not None:
735
+ _details['environmentVariables'] = cli_util.parse_json_parameter("environment_variables", environment_variables)
736
+
737
+ if freeform_tags is not None:
738
+ _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
739
+
740
+ if defined_tags is not None:
741
+ _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
742
+
743
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
744
+ result = client.create_batch_job(
745
+ create_batch_job_details=_details,
746
+ **kwargs
747
+ )
748
+ if wait_for_state:
749
+
750
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
751
+ try:
752
+ wait_period_kwargs = {}
753
+ if max_wait_seconds is not None:
754
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
755
+ if wait_interval_seconds is not None:
756
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
757
+ if 'opc-work-request-id' not in result.headers:
758
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
759
+ cli_util.render_response(result, ctx)
760
+ return
761
+
762
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
763
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
764
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
765
+ # If we fail, we should show an error, but we should still provide the information to the customer
766
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
767
+ cli_util.render_response(result, ctx)
768
+ sys.exit(2)
769
+ except Exception:
770
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
771
+ cli_util.render_response(result, ctx)
772
+ raise
773
+ else:
774
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
775
+ cli_util.render_response(result, ctx)
776
+
777
+
778
+ @batch_job_pool_group.command(name=cli_util.override('batch.create_batch_job_pool.command_name', 'create'), help=u"""Creates a batch job pool. \n[Command Reference](createBatchJobPool)""")
779
+ @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment.""")
780
+ @cli_util.option('--batch-context-id', required=True, help=u"""The OCID of batch context.""")
781
+ @cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. If not specified or provided as null or empty string, it be generated as \"<resourceType><timeCreated>\", where timeCreated corresponds with the resource creation time in ISO 8601 basic format, i.e. omitting separating punctuation, at second-level precision and no UTC offset. Example: batchjobpool20250914115623.""")
782
+ @cli_util.option('--description', help=u"""Summarized information about the batch job pool.""")
783
+ @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
784
+
785
+ Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
786
+ @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
787
+
788
+ Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
789
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE", "UPDATING", "NEEDS_ATTENTION", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
790
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
791
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
792
+ @json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}})
793
+ @cli_util.help_option
794
+ @click.pass_context
795
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'batch', 'class': 'BatchJobPool'})
796
+ @cli_util.wrap_exceptions
797
+ def create_batch_job_pool(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, batch_context_id, display_name, description, freeform_tags, defined_tags):
798
+
799
+ kwargs = {}
800
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
801
+
802
+ _details = {}
803
+ _details['compartmentId'] = compartment_id
804
+ _details['batchContextId'] = batch_context_id
805
+
806
+ if display_name is not None:
807
+ _details['displayName'] = display_name
808
+
809
+ if description is not None:
810
+ _details['description'] = description
811
+
812
+ if freeform_tags is not None:
813
+ _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
814
+
815
+ if defined_tags is not None:
816
+ _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
817
+
818
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
819
+ result = client.create_batch_job_pool(
820
+ create_batch_job_pool_details=_details,
821
+ **kwargs
822
+ )
823
+ if wait_for_state:
824
+
825
+ if hasattr(client, 'get_batch_job_pool') and callable(getattr(client, 'get_batch_job_pool')):
826
+ try:
827
+ wait_period_kwargs = {}
828
+ if max_wait_seconds is not None:
829
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
830
+ if wait_interval_seconds is not None:
831
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
832
+
833
+ click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
834
+ result = oci.wait_until(client, client.get_batch_job_pool(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs)
835
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
836
+ # If we fail, we should show an error, but we should still provide the information to the customer
837
+ click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr)
838
+ cli_util.render_response(result, ctx)
839
+ sys.exit(2)
840
+ except Exception:
841
+ click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
842
+ cli_util.render_response(result, ctx)
843
+ raise
844
+ else:
845
+ click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
846
+ cli_util.render_response(result, ctx)
847
+
848
+
849
+ @batch_task_environment_group.command(name=cli_util.override('batch.create_batch_task_environment.command_name', 'create'), help=u"""Creates a batch task environment. \n[Command Reference](createBatchTaskEnvironment)""")
850
+ @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment.""")
851
+ @cli_util.option('--image-url', required=True, help=u"""The URL of the ocir image.""")
852
+ @cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. If not specified or provided as null or empty string, it be generated as \"<resourceType><timeCreated>\", where timeCreated corresponds with the resource creation time in ISO 8601 basic format, i.e. omitting separating punctuation, at second-level precision and no UTC offset. Example: batchtaskenvironment20250914115623.""")
853
+ @cli_util.option('--description', help=u"""The batch task environment description.""")
854
+ @cli_util.option('--security-context', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
855
+ @cli_util.option('--working-directory', help=u"""Container's working directory.""")
856
+ @cli_util.option('--volumes', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of volumes attached to the image. The use cases of the volumes are but not limited to: read the input of the task and write the output.
857
+
858
+ This option is a JSON list with items of type BatchTaskEnvironmentVolume. For documentation on BatchTaskEnvironmentVolume please see our API reference: https://docs.cloud.oracle.com/api/#/en/batchcomputing/20251031/datatypes/BatchTaskEnvironmentVolume.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
859
+ @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
860
+
861
+ Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
862
+ @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
863
+
864
+ Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
865
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
866
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
867
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
868
+ @json_skeleton_utils.get_cli_json_input_option({'security-context': {'module': 'batch', 'class': 'SecurityContext'}, 'volumes': {'module': 'batch', 'class': 'list[BatchTaskEnvironmentVolume]'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}})
869
+ @cli_util.help_option
870
+ @click.pass_context
871
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'security-context': {'module': 'batch', 'class': 'SecurityContext'}, 'volumes': {'module': 'batch', 'class': 'list[BatchTaskEnvironmentVolume]'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}}, output_type={'module': 'batch', 'class': 'BatchTaskEnvironment'})
872
+ @cli_util.wrap_exceptions
873
+ def create_batch_task_environment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, image_url, display_name, description, security_context, working_directory, volumes, defined_tags, freeform_tags):
874
+
875
+ kwargs = {}
876
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
877
+
878
+ _details = {}
879
+ _details['compartmentId'] = compartment_id
880
+ _details['imageUrl'] = image_url
881
+
882
+ if display_name is not None:
883
+ _details['displayName'] = display_name
884
+
885
+ if description is not None:
886
+ _details['description'] = description
887
+
888
+ if security_context is not None:
889
+ _details['securityContext'] = cli_util.parse_json_parameter("security_context", security_context)
890
+
891
+ if working_directory is not None:
892
+ _details['workingDirectory'] = working_directory
893
+
894
+ if volumes is not None:
895
+ _details['volumes'] = cli_util.parse_json_parameter("volumes", volumes)
896
+
897
+ if defined_tags is not None:
898
+ _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
899
+
900
+ if freeform_tags is not None:
901
+ _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
902
+
903
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
904
+ result = client.create_batch_task_environment(
905
+ create_batch_task_environment_details=_details,
906
+ **kwargs
907
+ )
908
+ if wait_for_state:
909
+
910
+ if hasattr(client, 'get_batch_task_environment') and callable(getattr(client, 'get_batch_task_environment')):
911
+ try:
912
+ wait_period_kwargs = {}
913
+ if max_wait_seconds is not None:
914
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
915
+ if wait_interval_seconds is not None:
916
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
917
+
918
+ click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
919
+ result = oci.wait_until(client, client.get_batch_task_environment(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs)
920
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
921
+ # If we fail, we should show an error, but we should still provide the information to the customer
922
+ click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr)
923
+ cli_util.render_response(result, ctx)
924
+ sys.exit(2)
925
+ except Exception:
926
+ click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
927
+ cli_util.render_response(result, ctx)
928
+ raise
929
+ else:
930
+ click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
931
+ cli_util.render_response(result, ctx)
932
+
933
+
934
+ @batch_task_profile_group.command(name=cli_util.override('batch.create_batch_task_profile.command_name', 'create'), help=u"""Creates a batch task profile. \n[Command Reference](createBatchTaskProfile)""")
935
+ @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment.""")
936
+ @cli_util.option('--min-ocpus', required=True, type=click.INT, help=u"""The minimum required OCPUs.""")
937
+ @cli_util.option('--min-memory-in-gbs', required=True, type=click.INT, help=u"""The minimum required memory.""")
938
+ @cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. If not specified or provided as null or empty string, it be generated as \"<resourceType><timeCreated>\", where timeCreated corresponds with the resource creation time in ISO 8601 basic format, i.e. omitting separating punctuation, at second-level precision and no UTC offset. Example: batchtaskprofile20250914115623.""")
939
+ @cli_util.option('--description', help=u"""The batch task profile description.""")
940
+ @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
941
+
942
+ Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
943
+ @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
944
+
945
+ Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
946
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
947
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
948
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
949
+ @json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}})
950
+ @cli_util.help_option
951
+ @click.pass_context
952
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}}, output_type={'module': 'batch', 'class': 'BatchTaskProfile'})
953
+ @cli_util.wrap_exceptions
954
+ def create_batch_task_profile(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, min_ocpus, min_memory_in_gbs, display_name, description, defined_tags, freeform_tags):
955
+
956
+ kwargs = {}
957
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
958
+
959
+ _details = {}
960
+ _details['compartmentId'] = compartment_id
961
+ _details['minOcpus'] = min_ocpus
962
+ _details['minMemoryInGBs'] = min_memory_in_gbs
963
+
964
+ if display_name is not None:
965
+ _details['displayName'] = display_name
966
+
967
+ if description is not None:
968
+ _details['description'] = description
969
+
970
+ if defined_tags is not None:
971
+ _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
972
+
973
+ if freeform_tags is not None:
974
+ _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
975
+
976
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
977
+ result = client.create_batch_task_profile(
978
+ create_batch_task_profile_details=_details,
979
+ **kwargs
980
+ )
981
+ if wait_for_state:
982
+
983
+ if hasattr(client, 'get_batch_task_profile') and callable(getattr(client, 'get_batch_task_profile')):
984
+ try:
985
+ wait_period_kwargs = {}
986
+ if max_wait_seconds is not None:
987
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
988
+ if wait_interval_seconds is not None:
989
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
990
+
991
+ click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
992
+ result = oci.wait_until(client, client.get_batch_task_profile(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs)
993
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
994
+ # If we fail, we should show an error, but we should still provide the information to the customer
995
+ click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr)
996
+ cli_util.render_response(result, ctx)
997
+ sys.exit(2)
998
+ except Exception:
999
+ click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
1000
+ cli_util.render_response(result, ctx)
1001
+ raise
1002
+ else:
1003
+ click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
1004
+ cli_util.render_response(result, ctx)
1005
+
1006
+
1007
+ @batch_context_group.command(name=cli_util.override('batch.delete_batch_context.command_name', 'delete'), help=u"""Deletes a batch context. All batch job pools associated with the batch context must be deleted beforehand. \n[Command Reference](deleteBatchContext)""")
1008
+ @cli_util.option('--batch-context-id', required=True, help=u"""The [OCID] of the batch context.""")
1009
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
1010
+ @cli_util.confirm_delete_option
1011
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
1012
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
1013
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
1014
+ @json_skeleton_utils.get_cli_json_input_option({})
1015
+ @cli_util.help_option
1016
+ @click.pass_context
1017
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
1018
+ @cli_util.wrap_exceptions
1019
+ def delete_batch_context(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_context_id, if_match):
1020
+
1021
+ if isinstance(batch_context_id, six.string_types) and len(batch_context_id.strip()) == 0:
1022
+ raise click.UsageError('Parameter --batch-context-id cannot be whitespace or empty string')
1023
+
1024
+ kwargs = {}
1025
+ if if_match is not None:
1026
+ kwargs['if_match'] = if_match
1027
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1028
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1029
+ result = client.delete_batch_context(
1030
+ batch_context_id=batch_context_id,
1031
+ **kwargs
1032
+ )
1033
+ if wait_for_state:
1034
+
1035
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
1036
+ try:
1037
+ wait_period_kwargs = {}
1038
+ if max_wait_seconds is not None:
1039
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
1040
+ if wait_interval_seconds is not None:
1041
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
1042
+ if 'opc-work-request-id' not in result.headers:
1043
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
1044
+ cli_util.render_response(result, ctx)
1045
+ return
1046
+
1047
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
1048
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
1049
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
1050
+ # If we fail, we should show an error, but we should still provide the information to the customer
1051
+ click.echo('Failed to wait until the work request entered the specified state. Please retrieve the work request to find its current state', file=sys.stderr)
1052
+ cli_util.render_response(result, ctx)
1053
+ sys.exit(2)
1054
+ except Exception:
1055
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
1056
+ cli_util.render_response(result, ctx)
1057
+ raise
1058
+ else:
1059
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
1060
+ cli_util.render_response(result, ctx)
1061
+
1062
+
1063
+ @batch_job_pool_group.command(name=cli_util.override('batch.delete_batch_job_pool.command_name', 'delete'), help=u"""Deletes a batch job pool. All batch jobs associated with the batch job pool must be canceled beforehand. \n[Command Reference](deleteBatchJobPool)""")
1064
+ @cli_util.option('--batch-job-pool-id', required=True, help=u"""The [OCID] of the batch job pool.""")
1065
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
1066
+ @cli_util.confirm_delete_option
1067
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE", "UPDATING", "NEEDS_ATTENTION", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
1068
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
1069
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
1070
+ @json_skeleton_utils.get_cli_json_input_option({})
1071
+ @cli_util.help_option
1072
+ @click.pass_context
1073
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
1074
+ @cli_util.wrap_exceptions
1075
+ def delete_batch_job_pool(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_job_pool_id, if_match):
1076
+
1077
+ if isinstance(batch_job_pool_id, six.string_types) and len(batch_job_pool_id.strip()) == 0:
1078
+ raise click.UsageError('Parameter --batch-job-pool-id cannot be whitespace or empty string')
1079
+
1080
+ kwargs = {}
1081
+ if if_match is not None:
1082
+ kwargs['if_match'] = if_match
1083
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1084
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1085
+ result = client.delete_batch_job_pool(
1086
+ batch_job_pool_id=batch_job_pool_id,
1087
+ **kwargs
1088
+ )
1089
+ if wait_for_state:
1090
+
1091
+ if hasattr(client, 'get_batch_job_pool') and callable(getattr(client, 'get_batch_job_pool')):
1092
+ try:
1093
+ wait_period_kwargs = {}
1094
+ if max_wait_seconds is not None:
1095
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
1096
+ if wait_interval_seconds is not None:
1097
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
1098
+
1099
+ click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
1100
+ oci.wait_until(client, client.get_batch_job_pool(batch_job_pool_id), 'lifecycle_state', wait_for_state, succeed_on_not_found=True, **wait_period_kwargs)
1101
+ except oci.exceptions.ServiceError as e:
1102
+ # We make an initial service call so we can pass the result to oci.wait_until(), however if we are waiting on the
1103
+ # outcome of a delete operation it is possible that the resource is already gone and so the initial service call
1104
+ # will result in an exception that reflects a HTTP 404. In this case, we can exit with success (rather than raising
1105
+ # the exception) since this would have been the behaviour in the waiter anyway (as for delete we provide the argument
1106
+ # succeed_on_not_found=True to the waiter).
1107
+ #
1108
+ # Any non-404 should still result in the exception being thrown.
1109
+ if e.status == 404:
1110
+ pass
1111
+ else:
1112
+ raise
1113
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
1114
+ # If we fail, we should show an error, but we should still provide the information to the customer
1115
+ click.echo('Failed to wait until the resource entered the specified state. Please retrieve the resource to find its current state', file=sys.stderr)
1116
+ cli_util.render_response(result, ctx)
1117
+ sys.exit(2)
1118
+ except Exception:
1119
+ click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
1120
+ cli_util.render_response(result, ctx)
1121
+ raise
1122
+ else:
1123
+ click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
1124
+ cli_util.render_response(result, ctx)
1125
+
1126
+
1127
+ @batch_task_environment_group.command(name=cli_util.override('batch.delete_batch_task_environment.command_name', 'delete'), help=u"""Deletes a batch task environment. All batch tasks associated with the batch task environment must be canceled beforehand. \n[Command Reference](deleteBatchTaskEnvironment)""")
1128
+ @cli_util.option('--batch-task-environment-id', required=True, help=u"""The [OCID] of the batch task environment.""")
1129
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
1130
+ @cli_util.confirm_delete_option
1131
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
1132
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
1133
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
1134
+ @json_skeleton_utils.get_cli_json_input_option({})
1135
+ @cli_util.help_option
1136
+ @click.pass_context
1137
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
1138
+ @cli_util.wrap_exceptions
1139
+ def delete_batch_task_environment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_task_environment_id, if_match):
1140
+
1141
+ if isinstance(batch_task_environment_id, six.string_types) and len(batch_task_environment_id.strip()) == 0:
1142
+ raise click.UsageError('Parameter --batch-task-environment-id cannot be whitespace or empty string')
1143
+
1144
+ kwargs = {}
1145
+ if if_match is not None:
1146
+ kwargs['if_match'] = if_match
1147
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1148
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1149
+ result = client.delete_batch_task_environment(
1150
+ batch_task_environment_id=batch_task_environment_id,
1151
+ **kwargs
1152
+ )
1153
+ if wait_for_state:
1154
+
1155
+ if hasattr(client, 'get_batch_task_environment') and callable(getattr(client, 'get_batch_task_environment')):
1156
+ try:
1157
+ wait_period_kwargs = {}
1158
+ if max_wait_seconds is not None:
1159
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
1160
+ if wait_interval_seconds is not None:
1161
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
1162
+
1163
+ click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
1164
+ oci.wait_until(client, client.get_batch_task_environment(batch_task_environment_id), 'lifecycle_state', wait_for_state, succeed_on_not_found=True, **wait_period_kwargs)
1165
+ except oci.exceptions.ServiceError as e:
1166
+ # We make an initial service call so we can pass the result to oci.wait_until(), however if we are waiting on the
1167
+ # outcome of a delete operation it is possible that the resource is already gone and so the initial service call
1168
+ # will result in an exception that reflects a HTTP 404. In this case, we can exit with success (rather than raising
1169
+ # the exception) since this would have been the behaviour in the waiter anyway (as for delete we provide the argument
1170
+ # succeed_on_not_found=True to the waiter).
1171
+ #
1172
+ # Any non-404 should still result in the exception being thrown.
1173
+ if e.status == 404:
1174
+ pass
1175
+ else:
1176
+ raise
1177
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
1178
+ # If we fail, we should show an error, but we should still provide the information to the customer
1179
+ click.echo('Failed to wait until the resource entered the specified state. Please retrieve the resource to find its current state', file=sys.stderr)
1180
+ cli_util.render_response(result, ctx)
1181
+ sys.exit(2)
1182
+ except Exception:
1183
+ click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
1184
+ cli_util.render_response(result, ctx)
1185
+ raise
1186
+ else:
1187
+ click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
1188
+ cli_util.render_response(result, ctx)
1189
+
1190
+
1191
+ @batch_task_profile_group.command(name=cli_util.override('batch.delete_batch_task_profile.command_name', 'delete'), help=u"""Deletes a batch task profile. All batch tasks associated with the batch task profile must be canceled beforehand. \n[Command Reference](deleteBatchTaskProfile)""")
1192
+ @cli_util.option('--batch-task-profile-id', required=True, help=u"""The [OCID] of the batch task profile.""")
1193
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
1194
+ @cli_util.confirm_delete_option
1195
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
1196
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
1197
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
1198
+ @json_skeleton_utils.get_cli_json_input_option({})
1199
+ @cli_util.help_option
1200
+ @click.pass_context
1201
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
1202
+ @cli_util.wrap_exceptions
1203
+ def delete_batch_task_profile(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_task_profile_id, if_match):
1204
+
1205
+ if isinstance(batch_task_profile_id, six.string_types) and len(batch_task_profile_id.strip()) == 0:
1206
+ raise click.UsageError('Parameter --batch-task-profile-id cannot be whitespace or empty string')
1207
+
1208
+ kwargs = {}
1209
+ if if_match is not None:
1210
+ kwargs['if_match'] = if_match
1211
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1212
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1213
+ result = client.delete_batch_task_profile(
1214
+ batch_task_profile_id=batch_task_profile_id,
1215
+ **kwargs
1216
+ )
1217
+ if wait_for_state:
1218
+
1219
+ if hasattr(client, 'get_batch_task_profile') and callable(getattr(client, 'get_batch_task_profile')):
1220
+ try:
1221
+ wait_period_kwargs = {}
1222
+ if max_wait_seconds is not None:
1223
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
1224
+ if wait_interval_seconds is not None:
1225
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
1226
+
1227
+ click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
1228
+ oci.wait_until(client, client.get_batch_task_profile(batch_task_profile_id), 'lifecycle_state', wait_for_state, succeed_on_not_found=True, **wait_period_kwargs)
1229
+ except oci.exceptions.ServiceError as e:
1230
+ # We make an initial service call so we can pass the result to oci.wait_until(), however if we are waiting on the
1231
+ # outcome of a delete operation it is possible that the resource is already gone and so the initial service call
1232
+ # will result in an exception that reflects a HTTP 404. In this case, we can exit with success (rather than raising
1233
+ # the exception) since this would have been the behaviour in the waiter anyway (as for delete we provide the argument
1234
+ # succeed_on_not_found=True to the waiter).
1235
+ #
1236
+ # Any non-404 should still result in the exception being thrown.
1237
+ if e.status == 404:
1238
+ pass
1239
+ else:
1240
+ raise
1241
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
1242
+ # If we fail, we should show an error, but we should still provide the information to the customer
1243
+ click.echo('Failed to wait until the resource entered the specified state. Please retrieve the resource to find its current state', file=sys.stderr)
1244
+ cli_util.render_response(result, ctx)
1245
+ sys.exit(2)
1246
+ except Exception:
1247
+ click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
1248
+ cli_util.render_response(result, ctx)
1249
+ raise
1250
+ else:
1251
+ click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
1252
+ cli_util.render_response(result, ctx)
1253
+
1254
+
1255
+ @batch_context_group.command(name=cli_util.override('batch.get_batch_context.command_name', 'get'), help=u"""Gets information about a batch context. \n[Command Reference](getBatchContext)""")
1256
+ @cli_util.option('--batch-context-id', required=True, help=u"""The [OCID] of the batch context.""")
1257
+ @json_skeleton_utils.get_cli_json_input_option({})
1258
+ @cli_util.help_option
1259
+ @click.pass_context
1260
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'BatchContext'})
1261
+ @cli_util.wrap_exceptions
1262
+ def get_batch_context(ctx, from_json, batch_context_id):
1263
+
1264
+ if isinstance(batch_context_id, six.string_types) and len(batch_context_id.strip()) == 0:
1265
+ raise click.UsageError('Parameter --batch-context-id cannot be whitespace or empty string')
1266
+
1267
+ kwargs = {}
1268
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1269
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1270
+ result = client.get_batch_context(
1271
+ batch_context_id=batch_context_id,
1272
+ **kwargs
1273
+ )
1274
+ cli_util.render_response(result, ctx)
1275
+
1276
+
1277
+ @batch_job_group.command(name=cli_util.override('batch.get_batch_job.command_name', 'get'), help=u"""Gets information about a batch job. \n[Command Reference](getBatchJob)""")
1278
+ @cli_util.option('--batch-job-id', required=True, help=u"""The [OCID] of the batch job.""")
1279
+ @json_skeleton_utils.get_cli_json_input_option({})
1280
+ @cli_util.help_option
1281
+ @click.pass_context
1282
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'BatchJob'})
1283
+ @cli_util.wrap_exceptions
1284
+ def get_batch_job(ctx, from_json, batch_job_id):
1285
+
1286
+ if isinstance(batch_job_id, six.string_types) and len(batch_job_id.strip()) == 0:
1287
+ raise click.UsageError('Parameter --batch-job-id cannot be whitespace or empty string')
1288
+
1289
+ kwargs = {}
1290
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1291
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1292
+ result = client.get_batch_job(
1293
+ batch_job_id=batch_job_id,
1294
+ **kwargs
1295
+ )
1296
+ cli_util.render_response(result, ctx)
1297
+
1298
+
1299
+ @batch_job_pool_group.command(name=cli_util.override('batch.get_batch_job_pool.command_name', 'get'), help=u"""Gets information about a batch job pool. \n[Command Reference](getBatchJobPool)""")
1300
+ @cli_util.option('--batch-job-pool-id', required=True, help=u"""The [OCID] of the batch job pool.""")
1301
+ @json_skeleton_utils.get_cli_json_input_option({})
1302
+ @cli_util.help_option
1303
+ @click.pass_context
1304
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'BatchJobPool'})
1305
+ @cli_util.wrap_exceptions
1306
+ def get_batch_job_pool(ctx, from_json, batch_job_pool_id):
1307
+
1308
+ if isinstance(batch_job_pool_id, six.string_types) and len(batch_job_pool_id.strip()) == 0:
1309
+ raise click.UsageError('Parameter --batch-job-pool-id cannot be whitespace or empty string')
1310
+
1311
+ kwargs = {}
1312
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1313
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1314
+ result = client.get_batch_job_pool(
1315
+ batch_job_pool_id=batch_job_pool_id,
1316
+ **kwargs
1317
+ )
1318
+ cli_util.render_response(result, ctx)
1319
+
1320
+
1321
+ @batch_task_group.command(name=cli_util.override('batch.get_batch_task.command_name', 'get'), help=u"""Gets a specific batch task associated with a batch job by its name. \n[Command Reference](getBatchTask)""")
1322
+ @cli_util.option('--batch-job-id', required=True, help=u"""The [OCID] of the batch job.""")
1323
+ @cli_util.option('--task-name', required=True, help=u"""The name of the batch task.""")
1324
+ @json_skeleton_utils.get_cli_json_input_option({})
1325
+ @cli_util.help_option
1326
+ @click.pass_context
1327
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'BatchTask'})
1328
+ @cli_util.wrap_exceptions
1329
+ def get_batch_task(ctx, from_json, batch_job_id, task_name):
1330
+
1331
+ if isinstance(batch_job_id, six.string_types) and len(batch_job_id.strip()) == 0:
1332
+ raise click.UsageError('Parameter --batch-job-id cannot be whitespace or empty string')
1333
+
1334
+ if isinstance(task_name, six.string_types) and len(task_name.strip()) == 0:
1335
+ raise click.UsageError('Parameter --task-name cannot be whitespace or empty string')
1336
+
1337
+ kwargs = {}
1338
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1339
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1340
+ result = client.get_batch_task(
1341
+ batch_job_id=batch_job_id,
1342
+ task_name=task_name,
1343
+ **kwargs
1344
+ )
1345
+ cli_util.render_response(result, ctx)
1346
+
1347
+
1348
+ @batch_task_environment_group.command(name=cli_util.override('batch.get_batch_task_environment.command_name', 'get'), help=u"""Gets information about a batch task environment. \n[Command Reference](getBatchTaskEnvironment)""")
1349
+ @cli_util.option('--batch-task-environment-id', required=True, help=u"""The [OCID] of the batch task environment.""")
1350
+ @json_skeleton_utils.get_cli_json_input_option({})
1351
+ @cli_util.help_option
1352
+ @click.pass_context
1353
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'BatchTaskEnvironment'})
1354
+ @cli_util.wrap_exceptions
1355
+ def get_batch_task_environment(ctx, from_json, batch_task_environment_id):
1356
+
1357
+ if isinstance(batch_task_environment_id, six.string_types) and len(batch_task_environment_id.strip()) == 0:
1358
+ raise click.UsageError('Parameter --batch-task-environment-id cannot be whitespace or empty string')
1359
+
1360
+ kwargs = {}
1361
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1362
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1363
+ result = client.get_batch_task_environment(
1364
+ batch_task_environment_id=batch_task_environment_id,
1365
+ **kwargs
1366
+ )
1367
+ cli_util.render_response(result, ctx)
1368
+
1369
+
1370
+ @batch_task_profile_group.command(name=cli_util.override('batch.get_batch_task_profile.command_name', 'get'), help=u"""Gets information about a batch task profile. \n[Command Reference](getBatchTaskProfile)""")
1371
+ @cli_util.option('--batch-task-profile-id', required=True, help=u"""The [OCID] of the batch task profile.""")
1372
+ @json_skeleton_utils.get_cli_json_input_option({})
1373
+ @cli_util.help_option
1374
+ @click.pass_context
1375
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'BatchTaskProfile'})
1376
+ @cli_util.wrap_exceptions
1377
+ def get_batch_task_profile(ctx, from_json, batch_task_profile_id):
1378
+
1379
+ if isinstance(batch_task_profile_id, six.string_types) and len(batch_task_profile_id.strip()) == 0:
1380
+ raise click.UsageError('Parameter --batch-task-profile-id cannot be whitespace or empty string')
1381
+
1382
+ kwargs = {}
1383
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1384
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1385
+ result = client.get_batch_task_profile(
1386
+ batch_task_profile_id=batch_task_profile_id,
1387
+ **kwargs
1388
+ )
1389
+ cli_util.render_response(result, ctx)
1390
+
1391
+
1392
+ @work_request_group.command(name=cli_util.override('batch.get_work_request.command_name', 'get'), help=u"""Gets the details of a work request. \n[Command Reference](getWorkRequest)""")
1393
+ @cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the asynchronous work request.""")
1394
+ @json_skeleton_utils.get_cli_json_input_option({})
1395
+ @cli_util.help_option
1396
+ @click.pass_context
1397
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'WorkRequest'})
1398
+ @cli_util.wrap_exceptions
1399
+ def get_work_request(ctx, from_json, work_request_id):
1400
+
1401
+ if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0:
1402
+ raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string')
1403
+
1404
+ kwargs = {}
1405
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1406
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1407
+ result = client.get_work_request(
1408
+ work_request_id=work_request_id,
1409
+ **kwargs
1410
+ )
1411
+ cli_util.render_response(result, ctx)
1412
+
1413
+
1414
+ @batch_context_shape_collection_group.command(name=cli_util.override('batch.list_batch_context_shapes.command_name', 'list-batch-context-shapes'), help=u"""Lists the shapes allowed to be specified during batch context creation. Ordered by the shape name. \n[Command Reference](listBatchContextShapes)""")
1415
+ @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""")
1416
+ @cli_util.option('--availability-domain', help=u"""The name of the availability domain.""")
1417
+ @cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination].""")
1418
+ @cli_util.option('--page', help=u"""For list pagination. The value of the opc-next-page response header from the previous \"List\" call. For important details about how pagination works, see [List Pagination].""")
1419
+ @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
1420
+ @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
1421
+ @json_skeleton_utils.get_cli_json_input_option({})
1422
+ @cli_util.help_option
1423
+ @click.pass_context
1424
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'BatchContextShapeCollection'})
1425
+ @cli_util.wrap_exceptions
1426
+ def list_batch_context_shapes(ctx, from_json, all_pages, page_size, compartment_id, availability_domain, limit, page):
1427
+
1428
+ if all_pages and limit:
1429
+ raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
1430
+
1431
+ kwargs = {}
1432
+ if availability_domain is not None:
1433
+ kwargs['availability_domain'] = availability_domain
1434
+ if limit is not None:
1435
+ kwargs['limit'] = limit
1436
+ if page is not None:
1437
+ kwargs['page'] = page
1438
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1439
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1440
+ if all_pages:
1441
+ if page_size:
1442
+ kwargs['limit'] = page_size
1443
+
1444
+ result = cli_util.list_call_get_all_results(
1445
+ client.list_batch_context_shapes,
1446
+ compartment_id=compartment_id,
1447
+ **kwargs
1448
+ )
1449
+ elif limit is not None:
1450
+ result = cli_util.list_call_get_up_to_limit(
1451
+ client.list_batch_context_shapes,
1452
+ limit,
1453
+ page_size,
1454
+ compartment_id=compartment_id,
1455
+ **kwargs
1456
+ )
1457
+ else:
1458
+ result = client.list_batch_context_shapes(
1459
+ compartment_id=compartment_id,
1460
+ **kwargs
1461
+ )
1462
+ cli_util.render_response(result, ctx)
1463
+
1464
+
1465
+ @batch_context_collection_group.command(name=cli_util.override('batch.list_batch_contexts.command_name', 'list-batch-contexts'), help=u"""Lists the batch contexts by compartment or context [OCID]. You can filter and sort them by various properties like lifecycle state, name and also ocid. All properties require an exact match. List operation only provides a summary information, use GetBatchContext to get the full details on a specific context \n[Command Reference](listBatchContexts)""")
1466
+ @cli_util.option('--compartment-id', help=u"""The [OCID] of the compartment in which to list resources.""")
1467
+ @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "NEEDS_ATTENTION", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return only resources that match the given lifecycle state. The state value is case-insensitive.""")
1468
+ @cli_util.option('--display-name', help=u"""A filter to return only resources that match the given display name exactly.""")
1469
+ @cli_util.option('--id', help=u"""The [OCID] of the batch context.""")
1470
+ @cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination].""")
1471
+ @cli_util.option('--page', help=u"""For list pagination. The value of the opc-next-page response header from the previous \"List\" call. For important details about how pagination works, see [List Pagination].""")
1472
+ @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (`ASC`) or descending (`DESC`).""")
1473
+ @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. You can provide only one sort order. Default order for `timeCreated` is descending. Default order for `displayName` is ascending.""")
1474
+ @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
1475
+ @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
1476
+ @json_skeleton_utils.get_cli_json_input_option({})
1477
+ @cli_util.help_option
1478
+ @click.pass_context
1479
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'BatchContextCollection'})
1480
+ @cli_util.wrap_exceptions
1481
+ def list_batch_contexts(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, id, limit, page, sort_order, sort_by):
1482
+
1483
+ if all_pages and limit:
1484
+ raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
1485
+
1486
+ kwargs = {}
1487
+ if compartment_id is not None:
1488
+ kwargs['compartment_id'] = compartment_id
1489
+ if lifecycle_state is not None:
1490
+ kwargs['lifecycle_state'] = lifecycle_state
1491
+ if display_name is not None:
1492
+ kwargs['display_name'] = display_name
1493
+ if id is not None:
1494
+ kwargs['id'] = id
1495
+ if limit is not None:
1496
+ kwargs['limit'] = limit
1497
+ if page is not None:
1498
+ kwargs['page'] = page
1499
+ if sort_order is not None:
1500
+ kwargs['sort_order'] = sort_order
1501
+ if sort_by is not None:
1502
+ kwargs['sort_by'] = sort_by
1503
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1504
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1505
+ if all_pages:
1506
+ if page_size:
1507
+ kwargs['limit'] = page_size
1508
+
1509
+ result = cli_util.list_call_get_all_results(
1510
+ client.list_batch_contexts,
1511
+ **kwargs
1512
+ )
1513
+ elif limit is not None:
1514
+ result = cli_util.list_call_get_up_to_limit(
1515
+ client.list_batch_contexts,
1516
+ limit,
1517
+ page_size,
1518
+ **kwargs
1519
+ )
1520
+ else:
1521
+ result = client.list_batch_contexts(
1522
+ **kwargs
1523
+ )
1524
+ cli_util.render_response(result, ctx)
1525
+
1526
+
1527
+ @batch_job_pool_collection_group.command(name=cli_util.override('batch.list_batch_job_pools.command_name', 'list-batch-job-pools'), help=u"""Lists the batch job pools by compartment or job pool [OCID]. You can filter and sort them by various properties like lifecycle state, display name and also ocid. All properties require an exact match. List operation only provides a summary information, use GetBatchJobPool to get the full details on a specific context \n[Command Reference](listBatchJobPools)""")
1528
+ @cli_util.option('--compartment-id', help=u"""The [OCID] of the compartment in which to list resources.""")
1529
+ @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE", "UPDATING", "NEEDS_ATTENTION", "DELETED"]), help=u"""A filter to return only resources that match the given lifecycle state. The state value is case-insensitive.""")
1530
+ @cli_util.option('--display-name', help=u"""A filter to return only resources that match the given display name exactly.""")
1531
+ @cli_util.option('--id', help=u"""The [OCID] of the batch job pool.""")
1532
+ @cli_util.option('--batch-context-id', help=u"""The [OCID] of the batch context.""")
1533
+ @cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination].""")
1534
+ @cli_util.option('--page', help=u"""For list pagination. The value of the opc-next-page response header from the previous \"List\" call. For important details about how pagination works, see [List Pagination].""")
1535
+ @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (`ASC`) or descending (`DESC`).""")
1536
+ @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. You can provide only one sort order. Default order for `timeCreated` is descending. Default order for `displayName` is ascending.""")
1537
+ @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
1538
+ @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
1539
+ @json_skeleton_utils.get_cli_json_input_option({})
1540
+ @cli_util.help_option
1541
+ @click.pass_context
1542
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'BatchJobPoolCollection'})
1543
+ @cli_util.wrap_exceptions
1544
+ def list_batch_job_pools(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, id, batch_context_id, limit, page, sort_order, sort_by):
1545
+
1546
+ if all_pages and limit:
1547
+ raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
1548
+
1549
+ kwargs = {}
1550
+ if compartment_id is not None:
1551
+ kwargs['compartment_id'] = compartment_id
1552
+ if lifecycle_state is not None:
1553
+ kwargs['lifecycle_state'] = lifecycle_state
1554
+ if display_name is not None:
1555
+ kwargs['display_name'] = display_name
1556
+ if id is not None:
1557
+ kwargs['id'] = id
1558
+ if batch_context_id is not None:
1559
+ kwargs['batch_context_id'] = batch_context_id
1560
+ if limit is not None:
1561
+ kwargs['limit'] = limit
1562
+ if page is not None:
1563
+ kwargs['page'] = page
1564
+ if sort_order is not None:
1565
+ kwargs['sort_order'] = sort_order
1566
+ if sort_by is not None:
1567
+ kwargs['sort_by'] = sort_by
1568
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1569
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1570
+ if all_pages:
1571
+ if page_size:
1572
+ kwargs['limit'] = page_size
1573
+
1574
+ result = cli_util.list_call_get_all_results(
1575
+ client.list_batch_job_pools,
1576
+ **kwargs
1577
+ )
1578
+ elif limit is not None:
1579
+ result = cli_util.list_call_get_up_to_limit(
1580
+ client.list_batch_job_pools,
1581
+ limit,
1582
+ page_size,
1583
+ **kwargs
1584
+ )
1585
+ else:
1586
+ result = client.list_batch_job_pools(
1587
+ **kwargs
1588
+ )
1589
+ cli_util.render_response(result, ctx)
1590
+
1591
+
1592
+ @batch_task_collection_group.command(name=cli_util.override('batch.list_batch_job_tasks.command_name', 'list-batch-job-tasks'), help=u"""Lists the batch tasks by batch job [OCID]. You can filter and sort them by various properties like lifecycle state, name and also ocid. All properties require an exact match. List operation only provides a summary information, use GetBatchTask to get the full details on a specific context List is incomplete until jobs lifecycle is in_progress \n[Command Reference](listBatchJobTasks)""")
1593
+ @cli_util.option('--batch-job-id', required=True, help=u"""The [OCID] of the batch job.""")
1594
+ @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "WAITING", "IN_PROGRESS", "SUCCEEDED", "FAILED", "CANCELING", "CANCELED"]), help=u"""A filter to return only resources that match the given lifecycle state. The state value is case-insensitive.""")
1595
+ @cli_util.option('--name', help=u"""The name of the task.""")
1596
+ @cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination].""")
1597
+ @cli_util.option('--page', help=u"""For list pagination. The value of the opc-next-page response header from the previous \"List\" call. For important details about how pagination works, see [List Pagination].""")
1598
+ @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (`ASC`) or descending (`DESC`).""")
1599
+ @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["name"]), help=u"""The field to sort by. You can provide only one sort order. Default order for `name` is ascending.""")
1600
+ @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
1601
+ @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
1602
+ @json_skeleton_utils.get_cli_json_input_option({})
1603
+ @cli_util.help_option
1604
+ @click.pass_context
1605
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'BatchTaskCollection'})
1606
+ @cli_util.wrap_exceptions
1607
+ def list_batch_job_tasks(ctx, from_json, all_pages, page_size, batch_job_id, lifecycle_state, name, limit, page, sort_order, sort_by):
1608
+
1609
+ if all_pages and limit:
1610
+ raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
1611
+
1612
+ if isinstance(batch_job_id, six.string_types) and len(batch_job_id.strip()) == 0:
1613
+ raise click.UsageError('Parameter --batch-job-id cannot be whitespace or empty string')
1614
+
1615
+ kwargs = {}
1616
+ if lifecycle_state is not None:
1617
+ kwargs['lifecycle_state'] = lifecycle_state
1618
+ if name is not None:
1619
+ kwargs['name'] = name
1620
+ if limit is not None:
1621
+ kwargs['limit'] = limit
1622
+ if page is not None:
1623
+ kwargs['page'] = page
1624
+ if sort_order is not None:
1625
+ kwargs['sort_order'] = sort_order
1626
+ if sort_by is not None:
1627
+ kwargs['sort_by'] = sort_by
1628
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1629
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1630
+ if all_pages:
1631
+ if page_size:
1632
+ kwargs['limit'] = page_size
1633
+
1634
+ result = cli_util.list_call_get_all_results(
1635
+ client.list_batch_job_tasks,
1636
+ batch_job_id=batch_job_id,
1637
+ **kwargs
1638
+ )
1639
+ elif limit is not None:
1640
+ result = cli_util.list_call_get_up_to_limit(
1641
+ client.list_batch_job_tasks,
1642
+ limit,
1643
+ page_size,
1644
+ batch_job_id=batch_job_id,
1645
+ **kwargs
1646
+ )
1647
+ else:
1648
+ result = client.list_batch_job_tasks(
1649
+ batch_job_id=batch_job_id,
1650
+ **kwargs
1651
+ )
1652
+ cli_util.render_response(result, ctx)
1653
+
1654
+
1655
+ @batch_job_collection_group.command(name=cli_util.override('batch.list_batch_jobs.command_name', 'list-batch-jobs'), help=u"""Lists the batch jobs by compartment or job [OCID]. You can filter and sort them by various properties like lifecycle state, display name and also ocid. All properties require an exact match. List operation only provides a summary information, use GetBatchJob to get the full details on a specific context \n[Command Reference](listBatchJobs)""")
1656
+ @cli_util.option('--compartment-id', help=u"""The [OCID] of the compartment in which to list resources.""")
1657
+ @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "WAITING", "IN_PROGRESS", "SUCCEEDED", "NEEDS_ATTENTION", "FAILED", "CANCELING", "CANCELED"]), help=u"""A filter to return only resources that match the given lifecycle state. The state value is case-insensitive.""")
1658
+ @cli_util.option('--display-name', help=u"""A filter to return only resources that match the given display name exactly.""")
1659
+ @cli_util.option('--id', help=u"""The [OCID] of the batch job.""")
1660
+ @cli_util.option('--batch-job-pool-id', help=u"""The [OCID] of the batch job pool.""")
1661
+ @cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination].""")
1662
+ @cli_util.option('--page', help=u"""For list pagination. The value of the opc-next-page response header from the previous \"List\" call. For important details about how pagination works, see [List Pagination].""")
1663
+ @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (`ASC`) or descending (`DESC`).""")
1664
+ @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. You can provide only one sort order. Default order for `timeCreated` is descending. Default order for `displayName` is ascending.""")
1665
+ @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
1666
+ @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
1667
+ @json_skeleton_utils.get_cli_json_input_option({})
1668
+ @cli_util.help_option
1669
+ @click.pass_context
1670
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'BatchJobCollection'})
1671
+ @cli_util.wrap_exceptions
1672
+ def list_batch_jobs(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, id, batch_job_pool_id, limit, page, sort_order, sort_by):
1673
+
1674
+ if all_pages and limit:
1675
+ raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
1676
+
1677
+ kwargs = {}
1678
+ if compartment_id is not None:
1679
+ kwargs['compartment_id'] = compartment_id
1680
+ if lifecycle_state is not None:
1681
+ kwargs['lifecycle_state'] = lifecycle_state
1682
+ if display_name is not None:
1683
+ kwargs['display_name'] = display_name
1684
+ if id is not None:
1685
+ kwargs['id'] = id
1686
+ if batch_job_pool_id is not None:
1687
+ kwargs['batch_job_pool_id'] = batch_job_pool_id
1688
+ if limit is not None:
1689
+ kwargs['limit'] = limit
1690
+ if page is not None:
1691
+ kwargs['page'] = page
1692
+ if sort_order is not None:
1693
+ kwargs['sort_order'] = sort_order
1694
+ if sort_by is not None:
1695
+ kwargs['sort_by'] = sort_by
1696
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1697
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1698
+ if all_pages:
1699
+ if page_size:
1700
+ kwargs['limit'] = page_size
1701
+
1702
+ result = cli_util.list_call_get_all_results(
1703
+ client.list_batch_jobs,
1704
+ **kwargs
1705
+ )
1706
+ elif limit is not None:
1707
+ result = cli_util.list_call_get_up_to_limit(
1708
+ client.list_batch_jobs,
1709
+ limit,
1710
+ page_size,
1711
+ **kwargs
1712
+ )
1713
+ else:
1714
+ result = client.list_batch_jobs(
1715
+ **kwargs
1716
+ )
1717
+ cli_util.render_response(result, ctx)
1718
+
1719
+
1720
+ @batch_task_environment_collection_group.command(name=cli_util.override('batch.list_batch_task_environments.command_name', 'list-batch-task-environments'), help=u"""Lists the task environments by compartment or environment [OCID]. You can filter and sort them by various properties like lifecycle state, display name and also ocid. All properties require an exact match. List operation only provides a summary information, use GetBatchTaskEnvironment to get the full details on a specific context \n[Command Reference](listBatchTaskEnvironments)""")
1721
+ @cli_util.option('--compartment-id', help=u"""The [OCID] of the compartment in which to list resources.""")
1722
+ @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), help=u"""A filter to return only resources that match the given lifecycle state. The state value is case-insensitive.""")
1723
+ @cli_util.option('--display-name', help=u"""A filter to return only resources that match the given display name exactly.""")
1724
+ @cli_util.option('--id', help=u"""The [OCID] of the batch task environment.""")
1725
+ @cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination].""")
1726
+ @cli_util.option('--page', help=u"""For list pagination. The value of the opc-next-page response header from the previous \"List\" call. For important details about how pagination works, see [List Pagination].""")
1727
+ @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (`ASC`) or descending (`DESC`).""")
1728
+ @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. You can provide only one sort order. Default order for `timeCreated` is descending. Default order for `displayName` is ascending.""")
1729
+ @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
1730
+ @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
1731
+ @json_skeleton_utils.get_cli_json_input_option({})
1732
+ @cli_util.help_option
1733
+ @click.pass_context
1734
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'BatchTaskEnvironmentCollection'})
1735
+ @cli_util.wrap_exceptions
1736
+ def list_batch_task_environments(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, id, limit, page, sort_order, sort_by):
1737
+
1738
+ if all_pages and limit:
1739
+ raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
1740
+
1741
+ kwargs = {}
1742
+ if compartment_id is not None:
1743
+ kwargs['compartment_id'] = compartment_id
1744
+ if lifecycle_state is not None:
1745
+ kwargs['lifecycle_state'] = lifecycle_state
1746
+ if display_name is not None:
1747
+ kwargs['display_name'] = display_name
1748
+ if id is not None:
1749
+ kwargs['id'] = id
1750
+ if limit is not None:
1751
+ kwargs['limit'] = limit
1752
+ if page is not None:
1753
+ kwargs['page'] = page
1754
+ if sort_order is not None:
1755
+ kwargs['sort_order'] = sort_order
1756
+ if sort_by is not None:
1757
+ kwargs['sort_by'] = sort_by
1758
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1759
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1760
+ if all_pages:
1761
+ if page_size:
1762
+ kwargs['limit'] = page_size
1763
+
1764
+ result = cli_util.list_call_get_all_results(
1765
+ client.list_batch_task_environments,
1766
+ **kwargs
1767
+ )
1768
+ elif limit is not None:
1769
+ result = cli_util.list_call_get_up_to_limit(
1770
+ client.list_batch_task_environments,
1771
+ limit,
1772
+ page_size,
1773
+ **kwargs
1774
+ )
1775
+ else:
1776
+ result = client.list_batch_task_environments(
1777
+ **kwargs
1778
+ )
1779
+ cli_util.render_response(result, ctx)
1780
+
1781
+
1782
+ @batch_task_profile_collection_group.command(name=cli_util.override('batch.list_batch_task_profiles.command_name', 'list-batch-task-profiles'), help=u"""Lists the task profiles by compartment or profile [OCID]. You can filter and sort them by various properties like lifecycle state, name and also ocid. All properties require an exact match. List operation only provides a summary information, use GetBatchTaskProfile to get the full details on a specific context \n[Command Reference](listBatchTaskProfiles)""")
1783
+ @cli_util.option('--compartment-id', help=u"""The [OCID] of the compartment in which to list resources.""")
1784
+ @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), help=u"""A filter to return only resources that match the given lifecycle state. The state value is case-insensitive.""")
1785
+ @cli_util.option('--display-name', help=u"""A filter to return only resources that match the given display name exactly.""")
1786
+ @cli_util.option('--id', help=u"""The [OCID] of the batch task profile.""")
1787
+ @cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination].""")
1788
+ @cli_util.option('--page', help=u"""For list pagination. The value of the opc-next-page response header from the previous \"List\" call. For important details about how pagination works, see [List Pagination].""")
1789
+ @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (`ASC`) or descending (`DESC`).""")
1790
+ @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. You can provide only one sort order. Default order for `timeCreated` is descending. Default order for `displayName` is ascending.""")
1791
+ @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
1792
+ @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
1793
+ @json_skeleton_utils.get_cli_json_input_option({})
1794
+ @cli_util.help_option
1795
+ @click.pass_context
1796
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'BatchTaskProfileCollection'})
1797
+ @cli_util.wrap_exceptions
1798
+ def list_batch_task_profiles(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, id, limit, page, sort_order, sort_by):
1799
+
1800
+ if all_pages and limit:
1801
+ raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
1802
+
1803
+ kwargs = {}
1804
+ if compartment_id is not None:
1805
+ kwargs['compartment_id'] = compartment_id
1806
+ if lifecycle_state is not None:
1807
+ kwargs['lifecycle_state'] = lifecycle_state
1808
+ if display_name is not None:
1809
+ kwargs['display_name'] = display_name
1810
+ if id is not None:
1811
+ kwargs['id'] = id
1812
+ if limit is not None:
1813
+ kwargs['limit'] = limit
1814
+ if page is not None:
1815
+ kwargs['page'] = page
1816
+ if sort_order is not None:
1817
+ kwargs['sort_order'] = sort_order
1818
+ if sort_by is not None:
1819
+ kwargs['sort_by'] = sort_by
1820
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1821
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1822
+ if all_pages:
1823
+ if page_size:
1824
+ kwargs['limit'] = page_size
1825
+
1826
+ result = cli_util.list_call_get_all_results(
1827
+ client.list_batch_task_profiles,
1828
+ **kwargs
1829
+ )
1830
+ elif limit is not None:
1831
+ result = cli_util.list_call_get_up_to_limit(
1832
+ client.list_batch_task_profiles,
1833
+ limit,
1834
+ page_size,
1835
+ **kwargs
1836
+ )
1837
+ else:
1838
+ result = client.list_batch_task_profiles(
1839
+ **kwargs
1840
+ )
1841
+ cli_util.render_response(result, ctx)
1842
+
1843
+
1844
+ @batch_task_collection_group.command(name=cli_util.override('batch.list_batch_tasks.command_name', 'list-batch-tasks'), help=u"""Lists the batch tasks associated with batch jobs. \n[Command Reference](listBatchTasks)""")
1845
+ @cli_util.option('--compartment-id', help=u"""The [OCID] of the compartment in which to list resources.""")
1846
+ @cli_util.option('--batch-job-id', help=u"""The [OCID] of the batch job.""")
1847
+ @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "WAITING", "IN_PROGRESS", "SUCCEEDED", "FAILED", "CANCELING", "CANCELED"]), help=u"""A filter to return only resources that match the given lifecycle state. The state value is case-insensitive.""")
1848
+ @cli_util.option('--name', help=u"""The name of the task.""")
1849
+ @cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination].""")
1850
+ @cli_util.option('--page', help=u"""For list pagination. The value of the opc-next-page response header from the previous \"List\" call. For important details about how pagination works, see [List Pagination].""")
1851
+ @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (`ASC`) or descending (`DESC`).""")
1852
+ @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["name"]), help=u"""The field to sort by. You can provide only one sort order. Default order for `name` is ascending.""")
1853
+ @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
1854
+ @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
1855
+ @json_skeleton_utils.get_cli_json_input_option({})
1856
+ @cli_util.help_option
1857
+ @click.pass_context
1858
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'BatchTaskCollection'})
1859
+ @cli_util.wrap_exceptions
1860
+ def list_batch_tasks(ctx, from_json, all_pages, page_size, compartment_id, batch_job_id, lifecycle_state, name, limit, page, sort_order, sort_by):
1861
+
1862
+ if all_pages and limit:
1863
+ raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
1864
+
1865
+ kwargs = {}
1866
+ if compartment_id is not None:
1867
+ kwargs['compartment_id'] = compartment_id
1868
+ if batch_job_id is not None:
1869
+ kwargs['batch_job_id'] = batch_job_id
1870
+ if lifecycle_state is not None:
1871
+ kwargs['lifecycle_state'] = lifecycle_state
1872
+ if name is not None:
1873
+ kwargs['name'] = name
1874
+ if limit is not None:
1875
+ kwargs['limit'] = limit
1876
+ if page is not None:
1877
+ kwargs['page'] = page
1878
+ if sort_order is not None:
1879
+ kwargs['sort_order'] = sort_order
1880
+ if sort_by is not None:
1881
+ kwargs['sort_by'] = sort_by
1882
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1883
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1884
+ if all_pages:
1885
+ if page_size:
1886
+ kwargs['limit'] = page_size
1887
+
1888
+ result = cli_util.list_call_get_all_results(
1889
+ client.list_batch_tasks,
1890
+ **kwargs
1891
+ )
1892
+ elif limit is not None:
1893
+ result = cli_util.list_call_get_up_to_limit(
1894
+ client.list_batch_tasks,
1895
+ limit,
1896
+ page_size,
1897
+ **kwargs
1898
+ )
1899
+ else:
1900
+ result = client.list_batch_tasks(
1901
+ **kwargs
1902
+ )
1903
+ cli_util.render_response(result, ctx)
1904
+
1905
+
1906
+ @work_request_error_group.command(name=cli_util.override('batch.list_work_request_errors.command_name', 'list'), help=u"""Lists the errors for a work request. \n[Command Reference](listWorkRequestErrors)""")
1907
+ @cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the asynchronous work request.""")
1908
+ @cli_util.option('--page', help=u"""For list pagination. The value of the opc-next-page response header from the previous \"List\" call. For important details about how pagination works, see [List Pagination].""")
1909
+ @cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination].""")
1910
+ @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for `timeCreated` is descending.""")
1911
+ @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (`ASC`) or descending (`DESC`).""")
1912
+ @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
1913
+ @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
1914
+ @json_skeleton_utils.get_cli_json_input_option({})
1915
+ @cli_util.help_option
1916
+ @click.pass_context
1917
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'WorkRequestErrorCollection'})
1918
+ @cli_util.wrap_exceptions
1919
+ def list_work_request_errors(ctx, from_json, all_pages, page_size, work_request_id, page, limit, sort_by, sort_order):
1920
+
1921
+ if all_pages and limit:
1922
+ raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
1923
+
1924
+ if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0:
1925
+ raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string')
1926
+
1927
+ kwargs = {}
1928
+ if page is not None:
1929
+ kwargs['page'] = page
1930
+ if limit is not None:
1931
+ kwargs['limit'] = limit
1932
+ if sort_by is not None:
1933
+ kwargs['sort_by'] = sort_by
1934
+ if sort_order is not None:
1935
+ kwargs['sort_order'] = sort_order
1936
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1937
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1938
+ if all_pages:
1939
+ if page_size:
1940
+ kwargs['limit'] = page_size
1941
+
1942
+ result = cli_util.list_call_get_all_results(
1943
+ client.list_work_request_errors,
1944
+ work_request_id=work_request_id,
1945
+ **kwargs
1946
+ )
1947
+ elif limit is not None:
1948
+ result = cli_util.list_call_get_up_to_limit(
1949
+ client.list_work_request_errors,
1950
+ limit,
1951
+ page_size,
1952
+ work_request_id=work_request_id,
1953
+ **kwargs
1954
+ )
1955
+ else:
1956
+ result = client.list_work_request_errors(
1957
+ work_request_id=work_request_id,
1958
+ **kwargs
1959
+ )
1960
+ cli_util.render_response(result, ctx)
1961
+
1962
+
1963
+ @work_request_log_entry_group.command(name=cli_util.override('batch.list_work_request_logs.command_name', 'list-work-request-logs'), help=u"""Lists the logs for a work request. \n[Command Reference](listWorkRequestLogs)""")
1964
+ @cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the asynchronous work request.""")
1965
+ @cli_util.option('--page', help=u"""For list pagination. The value of the opc-next-page response header from the previous \"List\" call. For important details about how pagination works, see [List Pagination].""")
1966
+ @cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination].""")
1967
+ @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for `timeCreated` is descending.""")
1968
+ @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (`ASC`) or descending (`DESC`).""")
1969
+ @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
1970
+ @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
1971
+ @json_skeleton_utils.get_cli_json_input_option({})
1972
+ @cli_util.help_option
1973
+ @click.pass_context
1974
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'WorkRequestLogEntryCollection'})
1975
+ @cli_util.wrap_exceptions
1976
+ def list_work_request_logs(ctx, from_json, all_pages, page_size, work_request_id, page, limit, sort_by, sort_order):
1977
+
1978
+ if all_pages and limit:
1979
+ raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
1980
+
1981
+ if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0:
1982
+ raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string')
1983
+
1984
+ kwargs = {}
1985
+ if page is not None:
1986
+ kwargs['page'] = page
1987
+ if limit is not None:
1988
+ kwargs['limit'] = limit
1989
+ if sort_by is not None:
1990
+ kwargs['sort_by'] = sort_by
1991
+ if sort_order is not None:
1992
+ kwargs['sort_order'] = sort_order
1993
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
1994
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
1995
+ if all_pages:
1996
+ if page_size:
1997
+ kwargs['limit'] = page_size
1998
+
1999
+ result = cli_util.list_call_get_all_results(
2000
+ client.list_work_request_logs,
2001
+ work_request_id=work_request_id,
2002
+ **kwargs
2003
+ )
2004
+ elif limit is not None:
2005
+ result = cli_util.list_call_get_up_to_limit(
2006
+ client.list_work_request_logs,
2007
+ limit,
2008
+ page_size,
2009
+ work_request_id=work_request_id,
2010
+ **kwargs
2011
+ )
2012
+ else:
2013
+ result = client.list_work_request_logs(
2014
+ work_request_id=work_request_id,
2015
+ **kwargs
2016
+ )
2017
+ cli_util.render_response(result, ctx)
2018
+
2019
+
2020
+ @work_request_group.command(name=cli_util.override('batch.list_work_requests.command_name', 'list'), help=u"""Lists the work requests in a compartment. \n[Command Reference](listWorkRequests)""")
2021
+ @cli_util.option('--compartment-id', help=u"""The [OCID] of the compartment in which to list resources.""")
2022
+ @cli_util.option('--work-request-id', help=u"""The [OCID] of the asynchronous work request.""")
2023
+ @cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help=u"""A filter to return only the resources that match the given lifecycle state.""")
2024
+ @cli_util.option('--resource-id', help=u"""The [OCID] of the resource affected by the work request.""")
2025
+ @cli_util.option('--page', help=u"""For list pagination. The value of the opc-next-page response header from the previous \"List\" call. For important details about how pagination works, see [List Pagination].""")
2026
+ @cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination].""")
2027
+ @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (`ASC`) or descending (`DESC`).""")
2028
+ @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeAccepted"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for `timeAccepted` is descending.""")
2029
+ @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
2030
+ @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
2031
+ @json_skeleton_utils.get_cli_json_input_option({})
2032
+ @cli_util.help_option
2033
+ @click.pass_context
2034
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'batch', 'class': 'WorkRequestSummaryCollection'})
2035
+ @cli_util.wrap_exceptions
2036
+ def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, work_request_id, status, resource_id, page, limit, sort_order, sort_by):
2037
+
2038
+ if all_pages and limit:
2039
+ raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
2040
+
2041
+ kwargs = {}
2042
+ if compartment_id is not None:
2043
+ kwargs['compartment_id'] = compartment_id
2044
+ if work_request_id is not None:
2045
+ kwargs['work_request_id'] = work_request_id
2046
+ if status is not None:
2047
+ kwargs['status'] = status
2048
+ if resource_id is not None:
2049
+ kwargs['resource_id'] = resource_id
2050
+ if page is not None:
2051
+ kwargs['page'] = page
2052
+ if limit is not None:
2053
+ kwargs['limit'] = limit
2054
+ if sort_order is not None:
2055
+ kwargs['sort_order'] = sort_order
2056
+ if sort_by is not None:
2057
+ kwargs['sort_by'] = sort_by
2058
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
2059
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
2060
+ if all_pages:
2061
+ if page_size:
2062
+ kwargs['limit'] = page_size
2063
+
2064
+ result = cli_util.list_call_get_all_results(
2065
+ client.list_work_requests,
2066
+ **kwargs
2067
+ )
2068
+ elif limit is not None:
2069
+ result = cli_util.list_call_get_up_to_limit(
2070
+ client.list_work_requests,
2071
+ limit,
2072
+ page_size,
2073
+ **kwargs
2074
+ )
2075
+ else:
2076
+ result = client.list_work_requests(
2077
+ **kwargs
2078
+ )
2079
+ cli_util.render_response(result, ctx)
2080
+
2081
+
2082
+ @batch_job_group.command(name=cli_util.override('batch.pause_batch_job.command_name', 'pause'), help=u"""Pauses the batch job and all its tasks. \n[Command Reference](pauseBatchJob)""")
2083
+ @cli_util.option('--batch-job-id', required=True, help=u"""The [OCID] of the batch job.""")
2084
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
2085
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
2086
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
2087
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
2088
+ @json_skeleton_utils.get_cli_json_input_option({})
2089
+ @cli_util.help_option
2090
+ @click.pass_context
2091
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
2092
+ @cli_util.wrap_exceptions
2093
+ def pause_batch_job(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_job_id, if_match):
2094
+
2095
+ if isinstance(batch_job_id, six.string_types) and len(batch_job_id.strip()) == 0:
2096
+ raise click.UsageError('Parameter --batch-job-id cannot be whitespace or empty string')
2097
+
2098
+ kwargs = {}
2099
+ if if_match is not None:
2100
+ kwargs['if_match'] = if_match
2101
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
2102
+
2103
+ _details = {}
2104
+
2105
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
2106
+ result = client.pause_batch_job(
2107
+ batch_job_id=batch_job_id,
2108
+ pause_batch_job_details=_details,
2109
+ **kwargs
2110
+ )
2111
+ if wait_for_state:
2112
+
2113
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
2114
+ try:
2115
+ wait_period_kwargs = {}
2116
+ if max_wait_seconds is not None:
2117
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
2118
+ if wait_interval_seconds is not None:
2119
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
2120
+ if 'opc-work-request-id' not in result.headers:
2121
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
2122
+ cli_util.render_response(result, ctx)
2123
+ return
2124
+
2125
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
2126
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
2127
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
2128
+ # If we fail, we should show an error, but we should still provide the information to the customer
2129
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
2130
+ cli_util.render_response(result, ctx)
2131
+ sys.exit(2)
2132
+ except Exception:
2133
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
2134
+ cli_util.render_response(result, ctx)
2135
+ raise
2136
+ else:
2137
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
2138
+ cli_util.render_response(result, ctx)
2139
+
2140
+
2141
+ @batch_context_group.command(name=cli_util.override('batch.start_batch_context.command_name', 'start'), help=u"""Activates a batch context to accept new jobs. \n[Command Reference](startBatchContext)""")
2142
+ @cli_util.option('--batch-context-id', required=True, help=u"""The [OCID] of the batch context.""")
2143
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
2144
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
2145
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
2146
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
2147
+ @json_skeleton_utils.get_cli_json_input_option({})
2148
+ @cli_util.help_option
2149
+ @click.pass_context
2150
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
2151
+ @cli_util.wrap_exceptions
2152
+ def start_batch_context(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_context_id, if_match):
2153
+
2154
+ if isinstance(batch_context_id, six.string_types) and len(batch_context_id.strip()) == 0:
2155
+ raise click.UsageError('Parameter --batch-context-id cannot be whitespace or empty string')
2156
+
2157
+ kwargs = {}
2158
+ if if_match is not None:
2159
+ kwargs['if_match'] = if_match
2160
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
2161
+
2162
+ _details = {}
2163
+
2164
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
2165
+ result = client.start_batch_context(
2166
+ batch_context_id=batch_context_id,
2167
+ start_batch_context_details=_details,
2168
+ **kwargs
2169
+ )
2170
+ if wait_for_state:
2171
+
2172
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
2173
+ try:
2174
+ wait_period_kwargs = {}
2175
+ if max_wait_seconds is not None:
2176
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
2177
+ if wait_interval_seconds is not None:
2178
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
2179
+ if 'opc-work-request-id' not in result.headers:
2180
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
2181
+ cli_util.render_response(result, ctx)
2182
+ return
2183
+
2184
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
2185
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
2186
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
2187
+ # If we fail, we should show an error, but we should still provide the information to the customer
2188
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
2189
+ cli_util.render_response(result, ctx)
2190
+ sys.exit(2)
2191
+ except Exception:
2192
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
2193
+ cli_util.render_response(result, ctx)
2194
+ raise
2195
+ else:
2196
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
2197
+ cli_util.render_response(result, ctx)
2198
+
2199
+
2200
+ @batch_job_pool_group.command(name=cli_util.override('batch.start_batch_job_pool.command_name', 'start'), help=u"""Activates the batch job pool. \n[Command Reference](startBatchJobPool)""")
2201
+ @cli_util.option('--batch-job-pool-id', required=True, help=u"""The [OCID] of the batch job pool.""")
2202
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
2203
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
2204
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
2205
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
2206
+ @json_skeleton_utils.get_cli_json_input_option({})
2207
+ @cli_util.help_option
2208
+ @click.pass_context
2209
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
2210
+ @cli_util.wrap_exceptions
2211
+ def start_batch_job_pool(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_job_pool_id, if_match):
2212
+
2213
+ if isinstance(batch_job_pool_id, six.string_types) and len(batch_job_pool_id.strip()) == 0:
2214
+ raise click.UsageError('Parameter --batch-job-pool-id cannot be whitespace or empty string')
2215
+
2216
+ kwargs = {}
2217
+ if if_match is not None:
2218
+ kwargs['if_match'] = if_match
2219
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
2220
+
2221
+ _details = {}
2222
+
2223
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
2224
+ result = client.start_batch_job_pool(
2225
+ batch_job_pool_id=batch_job_pool_id,
2226
+ start_batch_job_pool_details=_details,
2227
+ **kwargs
2228
+ )
2229
+ if wait_for_state:
2230
+
2231
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
2232
+ try:
2233
+ wait_period_kwargs = {}
2234
+ if max_wait_seconds is not None:
2235
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
2236
+ if wait_interval_seconds is not None:
2237
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
2238
+ if 'opc-work-request-id' not in result.headers:
2239
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
2240
+ cli_util.render_response(result, ctx)
2241
+ return
2242
+
2243
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
2244
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
2245
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
2246
+ # If we fail, we should show an error, but we should still provide the information to the customer
2247
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
2248
+ cli_util.render_response(result, ctx)
2249
+ sys.exit(2)
2250
+ except Exception:
2251
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
2252
+ cli_util.render_response(result, ctx)
2253
+ raise
2254
+ else:
2255
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
2256
+ cli_util.render_response(result, ctx)
2257
+
2258
+
2259
+ @batch_context_group.command(name=cli_util.override('batch.stop_batch_context.command_name', 'stop'), help=u"""Stops a batch context from accepting new jobs. \n[Command Reference](stopBatchContext)""")
2260
+ @cli_util.option('--batch-context-id', required=True, help=u"""The [OCID] of the batch context.""")
2261
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
2262
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
2263
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
2264
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
2265
+ @json_skeleton_utils.get_cli_json_input_option({})
2266
+ @cli_util.help_option
2267
+ @click.pass_context
2268
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
2269
+ @cli_util.wrap_exceptions
2270
+ def stop_batch_context(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_context_id, if_match):
2271
+
2272
+ if isinstance(batch_context_id, six.string_types) and len(batch_context_id.strip()) == 0:
2273
+ raise click.UsageError('Parameter --batch-context-id cannot be whitespace or empty string')
2274
+
2275
+ kwargs = {}
2276
+ if if_match is not None:
2277
+ kwargs['if_match'] = if_match
2278
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
2279
+
2280
+ _details = {}
2281
+
2282
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
2283
+ result = client.stop_batch_context(
2284
+ batch_context_id=batch_context_id,
2285
+ stop_batch_context_details=_details,
2286
+ **kwargs
2287
+ )
2288
+ if wait_for_state:
2289
+
2290
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
2291
+ try:
2292
+ wait_period_kwargs = {}
2293
+ if max_wait_seconds is not None:
2294
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
2295
+ if wait_interval_seconds is not None:
2296
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
2297
+ if 'opc-work-request-id' not in result.headers:
2298
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
2299
+ cli_util.render_response(result, ctx)
2300
+ return
2301
+
2302
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
2303
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
2304
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
2305
+ # If we fail, we should show an error, but we should still provide the information to the customer
2306
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
2307
+ cli_util.render_response(result, ctx)
2308
+ sys.exit(2)
2309
+ except Exception:
2310
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
2311
+ cli_util.render_response(result, ctx)
2312
+ raise
2313
+ else:
2314
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
2315
+ cli_util.render_response(result, ctx)
2316
+
2317
+
2318
+ @batch_job_pool_group.command(name=cli_util.override('batch.stop_batch_job_pool.command_name', 'stop'), help=u"""Deactivates the batch job pool. \n[Command Reference](stopBatchJobPool)""")
2319
+ @cli_util.option('--batch-job-pool-id', required=True, help=u"""The [OCID] of the batch job pool.""")
2320
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
2321
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
2322
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
2323
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
2324
+ @json_skeleton_utils.get_cli_json_input_option({})
2325
+ @cli_util.help_option
2326
+ @click.pass_context
2327
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
2328
+ @cli_util.wrap_exceptions
2329
+ def stop_batch_job_pool(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_job_pool_id, if_match):
2330
+
2331
+ if isinstance(batch_job_pool_id, six.string_types) and len(batch_job_pool_id.strip()) == 0:
2332
+ raise click.UsageError('Parameter --batch-job-pool-id cannot be whitespace or empty string')
2333
+
2334
+ kwargs = {}
2335
+ if if_match is not None:
2336
+ kwargs['if_match'] = if_match
2337
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
2338
+
2339
+ _details = {}
2340
+
2341
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
2342
+ result = client.stop_batch_job_pool(
2343
+ batch_job_pool_id=batch_job_pool_id,
2344
+ stop_batch_job_pool_details=_details,
2345
+ **kwargs
2346
+ )
2347
+ if wait_for_state:
2348
+
2349
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
2350
+ try:
2351
+ wait_period_kwargs = {}
2352
+ if max_wait_seconds is not None:
2353
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
2354
+ if wait_interval_seconds is not None:
2355
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
2356
+ if 'opc-work-request-id' not in result.headers:
2357
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
2358
+ cli_util.render_response(result, ctx)
2359
+ return
2360
+
2361
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
2362
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
2363
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
2364
+ # If we fail, we should show an error, but we should still provide the information to the customer
2365
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
2366
+ cli_util.render_response(result, ctx)
2367
+ sys.exit(2)
2368
+ except Exception:
2369
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
2370
+ cli_util.render_response(result, ctx)
2371
+ raise
2372
+ else:
2373
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
2374
+ cli_util.render_response(result, ctx)
2375
+
2376
+
2377
+ @batch_job_group.command(name=cli_util.override('batch.unpause_batch_job.command_name', 'unpause'), help=u"""Resumes the batch job and all its tasks. \n[Command Reference](unpauseBatchJob)""")
2378
+ @cli_util.option('--batch-job-id', required=True, help=u"""The [OCID] of the batch job.""")
2379
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
2380
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
2381
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
2382
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
2383
+ @json_skeleton_utils.get_cli_json_input_option({})
2384
+ @cli_util.help_option
2385
+ @click.pass_context
2386
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
2387
+ @cli_util.wrap_exceptions
2388
+ def unpause_batch_job(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_job_id, if_match):
2389
+
2390
+ if isinstance(batch_job_id, six.string_types) and len(batch_job_id.strip()) == 0:
2391
+ raise click.UsageError('Parameter --batch-job-id cannot be whitespace or empty string')
2392
+
2393
+ kwargs = {}
2394
+ if if_match is not None:
2395
+ kwargs['if_match'] = if_match
2396
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
2397
+
2398
+ _details = {}
2399
+
2400
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
2401
+ result = client.unpause_batch_job(
2402
+ batch_job_id=batch_job_id,
2403
+ unpause_batch_job_details=_details,
2404
+ **kwargs
2405
+ )
2406
+ if wait_for_state:
2407
+
2408
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
2409
+ try:
2410
+ wait_period_kwargs = {}
2411
+ if max_wait_seconds is not None:
2412
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
2413
+ if wait_interval_seconds is not None:
2414
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
2415
+ if 'opc-work-request-id' not in result.headers:
2416
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
2417
+ cli_util.render_response(result, ctx)
2418
+ return
2419
+
2420
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
2421
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
2422
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
2423
+ # If we fail, we should show an error, but we should still provide the information to the customer
2424
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
2425
+ cli_util.render_response(result, ctx)
2426
+ sys.exit(2)
2427
+ except Exception:
2428
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
2429
+ cli_util.render_response(result, ctx)
2430
+ raise
2431
+ else:
2432
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
2433
+ cli_util.render_response(result, ctx)
2434
+
2435
+
2436
+ @batch_context_group.command(name=cli_util.override('batch.update_batch_context.command_name', 'update'), help=u"""Updates a batch context. \n[Command Reference](updateBatchContext)""")
2437
+ @cli_util.option('--batch-context-id', required=True, help=u"""The [OCID] of the batch context.""")
2438
+ @cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Can't be set to null.""")
2439
+ @cli_util.option('--description', help=u"""Summarized information about the batch context.""")
2440
+ @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
2441
+
2442
+ Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
2443
+ @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
2444
+
2445
+ Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
2446
+ @cli_util.option('--job-priority-configurations', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of job priority configurations related to the batch context.
2447
+
2448
+ This option is a JSON list with items of type JobPriorityConfiguration. For documentation on JobPriorityConfiguration please see our API reference: https://docs.cloud.oracle.com/api/#/en/batchcomputing/20251031/datatypes/JobPriorityConfiguration.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
2449
+ @cli_util.option('--entitlements', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Mapping of concurrent/shared resources used in job tasks to their limits.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
2450
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
2451
+ @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
2452
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
2453
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
2454
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
2455
+ @json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}, 'job-priority-configurations': {'module': 'batch', 'class': 'list[JobPriorityConfiguration]'}, 'entitlements': {'module': 'batch', 'class': 'dict(str, integer)'}})
2456
+ @cli_util.help_option
2457
+ @click.pass_context
2458
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}, 'job-priority-configurations': {'module': 'batch', 'class': 'list[JobPriorityConfiguration]'}, 'entitlements': {'module': 'batch', 'class': 'dict(str, integer)'}})
2459
+ @cli_util.wrap_exceptions
2460
+ def update_batch_context(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_context_id, display_name, description, freeform_tags, defined_tags, job_priority_configurations, entitlements, if_match):
2461
+
2462
+ if isinstance(batch_context_id, six.string_types) and len(batch_context_id.strip()) == 0:
2463
+ raise click.UsageError('Parameter --batch-context-id cannot be whitespace or empty string')
2464
+ if not force:
2465
+ if freeform_tags or defined_tags or job_priority_configurations or entitlements:
2466
+ if not click.confirm("WARNING: Updates to freeform-tags and defined-tags and job-priority-configurations and entitlements will replace any existing values. Are you sure you want to continue?"):
2467
+ ctx.abort()
2468
+
2469
+ kwargs = {}
2470
+ if if_match is not None:
2471
+ kwargs['if_match'] = if_match
2472
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
2473
+
2474
+ _details = {}
2475
+
2476
+ if display_name is not None:
2477
+ _details['displayName'] = display_name
2478
+
2479
+ if description is not None:
2480
+ _details['description'] = description
2481
+
2482
+ if freeform_tags is not None:
2483
+ _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
2484
+
2485
+ if defined_tags is not None:
2486
+ _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
2487
+
2488
+ if job_priority_configurations is not None:
2489
+ _details['jobPriorityConfigurations'] = cli_util.parse_json_parameter("job_priority_configurations", job_priority_configurations)
2490
+
2491
+ if entitlements is not None:
2492
+ _details['entitlements'] = cli_util.parse_json_parameter("entitlements", entitlements)
2493
+
2494
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
2495
+ result = client.update_batch_context(
2496
+ batch_context_id=batch_context_id,
2497
+ update_batch_context_details=_details,
2498
+ **kwargs
2499
+ )
2500
+ if wait_for_state:
2501
+
2502
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
2503
+ try:
2504
+ wait_period_kwargs = {}
2505
+ if max_wait_seconds is not None:
2506
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
2507
+ if wait_interval_seconds is not None:
2508
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
2509
+ if 'opc-work-request-id' not in result.headers:
2510
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
2511
+ cli_util.render_response(result, ctx)
2512
+ return
2513
+
2514
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
2515
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
2516
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
2517
+ # If we fail, we should show an error, but we should still provide the information to the customer
2518
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
2519
+ cli_util.render_response(result, ctx)
2520
+ sys.exit(2)
2521
+ except Exception:
2522
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
2523
+ cli_util.render_response(result, ctx)
2524
+ raise
2525
+ else:
2526
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
2527
+ cli_util.render_response(result, ctx)
2528
+
2529
+
2530
+ @batch_job_group.command(name=cli_util.override('batch.update_batch_job.command_name', 'update'), help=u"""Updates a batch job. \n[Command Reference](updateBatchJob)""")
2531
+ @cli_util.option('--batch-job-id', required=True, help=u"""The [OCID] of the batch job.""")
2532
+ @cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Can't be set to null.""")
2533
+ @cli_util.option('--description', help=u"""An optional description that provides additional context next to the displayName.""")
2534
+ @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
2535
+
2536
+ Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
2537
+ @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
2538
+
2539
+ Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
2540
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
2541
+ @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
2542
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
2543
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
2544
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
2545
+ @json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}})
2546
+ @cli_util.help_option
2547
+ @click.pass_context
2548
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}})
2549
+ @cli_util.wrap_exceptions
2550
+ def update_batch_job(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_job_id, display_name, description, freeform_tags, defined_tags, if_match):
2551
+
2552
+ if isinstance(batch_job_id, six.string_types) and len(batch_job_id.strip()) == 0:
2553
+ raise click.UsageError('Parameter --batch-job-id cannot be whitespace or empty string')
2554
+ if not force:
2555
+ if freeform_tags or defined_tags:
2556
+ if not click.confirm("WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"):
2557
+ ctx.abort()
2558
+
2559
+ kwargs = {}
2560
+ if if_match is not None:
2561
+ kwargs['if_match'] = if_match
2562
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
2563
+
2564
+ _details = {}
2565
+
2566
+ if display_name is not None:
2567
+ _details['displayName'] = display_name
2568
+
2569
+ if description is not None:
2570
+ _details['description'] = description
2571
+
2572
+ if freeform_tags is not None:
2573
+ _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
2574
+
2575
+ if defined_tags is not None:
2576
+ _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
2577
+
2578
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
2579
+ result = client.update_batch_job(
2580
+ batch_job_id=batch_job_id,
2581
+ update_batch_job_details=_details,
2582
+ **kwargs
2583
+ )
2584
+ if wait_for_state:
2585
+
2586
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
2587
+ try:
2588
+ wait_period_kwargs = {}
2589
+ if max_wait_seconds is not None:
2590
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
2591
+ if wait_interval_seconds is not None:
2592
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
2593
+ if 'opc-work-request-id' not in result.headers:
2594
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
2595
+ cli_util.render_response(result, ctx)
2596
+ return
2597
+
2598
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
2599
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
2600
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
2601
+ # If we fail, we should show an error, but we should still provide the information to the customer
2602
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
2603
+ cli_util.render_response(result, ctx)
2604
+ sys.exit(2)
2605
+ except Exception:
2606
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
2607
+ cli_util.render_response(result, ctx)
2608
+ raise
2609
+ else:
2610
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
2611
+ cli_util.render_response(result, ctx)
2612
+
2613
+
2614
+ @batch_job_pool_group.command(name=cli_util.override('batch.update_batch_job_pool.command_name', 'update'), help=u"""Updates a batch job pool. \n[Command Reference](updateBatchJobPool)""")
2615
+ @cli_util.option('--batch-job-pool-id', required=True, help=u"""The [OCID] of the batch job pool.""")
2616
+ @cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Can't be set to null.""")
2617
+ @cli_util.option('--description', help=u"""Summarized information about the batch job pool.""")
2618
+ @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
2619
+
2620
+ Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
2621
+ @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
2622
+
2623
+ Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
2624
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
2625
+ @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
2626
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
2627
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
2628
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
2629
+ @json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}})
2630
+ @cli_util.help_option
2631
+ @click.pass_context
2632
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}})
2633
+ @cli_util.wrap_exceptions
2634
+ def update_batch_job_pool(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_job_pool_id, display_name, description, freeform_tags, defined_tags, if_match):
2635
+
2636
+ if isinstance(batch_job_pool_id, six.string_types) and len(batch_job_pool_id.strip()) == 0:
2637
+ raise click.UsageError('Parameter --batch-job-pool-id cannot be whitespace or empty string')
2638
+ if not force:
2639
+ if freeform_tags or defined_tags:
2640
+ if not click.confirm("WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"):
2641
+ ctx.abort()
2642
+
2643
+ kwargs = {}
2644
+ if if_match is not None:
2645
+ kwargs['if_match'] = if_match
2646
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
2647
+
2648
+ _details = {}
2649
+
2650
+ if display_name is not None:
2651
+ _details['displayName'] = display_name
2652
+
2653
+ if description is not None:
2654
+ _details['description'] = description
2655
+
2656
+ if freeform_tags is not None:
2657
+ _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
2658
+
2659
+ if defined_tags is not None:
2660
+ _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
2661
+
2662
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
2663
+ result = client.update_batch_job_pool(
2664
+ batch_job_pool_id=batch_job_pool_id,
2665
+ update_batch_job_pool_details=_details,
2666
+ **kwargs
2667
+ )
2668
+ if wait_for_state:
2669
+
2670
+ if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
2671
+ try:
2672
+ wait_period_kwargs = {}
2673
+ if max_wait_seconds is not None:
2674
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
2675
+ if wait_interval_seconds is not None:
2676
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
2677
+ if 'opc-work-request-id' not in result.headers:
2678
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state')
2679
+ cli_util.render_response(result, ctx)
2680
+ return
2681
+
2682
+ click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
2683
+ result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
2684
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
2685
+ # If we fail, we should show an error, but we should still provide the information to the customer
2686
+ click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
2687
+ cli_util.render_response(result, ctx)
2688
+ sys.exit(2)
2689
+ except Exception:
2690
+ click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
2691
+ cli_util.render_response(result, ctx)
2692
+ raise
2693
+ else:
2694
+ click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
2695
+ cli_util.render_response(result, ctx)
2696
+
2697
+
2698
+ @batch_task_environment_group.command(name=cli_util.override('batch.update_batch_task_environment.command_name', 'update'), help=u"""Updates a batch task environment. \n[Command Reference](updateBatchTaskEnvironment)""")
2699
+ @cli_util.option('--batch-task-environment-id', required=True, help=u"""The [OCID] of the batch task environment.""")
2700
+ @cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Can't be set to null.""")
2701
+ @cli_util.option('--description', help=u"""The batch task environment description.""")
2702
+ @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
2703
+
2704
+ Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
2705
+ @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
2706
+
2707
+ Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
2708
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
2709
+ @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
2710
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
2711
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
2712
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
2713
+ @json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}})
2714
+ @cli_util.help_option
2715
+ @click.pass_context
2716
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'batch', 'class': 'BatchTaskEnvironment'})
2717
+ @cli_util.wrap_exceptions
2718
+ def update_batch_task_environment(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_task_environment_id, display_name, description, freeform_tags, defined_tags, if_match):
2719
+
2720
+ if isinstance(batch_task_environment_id, six.string_types) and len(batch_task_environment_id.strip()) == 0:
2721
+ raise click.UsageError('Parameter --batch-task-environment-id cannot be whitespace or empty string')
2722
+ if not force:
2723
+ if freeform_tags or defined_tags:
2724
+ if not click.confirm("WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"):
2725
+ ctx.abort()
2726
+
2727
+ kwargs = {}
2728
+ if if_match is not None:
2729
+ kwargs['if_match'] = if_match
2730
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
2731
+
2732
+ _details = {}
2733
+
2734
+ if display_name is not None:
2735
+ _details['displayName'] = display_name
2736
+
2737
+ if description is not None:
2738
+ _details['description'] = description
2739
+
2740
+ if freeform_tags is not None:
2741
+ _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
2742
+
2743
+ if defined_tags is not None:
2744
+ _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
2745
+
2746
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
2747
+ result = client.update_batch_task_environment(
2748
+ batch_task_environment_id=batch_task_environment_id,
2749
+ update_batch_task_environment_details=_details,
2750
+ **kwargs
2751
+ )
2752
+ if wait_for_state:
2753
+
2754
+ if hasattr(client, 'get_batch_task_environment') and callable(getattr(client, 'get_batch_task_environment')):
2755
+ try:
2756
+ wait_period_kwargs = {}
2757
+ if max_wait_seconds is not None:
2758
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
2759
+ if wait_interval_seconds is not None:
2760
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
2761
+
2762
+ click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
2763
+ result = oci.wait_until(client, client.get_batch_task_environment(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs)
2764
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
2765
+ # If we fail, we should show an error, but we should still provide the information to the customer
2766
+ click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr)
2767
+ cli_util.render_response(result, ctx)
2768
+ sys.exit(2)
2769
+ except Exception:
2770
+ click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
2771
+ cli_util.render_response(result, ctx)
2772
+ raise
2773
+ else:
2774
+ click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
2775
+ cli_util.render_response(result, ctx)
2776
+
2777
+
2778
+ @batch_task_profile_group.command(name=cli_util.override('batch.update_batch_task_profile.command_name', 'update'), help=u"""Updates a batch task profile. \n[Command Reference](updateBatchTaskProfile)""")
2779
+ @cli_util.option('--batch-task-profile-id', required=True, help=u"""The [OCID] of the batch task profile.""")
2780
+ @cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Can't be set to null.""")
2781
+ @cli_util.option('--description', help=u"""The batch task profile description.""")
2782
+ @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
2783
+
2784
+ Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
2785
+ @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
2786
+
2787
+ Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
2788
+ @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
2789
+ @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
2790
+ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
2791
+ @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
2792
+ @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
2793
+ @json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}})
2794
+ @cli_util.help_option
2795
+ @click.pass_context
2796
+ @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'batch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'batch', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'batch', 'class': 'BatchTaskProfile'})
2797
+ @cli_util.wrap_exceptions
2798
+ def update_batch_task_profile(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, batch_task_profile_id, display_name, description, freeform_tags, defined_tags, if_match):
2799
+
2800
+ if isinstance(batch_task_profile_id, six.string_types) and len(batch_task_profile_id.strip()) == 0:
2801
+ raise click.UsageError('Parameter --batch-task-profile-id cannot be whitespace or empty string')
2802
+ if not force:
2803
+ if freeform_tags or defined_tags:
2804
+ if not click.confirm("WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"):
2805
+ ctx.abort()
2806
+
2807
+ kwargs = {}
2808
+ if if_match is not None:
2809
+ kwargs['if_match'] = if_match
2810
+ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
2811
+
2812
+ _details = {}
2813
+
2814
+ if display_name is not None:
2815
+ _details['displayName'] = display_name
2816
+
2817
+ if description is not None:
2818
+ _details['description'] = description
2819
+
2820
+ if freeform_tags is not None:
2821
+ _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
2822
+
2823
+ if defined_tags is not None:
2824
+ _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
2825
+
2826
+ client = cli_util.build_client('batch', 'batch_computing', ctx)
2827
+ result = client.update_batch_task_profile(
2828
+ batch_task_profile_id=batch_task_profile_id,
2829
+ update_batch_task_profile_details=_details,
2830
+ **kwargs
2831
+ )
2832
+ if wait_for_state:
2833
+
2834
+ if hasattr(client, 'get_batch_task_profile') and callable(getattr(client, 'get_batch_task_profile')):
2835
+ try:
2836
+ wait_period_kwargs = {}
2837
+ if max_wait_seconds is not None:
2838
+ wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
2839
+ if wait_interval_seconds is not None:
2840
+ wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
2841
+
2842
+ click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
2843
+ result = oci.wait_until(client, client.get_batch_task_profile(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs)
2844
+ except oci.exceptions.MaximumWaitTimeExceeded as e:
2845
+ # If we fail, we should show an error, but we should still provide the information to the customer
2846
+ click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr)
2847
+ cli_util.render_response(result, ctx)
2848
+ sys.exit(2)
2849
+ except Exception:
2850
+ click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
2851
+ cli_util.render_response(result, ctx)
2852
+ raise
2853
+ else:
2854
+ click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
2855
+ cli_util.render_response(result, ctx)