Skip to content

Commit

Permalink
v2.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
eterna2 committed May 11, 2020
1 parent cd3c8ad commit d492eb2
Show file tree
Hide file tree
Showing 86 changed files with 7,192 additions and 1,433 deletions.
194 changes: 66 additions & 128 deletions argo/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
"""
Argo
Workflow Service API performs CRUD actions against application resources # noqa: E501
Argo # noqa: E501
The version of the OpenAPI document: v2.6.3
The version of the OpenAPI document: v2.7.5
Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import copy
import logging
import multiprocessing
import sys
Expand All @@ -21,86 +22,36 @@
from six.moves import http_client as httplib


class Configuration(object):
class TypeWithDefault(type):
def __init__(cls, name, bases, dct):
super(TypeWithDefault, cls).__init__(name, bases, dct)
cls._default = None

def __call__(cls, **kwargs):
if cls._default is None:
cls._default = type.__call__(cls, **kwargs)
return copy.copy(cls._default)

def set_default(cls, default):
cls._default = copy.copy(default)


class Configuration(six.with_metaclass(TypeWithDefault, object)):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
:param host: Base url
:param api_key: Dict to store API key(s).
Each entry in the dict specifies an API key.
The dict key is the name of the security scheme in the OAS specification.
The dict value is the API key secret.
:param api_key: Dict to store API key(s)
:param api_key_prefix: Dict to store API prefix (e.g. Bearer)
The dict key is the name of the security scheme in the OAS specification.
The dict value is an API key prefix when generating the auth data.
:param username: Username for HTTP basic authentication
:param password: Password for HTTP basic authentication
:param signing_info: Configuration parameters for HTTP signature.
Must be an instance of argo.signing.HttpSigningConfiguration
:Example:
Given the following security scheme in the OpenAPI specification:
components:
securitySchemes:
cookieAuth: # name for the security scheme
type: apiKey
in: cookie
name: JSESSIONID # cookie name
You can programmatically set the cookie:
conf = argo.Configuration(
api_key={'cookieAuth': 'abc123'}
api_key_prefix={'cookieAuth': 'JSESSIONID'}
)
The following cookie will be added to the HTTP request:
Cookie: JSESSIONID abc123
Configure API client with HTTP basic authentication:
conf = argo.Configuration(
username='the-user',
password='the-password',
)
Configure API client with HTTP signature authentication. Use the 'hs2019' signature scheme,
sign the HTTP requests with the RSA-SSA-PSS signature algorithm, and set the expiration time
of the signature to 5 minutes after the signature has been created.
Note you can use the constants defined in the argo.signing module, and you can
also specify arbitrary HTTP headers to be included in the HTTP signature, except for the
'Authorization' header, which is used to carry the signature.
One may be tempted to sign all headers by default, but in practice it rarely works.
This is beccause explicit proxies, transparent proxies, TLS termination endpoints or
load balancers may add/modify/remove headers. Include the HTTP headers that you know
are not going to be modified in transit.
conf = argo.Configuration(
signing_info = argo.signing.HttpSigningConfiguration(
key_id = 'my-key-id',
private_key_path = 'rsa.pem',
signing_scheme = signing.SCHEME_HS2019,
signing_algorithm = signing.ALGORITHM_RSASSA_PSS,
signed_headers = [signing.HEADER_REQUEST_TARGET,
signing.HEADER_CREATED,
signing.HEADER_EXPIRES,
signing.HEADER_HOST,
signing.HEADER_DATE,
signing.HEADER_DIGEST,
'Content-Type',
'Content-Length',
'User-Agent'
],
signature_max_validity = datetime.timedelta(minutes=5)
)
)
"""

def __init__(self, host="http://localhost:2746",
api_key=None, api_key_prefix=None,
username=None, password=None,
signing_info=None):
api_key={}, api_key_prefix={},
username="", password=""):
"""Constructor
"""
self.host = host
Expand All @@ -110,14 +61,10 @@ def __init__(self, host="http://localhost:2746",
"""Temp file folder for downloading files
"""
# Authentication Settings
self.api_key = {}
if api_key:
self.api_key = api_key
self.api_key = api_key
"""dict to store API key(s)
"""
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
self.api_key_prefix = api_key_prefix
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
Expand All @@ -129,11 +76,6 @@ def __init__(self, host="http://localhost:2746",
self.password = password
"""Password for HTTP basic authentication
"""
if signing_info is not None:
signing_info.host = host
self.signing_info = signing_info
"""The HTTP signing configuration
"""
self.logger = {}
"""Logging Settings
"""
Expand Down Expand Up @@ -193,8 +135,6 @@ def __init__(self, host="http://localhost:2746",
self.retries = None
"""Adding retries to override urllib3 default value 3
"""
# Disable client side validation
self.client_side_validation = True

@property
def logger_file(self):
Expand Down Expand Up @@ -302,37 +242,31 @@ def get_basic_auth_token(self):
:return: The token for basic HTTP authentication.
"""
username = ""
if self.username is not None:
username = self.username
password = ""
if self.password is not None:
password = self.password
return urllib3.util.make_headers(
basic_auth=username + ':' + password
basic_auth=self.username + ':' + self.password
).get('authorization')

def auth_settings(self):
"""Gets Auth Settings dict for api client.
:return: The Auth Settings information dict.
"""
auth = {}
if 'authorization' in self.api_key:
auth['BearerToken'] = {
'type': 'api_key',
'in': 'header',
'key': 'authorization',
'value': self.get_api_key_with_prefix('authorization')
}
if self.username is not None and self.password is not None:
auth['HTTPBasic'] = {
'type': 'basic',
'in': 'header',
'key': 'Authorization',
'value': self.get_basic_auth_token()
}
return auth
return {
'BearerToken':
{
'type': 'api_key',
'in': 'header',
'key': 'authorization',
'value': self.get_api_key_with_prefix('authorization')
},
'HTTPBasic':
{
'type': 'basic',
'in': 'header',
'key': 'Authorization',
'value': self.get_basic_auth_token()
},
}

def to_debug_report(self):
"""Gets the essential information for debugging.
Expand All @@ -342,7 +276,7 @@ def to_debug_report(self):
return "Python SDK Debug Report:\n"\
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: v2.6.3\n"\
"Version of the API: v2.7.5\n"\
"SDK Package Version: 1.0.0".\
format(env=sys.platform, pyversion=sys.version)

Expand All @@ -358,37 +292,41 @@ def get_host_settings(self):
}
]

def get_host_from_settings(self, index, variables=None):
def get_host_from_settings(self, index, variables={}):
"""Gets host URL based on the index and variables
:param index: array index of the host settings
:param variables: hash of variable and the corresponding value
:return: URL based on host settings
"""
variables = {} if variables is None else variables

servers = self.get_host_settings()

try:
server = servers[index]
except IndexError:
# check array index out of bound
if index < 0 or index >= len(servers):
raise ValueError(
"Invalid index {0} when selecting the host settings. "
"Must be less than {1}".format(index, len(servers)))
"Invalid index {} when selecting the host settings. Must be less than {}" # noqa: E501
.format(index, len(servers)))

server = servers[index]
url = server['url']

# go through variables and replace placeholders
for variable_name, variable in server['variables'].items():
used_value = variables.get(
variable_name, variable['default_value'])

if 'enum_values' in variable \
and used_value not in variable['enum_values']:
raise ValueError(
"The variable `{0}` in the host URL has invalid value "
"{1}. Must be {2}.".format(
variable_name, variables[variable_name],
variable['enum_values']))

url = url.replace("{" + variable_name + "}", used_value)
# go through variable and assign a value
for variable_name in server['variables']:
if variable_name in variables:
if variables[variable_name] in server['variables'][
variable_name]['enum_values']:
url = url.replace("{" + variable_name + "}",
variables[variable_name])
else:
raise ValueError(
"The variable `{}` in the host URL has invalid value {}. Must be {}." # noqa: E501
.format(
variable_name, variables[variable_name],
server['variables'][variable_name]['enum_values']))
else:
# use default value
url = url.replace(
"{" + variable_name + "}",
server['variables'][variable_name]['default_value'])

return url
18 changes: 15 additions & 3 deletions argo/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"""
Argo
Workflow Service API performs CRUD actions against application resources # noqa: E501
Argo # noqa: E501
The version of the OpenAPI document: v2.6.3
The version of the OpenAPI document: v2.7.5
Generated by: https://openapi-generator.tech
"""

Expand All @@ -28,29 +28,39 @@
from argo.models.v1alpha1_artifactory_auth import V1alpha1ArtifactoryAuth
from argo.models.v1alpha1_backoff import V1alpha1Backoff
from argo.models.v1alpha1_continue_on import V1alpha1ContinueOn
from argo.models.v1alpha1_counter import V1alpha1Counter
from argo.models.v1alpha1_cron_workflow import V1alpha1CronWorkflow
from argo.models.v1alpha1_cron_workflow_list import V1alpha1CronWorkflowList
from argo.models.v1alpha1_cron_workflow_spec import V1alpha1CronWorkflowSpec
from argo.models.v1alpha1_cron_workflow_status import V1alpha1CronWorkflowStatus
from argo.models.v1alpha1_dag_task import V1alpha1DAGTask
from argo.models.v1alpha1_dag_template import V1alpha1DAGTemplate
from argo.models.v1alpha1_executor_config import V1alpha1ExecutorConfig
from argo.models.v1alpha1_gcs_artifact import V1alpha1GCSArtifact
from argo.models.v1alpha1_gcs_bucket import V1alpha1GCSBucket
from argo.models.v1alpha1_gauge import V1alpha1Gauge
from argo.models.v1alpha1_git_artifact import V1alpha1GitArtifact
from argo.models.v1alpha1_hdfs_artifact import V1alpha1HDFSArtifact
from argo.models.v1alpha1_hdfs_config import V1alpha1HDFSConfig
from argo.models.v1alpha1_hdfs_krb_config import V1alpha1HDFSKrbConfig
from argo.models.v1alpha1_http_artifact import V1alpha1HTTPArtifact
from argo.models.v1alpha1_histogram import V1alpha1Histogram
from argo.models.v1alpha1_info_response import V1alpha1InfoResponse
from argo.models.v1alpha1_inputs import V1alpha1Inputs
from argo.models.v1alpha1_item import V1alpha1Item
from argo.models.v1alpha1_item_value import V1alpha1ItemValue
from argo.models.v1alpha1_link import V1alpha1Link
from argo.models.v1alpha1_log_entry import V1alpha1LogEntry
from argo.models.v1alpha1_metadata import V1alpha1Metadata
from argo.models.v1alpha1_metric_label import V1alpha1MetricLabel
from argo.models.v1alpha1_metrics import V1alpha1Metrics
from argo.models.v1alpha1_node_status import V1alpha1NodeStatus
from argo.models.v1alpha1_oss_artifact import V1alpha1OSSArtifact
from argo.models.v1alpha1_oss_bucket import V1alpha1OSSBucket
from argo.models.v1alpha1_outputs import V1alpha1Outputs
from argo.models.v1alpha1_parallel_steps import V1alpha1ParallelSteps
from argo.models.v1alpha1_parameter import V1alpha1Parameter
from argo.models.v1alpha1_pod_gc import V1alpha1PodGC
from argo.models.v1alpha1_prometheus import V1alpha1Prometheus
from argo.models.v1alpha1_raw_artifact import V1alpha1RawArtifact
from argo.models.v1alpha1_resource_template import V1alpha1ResourceTemplate
from argo.models.v1alpha1_retry_strategy import V1alpha1RetryStrategy
Expand All @@ -65,6 +75,7 @@
from argo.models.v1alpha1_user_container import V1alpha1UserContainer
from argo.models.v1alpha1_value_from import V1alpha1ValueFrom
from argo.models.v1alpha1_workflow import V1alpha1Workflow
from argo.models.v1alpha1_workflow_condition import V1alpha1WorkflowCondition
from argo.models.v1alpha1_workflow_create_request import V1alpha1WorkflowCreateRequest
from argo.models.v1alpha1_workflow_lint_request import V1alpha1WorkflowLintRequest
from argo.models.v1alpha1_workflow_list import V1alpha1WorkflowList
Expand All @@ -74,6 +85,7 @@
from argo.models.v1alpha1_workflow_spec import V1alpha1WorkflowSpec
from argo.models.v1alpha1_workflow_status import V1alpha1WorkflowStatus
from argo.models.v1alpha1_workflow_step import V1alpha1WorkflowStep
from argo.models.v1alpha1_workflow_stop_request import V1alpha1WorkflowStopRequest
from argo.models.v1alpha1_workflow_suspend_request import V1alpha1WorkflowSuspendRequest
from argo.models.v1alpha1_workflow_template import V1alpha1WorkflowTemplate
from argo.models.v1alpha1_workflow_template_create_request import V1alpha1WorkflowTemplateCreateRequest
Expand Down
Loading

0 comments on commit d492eb2

Please sign in to comment.