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

docs-cleanup #52

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ address_data = {
"name": "test123",
"fqdn": "test123.example.com",
"description": "Created via pan-scm-sdk",
"folder": "Prisma Access",
"folder": "Texas",
}

# Create the address in Strata Cloud Manager
Expand Down
6 changes: 3 additions & 3 deletions docs/about/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ address_data = {
"name": "test-address",
"fqdn": "test.example.com",
"description": "Created via pan-scm-sdk",
"folder": "Prisma Access",
"folder": "Texas",
}

new_address = address.create(address_data)
Expand Down Expand Up @@ -103,7 +103,7 @@ address_group_data = {
"name": "example-group",
"description": "Test address group",
"static": ["test-address"],
"folder": "Prisma Access",
"folder": "Texas",
}

new_group = address_group.create(address_group_data)
Expand Down Expand Up @@ -138,7 +138,7 @@ application_data = {
"risk": 1,
"description": "Created via pan-scm-sdk",
"ports": ["tcp/80,443"],
"folder": "Prisma Access",
"folder": "Texas",
}

new_application = application.create(application_data)
Expand Down
26 changes: 13 additions & 13 deletions docs/sdk/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ client = Scm(
```python
# List addresses with parameters
response = client.get(
endpoint="/v1/objects/addresses",
params={"folder": "Shared", "limit": 100}
endpoint="/config/objects/v1/addresses",
params={"folder": "Texas", "limit": 100}
)
```

Expand All @@ -176,11 +176,11 @@ response = client.get(
# Create a new address object
new_address = {
"name": "example-address",
"folder": "Shared",
"folder": "Texas",
"ip_netmask": "192.168.1.0/24"
}
response = client.post(
endpoint="/v1/objects/addresses",
endpoint="/config/objects/v1/addresses",
json=new_address
)
```
Expand All @@ -200,7 +200,7 @@ updated_address = {
"ip_netmask": "192.168.2.0/24"
}
response = client.put(
endpoint="/v1/objects/addresses/example-address",
endpoint="/config/objects/v1/addresses/example-address",
json=updated_address
)
```
Expand All @@ -216,7 +216,7 @@ response = client.put(
```python
# Delete an address object
response = client.delete(
endpoint="/v1/objects/addresses/example-address"
endpoint="/config/objects/v1/addresses/example-address"
)
```

Expand Down Expand Up @@ -254,16 +254,16 @@ def perform_api_operations():
# Perform API operations
try:
# List addresses
addresses = client.get("/v1/objects/addresses")
addresses = client.get("/config/objects/v1/addresses")
print(f"Found {len(addresses)} addresses")

# Create new address
new_address = {
"name": "test-address",
"folder": "Shared",
"folder": "Texas",
"ip_netmask": "192.168.1.0/24"
}
created = client.post("/v1/objects/addresses", json=new_address)
created = client.post("/config/objects/v1/addresses", json=new_address)
print(f"Created address: {created['name']}")

except AuthenticationError as e:
Expand Down Expand Up @@ -332,12 +332,12 @@ client = Scm(


# Reuse for multiple operations
def get_address(name: str):
return client.get(f"/v1/objects/addresses/{name}")
def get_address(object_uuid: str):
return client.get(f"/config/objects/v1/addresses/{object_uuid}")


def create_address(address_data: dict):
return client.post("/v1/objects/addresses", json=address_data)
return client.post("/config/objects/v1/addresses", json=address_data)
```

</div>
Expand Down Expand Up @@ -368,7 +368,7 @@ with scm_client_session(
client_secret="your_client_secret",
tsg_id="your_tsg_id"
) as client:
addresses = client.get("/v1/objects/addresses")
addresses = client.get("/config/objects/v1/addresses")
```

</div>
Expand Down
28 changes: 12 additions & 16 deletions docs/sdk/config/objects/service_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ service_groups = ServiceGroup(client)
try:
group_data = {
"name": "web-services",
"description": "Web service group",
"services": ["HTTP", "HTTPS"],
"members": ["HTTP", "HTTPS"],
"folder": "Texas",
"tag": ["Python", "Automation"]
}
Expand Down Expand Up @@ -105,7 +104,7 @@ try:
group_id = "123e4567-e89b-12d3-a456-426655440000"
group = service_groups.get(group_id)
print(f"Group Name: {group.name}")
print(f"Services: {', '.join(group.services)}")
print(f"Members: {', '.join(group.members)}")

except NotFoundError as e:
print(f"Group not found: {e.message}")
Expand All @@ -125,14 +124,13 @@ try:
# Fetch returns a Pydantic model
web_group = service_groups.fetch(folder='Texas', name='web-services')

# Update the model's description attribute
web_group.description = 'Updated web services group'
web_group.services.append('HTTP-8080')
# Update the model's members
web_group.members.append('HTTP-8080')

# Update using the Pydantic model
updated_group = service_groups.update(web_group)
print(f"Updated group: {updated_group.name}")
print(f"New services: {', '.join(updated_group.services)}")
print(f"New members: {', '.join(updated_group.members)}")

except NotFoundError as e:
print(f"Group not found: {e.message}")
Expand Down Expand Up @@ -168,7 +166,7 @@ except ReferenceNotZeroError as e:
The `list()` method retrieves multiple service groups with optional filtering. You can filter the results using the
following kwargs:

- `values`: List[str] - Filter by service values (e.g., ['HTTP', 'HTTPS'])
- `values`: List[str] - Filter by member values (e.g., ['HTTP', 'HTTPS'])
- `tags`: List[str] - Filter by tags (e.g., ['Automation', 'Production'])

<div class="termy">
Expand All @@ -179,7 +177,7 @@ try:
# List all groups in a folder
groups = service_groups.list(folder="Texas")

# List groups with specific services
# List groups with specific members
web_groups = service_groups.list(
folder="Texas",
values=['HTTP', 'HTTPS']
Expand All @@ -194,7 +192,7 @@ try:
# Print the results
for group in groups:
print(f"Name: {group.name}")
print(f"Services: {', '.join(group.services)}")
print(f"Members: {', '.join(group.members)}")

except InvalidObjectError as e:
print(f"Invalid filter parameters: {e.message}")
Expand All @@ -218,7 +216,7 @@ try:
folder="Texas"
)
print(f"Found group: {group.name}")
print(f"Current services: {', '.join(group.services)}")
print(f"Current members: {', '.join(group.members)}")

except NotFoundError as e:
print(f"Group not found: {e.message}")
Expand Down Expand Up @@ -262,8 +260,7 @@ try:
# Create new service group
group_data = {
"name": "test-services",
"description": "Test service group",
"services": ["HTTP", "HTTPS", "SSH"],
"members": ["HTTP", "HTTPS", "SSH"],
"folder": "Texas",
"tag": ["Automation"]
}
Expand All @@ -280,12 +277,11 @@ try:
print(f"Found group: {fetched_group.name}")

# Update the group using Pydantic model
fetched_group.description = "Updated test services"
fetched_group.services.append("FTP")
fetched_group.members.append("FTP")

updated_group = service_groups.update(fetched_group)
print(f"Updated group: {updated_group.name}")
print(f"New services: {', '.join(updated_group.services)}")
print(f"New members: {', '.join(updated_group.members)}")

except NotFoundError as e:
print(f"Group not found: {e.message}")
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/config/security_services/decryption_profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ except InvalidObjectError as e:
try:
inbound_proxy = {
"name": "inbound-proxy",
"folder": "Shared",
"folder": "Texas",
"ssl_inbound_proxy": {
"block_if_no_resource": True,
"block_unsupported_cipher": True,
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/config/security_services/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ security_rule = SecurityRule(api_client)
# Define your intended object as a Python dictionary
sec_rule_dictionary = {
"name": "test123",
"folder": "Prisma Access",
"folder": "Texas",
"etc": "etc.."
}
# Perform operations
Expand Down
24 changes: 12 additions & 12 deletions docs/sdk/config/security_services/security_rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ security_rule = SecurityRule(client)
try:
rule_data = {
"name": "allow-web",
"folder": "Shared",
"folder": "Texas",
"from_": ["trust"],
"to": ["untrust"],
"source": ["any"],
Expand Down Expand Up @@ -111,7 +111,7 @@ except InvalidObjectError as e:
try:
rule_data = {
"name": "secure-web",
"folder": "Shared",
"folder": "Texas",
"from_": ["trust"],
"to": ["untrust"],
"source": ["internal-subnet"],
Expand Down Expand Up @@ -173,7 +173,7 @@ try:
# First fetch the existing rule as a Pydantic model
fetched_rule = security_rule.fetch(
name="allow-web",
folder="Shared",
folder="Texas",
rulebase="pre"
)

Expand Down Expand Up @@ -275,42 +275,42 @@ following kwargs:
try:
# List all rules in a folder's pre-rulebase
rules = security_rule.list(
folder="Shared",
folder="Texas",
rulebase="pre"
)

# List only allow rules
allow_rules = security_rule.list(
folder="Shared",
folder="Texas",
rulebase="pre",
action=['allow']
)

# List rules with specific applications
web_rules = security_rule.list(
folder="Shared",
folder="Texas",
rulebase="pre",
application=['web-browsing', 'ssl']
)

# List rules with specific zones
zone_rules = security_rule.list(
folder="Shared",
folder="Texas",
rulebase="pre",
from_=['trust'],
to_=['untrust']
)

# List rules with security profiles
secure_rules = security_rule.list(
folder="Shared",
folder="Texas",
rulebase="pre",
profile_setting=['strict-security']
)

# Combine multiple filters
filtered_rules = security_rule.list(
folder="Shared",
folder="Texas",
rulebase="pre",
action=['allow'],
application=['web-browsing'],
Expand Down Expand Up @@ -344,7 +344,7 @@ The `fetch()` method retrieves a single security rule by name from a specific co
try:
rule = security_rule.fetch(
name="allow-web",
folder="Shared",
folder="Texas",
rulebase="pre"
)

Expand Down Expand Up @@ -395,7 +395,7 @@ try:
create_data = {
"name": "test-web-access",
"description": "Test web access rule",
"folder": "Shared",
"folder": "Texas",
"from_": ["trust"],
"to": ["untrust"],
"source": ["internal-net"],
Expand Down Expand Up @@ -423,7 +423,7 @@ try:
try:
fetched_rule = security_rule.fetch(
name="test-web-access",
folder="Shared",
folder="Texas",
rulebase="pre"
)
print(f"Found rule: {fetched_rule.name}")
Expand Down
Loading