|
| 1 | +try: |
| 2 | + from urllib.parse import quote_plus |
| 3 | +except ImportError: |
| 4 | + from urllib import quote_plus |
| 5 | + |
| 6 | +import processout |
| 7 | +import json |
| 8 | + |
| 9 | +from processout.networking.request import Request |
| 10 | +from processout.networking.response import Response |
| 11 | + |
| 12 | +# The content of this file was automatically generated |
| 13 | + |
| 14 | + |
| 15 | +class ProjectSFTPSettingsPublic(object): |
| 16 | + def __init__(self, client, prefill=None): |
| 17 | + self._client = client |
| 18 | + |
| 19 | + self._enabled = None |
| 20 | + self._endpoint = None |
| 21 | + self._username = None |
| 22 | + if prefill is not None: |
| 23 | + self.fill_with_data(prefill) |
| 24 | + |
| 25 | + @property |
| 26 | + def enabled(self): |
| 27 | + """Get enabled""" |
| 28 | + return self._enabled |
| 29 | + |
| 30 | + @enabled.setter |
| 31 | + def enabled(self, val): |
| 32 | + """Set enabled |
| 33 | + Keyword argument: |
| 34 | + val -- New enabled value""" |
| 35 | + self._enabled = val |
| 36 | + return self |
| 37 | + |
| 38 | + @property |
| 39 | + def endpoint(self): |
| 40 | + """Get endpoint""" |
| 41 | + return self._endpoint |
| 42 | + |
| 43 | + @endpoint.setter |
| 44 | + def endpoint(self, val): |
| 45 | + """Set endpoint |
| 46 | + Keyword argument: |
| 47 | + val -- New endpoint value""" |
| 48 | + self._endpoint = val |
| 49 | + return self |
| 50 | + |
| 51 | + @property |
| 52 | + def username(self): |
| 53 | + """Get username""" |
| 54 | + return self._username |
| 55 | + |
| 56 | + @username.setter |
| 57 | + def username(self, val): |
| 58 | + """Set username |
| 59 | + Keyword argument: |
| 60 | + val -- New username value""" |
| 61 | + self._username = val |
| 62 | + return self |
| 63 | + |
| 64 | + def fill_with_data(self, data): |
| 65 | + """Fill the current object with the new values pulled from data |
| 66 | + Keyword argument: |
| 67 | + data -- The data from which to pull the new values""" |
| 68 | + if "enabled" in data.keys(): |
| 69 | + self.enabled = data["enabled"] |
| 70 | + if "endpoint" in data.keys(): |
| 71 | + self.endpoint = data["endpoint"] |
| 72 | + if "username" in data.keys(): |
| 73 | + self.username = data["username"] |
| 74 | + |
| 75 | + return self |
| 76 | + |
| 77 | + def to_json(self): |
| 78 | + return { |
| 79 | + "enabled": self.enabled, |
| 80 | + "endpoint": self.endpoint, |
| 81 | + "username": self.username, |
| 82 | + } |
| 83 | + |
| 84 | + def fetch_sftp_settings(self, id, options={}): |
| 85 | + """Fetch the SFTP settings for the project. |
| 86 | + Keyword argument: |
| 87 | + id -- ID of the project |
| 88 | + options -- Options for the request""" |
| 89 | + self.fill_with_data(options) |
| 90 | + |
| 91 | + request = Request(self._client) |
| 92 | + path = "/projects/" + quote_plus(id) + "/sftp-settings" |
| 93 | + data = { |
| 94 | + |
| 95 | + } |
| 96 | + |
| 97 | + response = Response(request.get(path, data, options)) |
| 98 | + return_values = [] |
| 99 | + |
| 100 | + body = response.body |
| 101 | + body = body["sftp_settings"] |
| 102 | + |
| 103 | + obj = processout.ProjectSFTPSettingsPublic(self._client) |
| 104 | + return_values.append(obj.fill_with_data(body)) |
| 105 | + |
| 106 | + return return_values[0] |
0 commit comments