Skip to content

Commit

Permalink
rc.1
Browse files Browse the repository at this point in the history
v2 cleanup
  • Loading branch information
migara committed Sep 12, 2024
2 parents 2b93408 + 35c466b commit 16559b0
Show file tree
Hide file tree
Showing 1,186 changed files with 23,123 additions and 114,952 deletions.
30 changes: 18 additions & 12 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
Distributed under ISC license:
MIT License

Copyright (c) 2014-2016, Palo Alto Networks Inc.
Copyright (c) 2020 Palo Alto Networks, inc.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
55 changes: 21 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
Palo Alto Networks pango
========================

[![GoDoc](https://godoc.org/github.com/PaloAltoNetworks/pango?status.svg)](https://godoc.org/github.com/PaloAltoNetworks/pango)
[![Build](https://github.com/PaloAltoNetworks/pango/workflows/Sanity%20Check/badge.svg?branch=master)](https://github.com/PaloAltoNetworks/pango/actions?query=workflow%3A%22Sanity+Check%22)
> [!NOTE]
> This package is auto-generated via [pan-os-codegen](https://github.com/PaloAltoNetworks/pan-os-codegen)
Package pango is a golang cross version mechanism for interacting with Palo Alto Networks devices (including physical and virtualized Next-generation Firewalls and Panorama). Versioning support is in place for PANOS 6.1 to 10.0.
> [!CAUTION]
> This software is currently in alpha development stage. It is strongly recommended not to use this package in production environments. If you choose to use it for experimental or developmental purposes, please do so with caution.

<!-- [![GoDoc](https://godoc.org/github.com/PaloAltoNetworks/pango?status.svg)](https://godoc.org/github.com/PaloAltoNetworks/pango) -->
<!-- [![Build](https://github.com/PaloAltoNetworks/pango/workflows/Sanity%20Check/badge.svg?branch=main)](https://github.com/PaloAltoNetworks/pango/actions?query=workflow%3A%22Sanity+Check%22) -->

Package pango is a golang cross version mechanism for interacting with Palo Alto Networks devices (including physical and virtualized Next-generation Firewalls and Panorama). Versioning support is in place for PANOS 10.1 and above.

Please refer to the godoc reference documentation above to get started.

Expand All @@ -24,43 +31,23 @@ import (
func main() {
var err error

c := &pango.Firewall{Client: pango.Client{
con = &sdk.Client{
Hostname: "127.0.0.1",
Username: "admin",
Password: "admin",
Logging: pango.LogAction | pango.LogOp,
}}
if err = c.Initialize(); err != nil {
}

if err := con.Setup(); err != nil {
log.Printf("Failed to setup client: %s", err)
return
}

if err := con.Initialize(ctx); err != nil {
log.Printf("Failed to initialize client: %s", err)
return
}
log.Printf("Initialize ok")
}
```

Initializing the connection creates the API key (if it was not already specified), then performs `show system info` to get the PANOS version. Once the firewall client connection is created, you can query and configure the Palo Alto Networks device from the functions inside the various namespaces of the client connection. Namespaces correspond to the various configuration areas available in the GUI. For example:
log.Printf("Initialize ok")

```go
err = c.Network.EthernetInterface.Set(...)
myPolicies, err := c.Policies.Security.GetList()
}
```

Generally speaking, there are the following functions inside each namespace:

* `Get()` / `GetList()` / `GetAll()`
* `Show()` / `ShowList()` / `ShowAll()`
* `Set()`
* `Edit()`
* `Delete()`

These functions correspond with PANOS `Get`, `Show`, `Set`, `Edit`, and `Delete` API calls. `Get()`, `Set()`, and `Edit()` take and return normalized, version independent objects. These version safe objects are typically named `Entry`, which corresponds to how the object is placed in the PANOS XPATH.

Some `Entry` objects have a special function, `Defaults()`. Invoking this function will initialize the object with some default values. Each `Entry` that implements `Defaults()` calls out in its documentation what parameters are affected by this, and what the defaults are.

For any version safe object, attempting to configure a parameter that your PANOS doesn't support will be safely ignored in the resultant XML sent to the firewall / Panorama.


Using `Edit` Functions
======================

The PANOS XML API `Edit` command can be used to both create as well as update existing config, however it can also truncate config for the given XPATH. Due to this, if you want to use `Edit()`, you need to make sure that you perform either a `Get()` or a `Show()` first, make your modification, then invoke `Edit()` using that object. If you don't do this, you will truncate any sub config.
16 changes: 2 additions & 14 deletions SUPPORT.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
Community Supported
# Community Supported

The software and templates in the repo are released under an as-is, best effort,
support policy. This software should be seen as community supported and Palo
Alto Networks will contribute our expertise as and when possible. We do not
provide technical support or help in using or troubleshooting the components of
the project through our normal support options such as Palo Alto Networks
support teams, or ASC (Authorized Support Centers) partners and backline support
options. The underlying product used (the VM-Series firewall) by the scripts or
templates are still supported, but the support is only for the product
functionality and not for help in deploying or using the template or script
itself. Unless explicitly tagged, all projects or work posted in our GitHub
repository (at https://github.com/PaloAltoNetworks) or sites other than our
official Downloads page on https://support.paloaltonetworks.com are provided
under the best effort policy.
This template/script/solution is released “as-is”, with no warranty and no support. These should be seen as community supported and Palo Alto Networks may contribute its expertise at its discretion. Palo Alto Networks, including through its Authorized Support Centers (ASC) partners and backline support options, will not provide technical support or help in using or troubleshooting this template/script/solution. The underlying product used by this template/script/solution will still be supported in accordance with the product’s applicable support policy and the customer’s entitlements.
Loading

0 comments on commit 16559b0

Please sign in to comment.