Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the vcs-repository/repositories endpoint request #182

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jumiles-pa
Copy link

@jumiles-pa jumiles-pa commented Dec 31, 2024

Description

The api code/api/v1/vcs-repository/repositories does not seem to be supported in the module. This is adding support for this specific request.
https://pan.dev/prisma-cloud/api/code/get-vcs-repository-page/

https://github.com/PaloAltoNetworks/pan.dev/blob/39672e2ae8eb3973ff344a0e619f319be373b80c/openapi-specs/code/Repositories.json#L1100

Motivation and Context

Discussion with a coworker to use this request lead to finding this unsupported endpoint. Using this python library is a great way to account for assumptions that can be overlooked when writing scripts from scratch.

My coworker is able to make the request in scripts written from scratch so I saw this as an opportunity to codify the knowledge quickly.

How Has This Been Tested?

Below is the python script I used to try this implementation. It's mostly the 'getting started' script used to demo the library with the new function call added. I built and installed the module from the cloned codebase locally on a Windows computer. Initial tests on the first commit used a GET method and failed with the 500 error but, succeed with a POST method. Other functions work with this script as well which gives me confidence that I have isolated the test case.

#!/bin/bash python
import pprint, sys, os
from pathlib import Path
sys.path.append(os.path.abspath(f"{Path.home()}/local/"))
from imports import PRISMA_ACCESS_KEY, PRISMA_SECRET_KEY


from prismacloud.api import pc_api

settings = {
    "url":      "https://api2.prismacloud.io/",
    "identity": PRISMA_ACCESS_KEY,
    "secret":   PRISMA_SECRET_KEY
}

pc_api.configure(settings=settings)

pc_api.debug = True

print(pc_api.vcs_repositories_list_read())

I see that it will be good to demonstrate this test in GitHub. I would intend to set this up soon.

Screenshots (if appropriate)

Types of changes

This should be considered a new feature. The api has been available for some time but, this library is not automatically updated with new endpoints. This is a fairly minor change and is unlikely to effect any of the rest of the module.

I suspect there are several endpoints that are also not yet supported and very similar to this one. This is my first contribution to the library so I want to go through the process to be more proficient with further contributions. Researching other missing endpoints may take some time since for this one I was looking for it.

Checklist

  • I have updated the documentation accordingly.

  • I have read the CONTRIBUTING document.

  • I have added tests to cover my changes if appropriate.

  • All new and existing tests passed.

@jumiles-pa jumiles-pa changed the title Add the code/api/v1/vcs-repository/repositories endpoint request Add the vcs-repository/repositories endpoint request Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant