Skip to content

Commit

Permalink
Merge pull request scottdware#87 from f5devcentral/devel_29092023_ven…
Browse files Browse the repository at this point in the history
…dor_sync

vendor sync
  • Loading branch information
RavinderReddyF5 authored Sep 29, 2023
2 parents ebe63e3 + 76c6599 commit 4ca00e7
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 9 deletions.
10 changes: 10 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module github.com/f5devcentral/go-bigip

go 1.20

require github.com/stretchr/testify v1.2.1

require (
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.2.1 h1:52QO5WkIUcHGIR7EnGagH88x1bUzqGXTC5/1bDTUQ7U=
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
89 changes: 89 additions & 0 deletions ltm.go
Original file line number Diff line number Diff line change
Expand Up @@ -1886,12 +1886,21 @@ type HttpCompressionProfile struct {
VaryHeader string `json:"varyHeader,omitempty"`
}

type CipherRule struct {
Name string `json:"name,omitempty"`
Partition string `json:"partition,omitempty"`
Cipher string `json:"cipher,omitempty"`
DHGroups string `json:"dhGroups,omitempty"`
SignatureAlgorithms string `json:"signatureAlgorithms,omitempty"`
}

const (
uriLtm = "ltm"
uriNode = "node"
uriPool = "pool"
uriPoolMember = "members"
uriProfile = "profile"
uriCipher = "cipher"
uriServerSSL = "server-ssl"
uriClientSSL = "client-ssl"
uriVirtual = "virtual"
Expand Down Expand Up @@ -1928,6 +1937,7 @@ const (
uriSSL = "ssl"
uriUniversal = "universal"
uriCreateDraft = "?options=create-draft"
uriRule = "rule"
)

var cidr = map[string]string{
Expand Down Expand Up @@ -3918,3 +3928,82 @@ func (b *BigIP) DeleteHttpCompressionProfile(name string) error {
func (b *BigIP) ModifyHttpCompressionProfile(name string, config *HttpCompressionProfile) error {
return b.put(config, uriLtm, uriProfile, uriHttpcompress, name)
}

type CipherRuleReq struct {
Name string `json:"name,omitempty"`
Partition string `json:"partition,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Cipher string `json:"cipher,omitempty"`
Description string `json:"description,omitempty"`
DhGroups string `json:"dhGroups,omitempty"`
SignatureAlgorithms string `json:"signatureAlgorithms,omitempty"`
}

func (b *BigIP) AddLtmCipherRule(config *CipherRuleReq) error {
return b.post(config, uriLtm, uriCipher, "rule")
}

func (b *BigIP) ModifyLtmCipherRule(name string, config *CipherRuleReq) error {
return b.put(config, uriLtm, uriCipher, "rule", name)
}

func (b *BigIP) DeleteLtmCipherRule(name string) error {
return b.delete(uriLtm, uriCipher, "rule", name)
}

func (b *BigIP) GetLtmCipherRule(name string) (*CipherRuleReq, error) {
var cipherRule CipherRuleReq
err, ok := b.getForEntity(&cipherRule, uriLtm, uriCipher, "rule", name)
if err != nil {
return nil, err
}

if !ok {
return nil, nil
}
return &cipherRule, nil
}

//
//type PolicyRule struct {
//Name string `json:"name,omitempty"`
//Partition string `json:"partition,omitempty"`
//NameReference struct {
//Link string `json:"link,omitempty"`
//} `json:"nameReference,omitempty"`
//}

type CipherGroupReq struct {
Name string `json:"name,omitempty"`
Partition string `json:"partition,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Ordering string `json:"ordering,omitempty"`
Allow []interface{} `json:"allow,omitempty"`
Require []interface{} `json:"require,omitempty"`
}

func (b *BigIP) AddLtmCipherGroup(config *CipherGroupReq) error {
return b.post(config, uriLtm, uriCipher, "group")
}

func (b *BigIP) ModifyLtmCipherGroup(name string, config *CipherGroupReq) error {
return b.put(config, uriLtm, uriCipher, "group", name)
}

func (b *BigIP) DeleteLtmCipherGroup(name string) error {
return b.delete(uriLtm, uriCipher, "group", name)
}

func (b *BigIP) GetLtmCipherGroup(name string) (*CipherGroupReq, error) {
var cipherGroup CipherGroupReq
err, ok := b.getForEntity(&cipherGroup, uriLtm, uriCipher, "group", name)
if err != nil {
return nil, err
}

if !ok {
return nil, nil
}

return &cipherGroup, nil
}
16 changes: 7 additions & 9 deletions sys.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"fmt"
"log"
"os"
"strconv"

//"strings"
"time"
Expand Down Expand Up @@ -809,20 +810,17 @@ func (b *BigIP) StartTransaction() (*Transaction, error) {
return transaction, nil
}

func (b *BigIP) EndTransaction(tId int64) error {
func (b *BigIP) CommitTransaction(tId int64) error {
b.Transaction = ""
commitTransaction := map[string]interface{}{
"state": "VALIDATING",
"validateOnly": false,
}
payload, err := json.Marshal(commitTransaction)
if err != nil {
return fmt.Errorf("unable create commit transaction payload: %s", err)
"state": "VALIDATING",
}
err = b.patch(payload, uriMgmt, uriTm, uriTransaction, string(tId))
log.Printf("[INFO] Commiting Transaction with TransactionID: %v", tId)

err := b.patch(commitTransaction, uriMgmt, uriTm, uriTransaction, strconv.Itoa(int(tId)))
if err != nil {
return fmt.Errorf("%s", err)
}
b.Transaction = ""
return nil
}

Expand Down
11 changes: 11 additions & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# github.com/davecgh/go-spew v1.1.0
## explicit
github.com/davecgh/go-spew/spew
# github.com/pmezard/go-difflib v1.0.0
## explicit
github.com/pmezard/go-difflib/difflib
# github.com/stretchr/testify v1.2.1
## explicit
github.com/stretchr/testify/assert
github.com/stretchr/testify/require
github.com/stretchr/testify/suite

0 comments on commit 4ca00e7

Please sign in to comment.