@@ -64,7 +64,12 @@ def set_repo(
6464 installation_id = None
6565 ):
6666 """
67- Activate repository for Cirun
67+ Activate or deactivate a repository for Cirun.
68+
69+ This method allows you to enable or disable a repository's integration with Cirun.
70+ When activating a repository, it can also handle the installation of the Cirun
71+ GitHub App if an `installation_id` is provided and `GITHUB_TOKEN` environment
72+ variable is set.
6873
6974 Parameters
7075 ----------
@@ -173,7 +178,8 @@ def _create_access_control_repo_resource_data(
173178
174179 def remove_repo_from_resources (self , org , repo , resources ):
175180 """
176- Removes the access to the resource for the repository.
181+ Creates a Pull request in the `<org>/.cirun` repository updating the `.access.yml`
182+ to revoke access to specified resources for a repository within an organization.
177183
178184 Parameters
179185 ----------
@@ -205,31 +211,40 @@ def add_repo_to_resources(
205211 policy_args = None ,
206212 ):
207213 """
208- Grants access to the resource for the repository
214+ Creates a Pull request in the `<org>/.cirun` repository updating the `.access.yml`
215+ to grant access to specified resources for a repository within an organization,
216+ with constraints for teams, roles, users, users_from_json, policy_args.
209217
210218 Parameters
211219 ----------
212- org: str
213- GitHub Organization
214- repo: str
215- GitHub Repository
216- resources: List[str]
217- List of resources
218- teams: List[str]
219- List of teams
220- roles: List[str]
221- List of roles
222- users: List[str]
223- List of users
224- users_from_json: List[str]
225- List of users from a json url
226- policy_args: Optional[Dict[str, Any]]
227- Policy arguments, this is a dictionary of key values, currently the only
228- supported argument is ``{"pull_request": True}`` or ``{"pull_request": False}``
220+ org : str
221+ The GitHub organization name.
222+ repo : str
223+ The name of the repository to which resources are to be added.
224+ resources : list of str
225+ A list of resource identifiers to grant access to.
226+ teams : list of str, optional
227+ Teams to grant access to the resources.
228+ roles : list of str, optional
229+ Roles to grant access to the resource, i.e. users with specified roles
230+ will have access to the resources.
231+ users : list of str, optional
232+ Users to grant access to the resources.
233+ users_from_json : str, optional
234+ Users specified via a JSON URL
235+ policy_args : dict, optional
236+ Additional policy arguments, such as `{"pull_request": True}` to enforce
237+ specific policies on access.
229238
230239 Returns
231240 -------
232241 requests.Response
242+ The response object from the API after attempting to add access.
243+
244+ Raises
245+ ------
246+ CirunAPIException
247+ If the API call fails with an error status code.
233248 """
234249 repository_resource_access = self ._create_access_control_repo_resource_data (
235250 repo , resources , action = "add" , teams = teams , roles = roles ,
@@ -243,6 +258,30 @@ def _get_repo_policy(self, access_yml, repo):
243258 return policy ['id' ]
244259
245260 def get_repo_resources (self , org , repo ):
261+ """
262+ Retrieve the list of resources that a repository has access to within an organization.
263+
264+ This method parses the access control configuration to determine which resources
265+ the specified repository is permitted to access based on its assigned policies.
266+
267+ Parameters
268+ ----------
269+ org : str
270+ The GitHub organization name.
271+ repo : str
272+ The repository name whose accessible resources are to be retrieved.
273+
274+ Returns
275+ -------
276+ list of str or None
277+ A list of resource identifiers that the repository has access to, or `None`
278+ if access control configuration is not found.
279+
280+ Raises
281+ ------
282+ KeyError
283+ If the repository does not have an associated policy in the access control configuration.
284+ """
246285 access_control = self .get_access_control (org )
247286 if not access_control :
248287 return
@@ -255,7 +294,28 @@ def get_repo_resources(self, org, repo):
255294 return repo_resources
256295
257296 def clouds (self , print_error = False ):
258- """Returns all the connected cloud"""
297+ """
298+ Retrieve all cloud providers connected to Cirun.
299+
300+ This method fetches the list of cloud providers that have been integrated
301+ with Cirun (have credentials added to cirun).
302+
303+ Parameters
304+ ----------
305+ print_error : bool, optional
306+ If set to True, errors encountered during the API call will be printed.
307+ Default is False.
308+
309+ Returns
310+ -------
311+ dict
312+ A dictionary containing information about connected cloud providers.
313+
314+ Raises
315+ ------
316+ CirunAPIException
317+ If the API call fails and `print_error` is False.
318+ """
259319 response = self ._get ("cloud-connect" )
260320 if response .status_code not in [200 , 201 ]:
261321 if print_error :
@@ -264,7 +324,11 @@ def clouds(self, print_error=False):
264324
265325 def cloud_connect (self , name , credentials , print_error = False ):
266326 """
267- Connect a cloud provider to cirun.
327+ Connect a new cloud provider to Cirun.
328+
329+ This method integrates a specified cloud provider with Cirun by providing the
330+ necessary credentials. Once connected, the cloud provider can be used to create
331+ GitHub Actions runners.
268332
269333 Parameters
270334 ----------
@@ -277,6 +341,11 @@ def cloud_connect(self, name, credentials, print_error=False):
277341 -------
278342 dict:
279343 Response json
344+
345+ Raises
346+ ------
347+ CirunAPIException
348+ If the API call fails and `print_error` is False.
280349 """
281350
282351 data = {
0 commit comments