25
25
26
26
EXTERNAL_ACCOUNT_PATH = "/externalAccounts/%s"
27
27
EXTERNAL_ACCOUNT_FETCH_PATH = "/externalAccounts/%s/%s"
28
+ EXTERNAL_ACCOUNT_CONFIG_FETCH_PATH = "/externalAccounts/account/%s"
28
29
29
30
def get_supported_categories (resource_root ):
30
31
"""
@@ -125,7 +126,6 @@ def delete_external_account(resource_root, name):
125
126
EXTERNAL_ACCOUNT_FETCH_PATH % ("delete" , name ,),
126
127
ApiExternalAccount , False )
127
128
128
-
129
129
class ApiExternalAccountCategory (BaseApiObject ):
130
130
_ATTRIBUTES = {
131
131
'name' : None ,
@@ -151,7 +151,7 @@ def __str__(self):
151
151
return "<ApiExternalAccountType>: %s (categoryName: %s)" % (
152
152
self .name , self .typeName )
153
153
154
- class ApiExternalAccount (BaseApiObject ):
154
+ class ApiExternalAccount (BaseApiResource ):
155
155
_ATTRIBUTES = {
156
156
'name' : None ,
157
157
'displayName' : None ,
@@ -163,9 +163,32 @@ class ApiExternalAccount(BaseApiObject):
163
163
164
164
def __init__ (self , resource_root , name = None , displayName = None ,
165
165
typeName = None , accountConfigs = None ):
166
- BaseApiObject .init (self , resource_root , locals ())
166
+ BaseApiResource .init (self , resource_root , locals ())
167
167
168
168
def __str__ (self ):
169
169
return "<ApiExternalAccount>: %s (typeName: %s)" % (
170
170
self .name , self .typeName )
171
171
172
+ def _path (self ):
173
+ return EXTERNAL_ACCOUNT_CONFIG_FETCH_PATH % self .name
174
+
175
+ def get_config (self , view = None ):
176
+ """
177
+ Retrieve the external account's configuration.
178
+
179
+ The 'summary' view contains strings as the dictionary values. The full
180
+ view contains ApiConfig instances as the values.
181
+
182
+ @param view: View to materialize ('full' or 'summary')
183
+ @return: Dictionary with configuration data.
184
+ """
185
+ return self ._get_config ("config" , view )
186
+
187
+ def update_config (self , config ):
188
+ """
189
+ Update the external account's configuration.
190
+
191
+ @param config: Dictionary with configuration to update.
192
+ @return: Dictionary with updated configuration.
193
+ """
194
+ return self ._update_config ("config" , config )
0 commit comments