# coding: utf-8 """ AlphaApi.py Copyright 2015 SmartBear Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from __future__ import absolute_import import sys import os # python 2 and python 3 compatibility library from six import iteritems from ..configuration import Configuration from ..api_client import ApiClient class AlphaApi(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): config = Configuration() if api_client: self.api_client = api_client else: if not config.api_client: config.api_client = ApiClient() self.api_client = config.api_client def server_changes_post(self, server, changelist_request, **kwargs): """ Create a new changelist that can affect multiple files using different kinds of actions.\nIf you require the ability to integrate or move, for example, you can use this method. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.server_changes_post(server, changelist_request, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str server: The server ID that we execute this particular method against. (required) :param ChangelistRequest changelist_request: Description of changes to make (required) :return: CommandResponse If the method is called asynchronously, returns the request thread. """ all_params = ['server', 'changelist_request'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method server_changes_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'server' is set if ('server' not in params) or (params['server'] is None): raise ValueError("Missing the required parameter `server` when calling `server_changes_post`") # verify the required parameter 'changelist_request' is set if ('changelist_request' not in params) or (params['changelist_request'] is None): raise ValueError("Missing the required parameter `changelist_request` when calling `server_changes_post`") resource_path = '/p4d/v16.1/{server}/changes'.replace('{format}', 'json') method = 'POST' path_params = {} if 'server' in params: path_params['server'] = params['server'] query_params = {} header_params = {} form_params = {} files = {} body_params = None if 'changelist_request' in params: body_params = params['changelist_request'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['ticket_auth'] response = self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, files=files, response_type='CommandResponse', auth_settings=auth_settings, callback=params.get('callback')) return response def server_git_fusion_repos_get(self, server, **kwargs): """ Lists all configured repositories readable by the current user. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.server_git_fusion_repos_get(server, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str server: The server ID that we execute this particular method against. (required) :return: list[GitFusionRepoId] If the method is called asynchronously, returns the request thread. """ all_params = ['server'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method server_git_fusion_repos_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'server' is set if ('server' not in params) or (params['server'] is None): raise ValueError("Missing the required parameter `server` when calling `server_git_fusion_repos_get`") resource_path = '/p4d/v16.1/{server}/git-fusion-repos'.replace('{format}', 'json') method = 'GET' path_params = {} if 'server' in params: path_params['server'] = params['server'] query_params = {} header_params = {} form_params = {} files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['ticket_auth'] response = self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, files=files, response_type='list[GitFusionRepoId]', auth_settings=auth_settings, callback=params.get('callback')) return response def server_git_fusion_repos_post(self, server, body, **kwargs): """ Submits a [p4gf_config](http://www.perforce.com/perforce/r15.1/manuals/git-fusion/chapter_dyn_ngj_3l.html#section_jgz_nz2_2j) file to create or update a repository configuration.\n\nIf the repository does not exist or has been previously deleted, this method saves contents of the config file to a new `p4gf_config` file.\nIf the repository has already been initialised, this method replaces all of the file contents of the specified repository's `p4gf_config` file. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.server_git_fusion_repos_post(server, body, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str server: The server ID that we execute this particular method against. (required) :param GitFusionRepoConfig body: The new configuration (required) :return: CommandResponse If the method is called asynchronously, returns the request thread. """ all_params = ['server', 'body'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method server_git_fusion_repos_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'server' is set if ('server' not in params) or (params['server'] is None): raise ValueError("Missing the required parameter `server` when calling `server_git_fusion_repos_post`") # verify the required parameter 'body' is set if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `server_git_fusion_repos_post`") resource_path = '/p4d/v16.1/{server}/git-fusion-repos'.replace('{format}', 'json') method = 'POST' path_params = {} if 'server' in params: path_params['server'] = params['server'] query_params = {} header_params = {} form_params = {} files = {} body_params = None if 'body' in params: body_params = params['body'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['ticket_auth'] response = self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, files=files, response_type='CommandResponse', auth_settings=auth_settings, callback=params.get('callback')) return response def server_git_fusion_repos_repo_get(self, server, repo, **kwargs): """ Return configuration for the specified repository.\nGrabs and returns contents of the [p4gf_config](http://www.perforce.com/perforce/r15.1/manuals/git-fusion/chapter_dyn_ngj_3l.html#section_jgz_nz2_2j) file for given repository. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.server_git_fusion_repos_repo_get(server, repo, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str server: The server ID that we execute this particular method against. (required) :param str repo: The Git Fusion Repo ID (required) :return: GitFusionRepoConfig If the method is called asynchronously, returns the request thread. """ all_params = ['server', 'repo'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method server_git_fusion_repos_repo_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'server' is set if ('server' not in params) or (params['server'] is None): raise ValueError("Missing the required parameter `server` when calling `server_git_fusion_repos_repo_get`") # verify the required parameter 'repo' is set if ('repo' not in params) or (params['repo'] is None): raise ValueError("Missing the required parameter `repo` when calling `server_git_fusion_repos_repo_get`") resource_path = '/p4d/v16.1/{server}/git-fusion-repos/{repo}'.replace('{format}', 'json') method = 'GET' path_params = {} if 'server' in params: path_params['server'] = params['server'] if 'repo' in params: path_params['repo'] = params['repo'] query_params = {} header_params = {} form_params = {} files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['ticket_auth'] response = self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, files=files, response_type='GitFusionRepoConfig', auth_settings=auth_settings, callback=params.get('callback')) return response def server_git_fusion_repos_repo_delete(self, server, repo, **kwargs): """ Deletes the repository configuration (The [p4gf_config file](http://www.perforce.com/perforce/r15.1/manuals/git-fusion/chapter_dyn_ngj_3l.html#section_jgz_nz2_2j)).\nContents of the repository are not deleted from Perforce. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.server_git_fusion_repos_repo_delete(server, repo, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str server: The server ID that we execute this particular method against. (required) :param str repo: The Git Fusion Repo ID (required) :return: CommandResponse If the method is called asynchronously, returns the request thread. """ all_params = ['server', 'repo'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method server_git_fusion_repos_repo_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'server' is set if ('server' not in params) or (params['server'] is None): raise ValueError("Missing the required parameter `server` when calling `server_git_fusion_repos_repo_delete`") # verify the required parameter 'repo' is set if ('repo' not in params) or (params['repo'] is None): raise ValueError("Missing the required parameter `repo` when calling `server_git_fusion_repos_repo_delete`") resource_path = '/p4d/v16.1/{server}/git-fusion-repos/{repo}'.replace('{format}', 'json') method = 'DELETE' path_params = {} if 'server' in params: path_params['server'] = params['server'] if 'repo' in params: path_params['repo'] = params['repo'] query_params = {} header_params = {} form_params = {} files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['ticket_auth'] response = self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, files=files, response_type='CommandResponse', auth_settings=auth_settings, callback=params.get('callback')) return response def server_git_fusion_repos_repo_patch(self, server, repo, body, **kwargs): """ Updates values in the repository configuration.\nThis method will find all specified parameters and update each value for the specified repository's configuration file. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.server_git_fusion_repos_repo_patch(server, repo, body, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str server: The server ID that we execute this particular method against. (required) :param str repo: The Git Fusion Repo ID (required) :param GitFusionRepoConfig body: The new configuration (required) :return: CommandResponse If the method is called asynchronously, returns the request thread. """ all_params = ['server', 'repo', 'body'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method server_git_fusion_repos_repo_patch" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'server' is set if ('server' not in params) or (params['server'] is None): raise ValueError("Missing the required parameter `server` when calling `server_git_fusion_repos_repo_patch`") # verify the required parameter 'repo' is set if ('repo' not in params) or (params['repo'] is None): raise ValueError("Missing the required parameter `repo` when calling `server_git_fusion_repos_repo_patch`") # verify the required parameter 'body' is set if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `server_git_fusion_repos_repo_patch`") resource_path = '/p4d/v16.1/{server}/git-fusion-repos/{repo}'.replace('{format}', 'json') method = 'PATCH' path_params = {} if 'server' in params: path_params['server'] = params['server'] if 'repo' in params: path_params['repo'] = params['repo'] query_params = {} header_params = {} form_params = {} files = {} body_params = None if 'body' in params: body_params = params['body'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['ticket_auth'] response = self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, files=files, response_type='CommandResponse', auth_settings=auth_settings, callback=params.get('callback')) return response
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 19597 | swellard | Refactor REST path | ||
#1 | 19553 | swellard | Move and rename clients | ||
//guest/perforce_software/helix-web-services/main/source/clients/2016.1.0/python/helix_web_services_client/apis/alpha_api.py | |||||
#4 | 19202 | tjuricek | Revised documentation for the Ruby Client SDK; removed obsolete methods and definitions, and restyled a lot of the tables. | ||
#3 | 19002 | tjuricek |
Improve API to interact with multiple p4ds. The configuration now requires an explicit setting of what P4Ds HWS can talk to via the 'P4D config dir', where there's a file indicating connection settings per p4d, and importantly, an ID. This is the "server ID" referenced everywhere. Most methods now require a server ID to indicate which p4d to manipulate. In the future, it's likely we will interact with *multiple* p4d instances on some services. This completely removes the ability to run HWS as a kind of an "open proxy" to whatever p4d you want. Given the nature of the change and the lack of priority, we've removed Helix Cloud testing and disabled several methods from their "Helix Cloud" implementation. These will be relatively easy to bring back, we'll just need a new method from Raymond that lists the "allowed server IDs" that map to the HWS configured server IDs for a particular user. Another notable aspect of this change is the use of JSON Web Token to create our authentication key. We associate this key with an in-memory "session" that contains the P4D tickets we use to authenticate users. The JWT token, by default, is assigned a timeout, which allows HWS to block further access to underlying servers without having to interact with multiple auth backends. If any backend fails with that session, the user will get a 403. If you disable the timeout, you'll need to ensure your clients clear out sessions. |
||
#2 | 18905 | tjuricek |
Add Git Fusion environent configuration and testing, and altered the implementation to use the newly defined API. Note: only runs on linux. We use latest GF production for testing and GF packages are linux only. The "integration" is pretty "light" at this point. This does require the test machine to have our package repository setup. |
||
#1 | 18818 | tjuricek | Python Client SDK for Helix Web Services |