Skip to content

Commit

Permalink
Merge pull request #14 from id27182/feature/implement-save-resource
Browse files Browse the repository at this point in the history
Added support for WriteMem
  • Loading branch information
sameesin authored Sep 27, 2021
2 parents 9faef30 + 2bb2c20 commit e02e6ee
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ciscoasa/ciscoasa.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type Client struct {
Nat *natService
Failover *failoverService
Licensing *licenseService
Save *saveService
}

// ErrorResponse represents an error response
Expand Down Expand Up @@ -120,6 +121,7 @@ func NewClient(apiURL, username, password string, sslNoVerify bool) (*Client, er
c.Interfaces = &interfaceService{c}
c.Objects = &objectsService{c}
c.Routing = &routingService{c}
c.Save = &saveService{c}
c.DeviceSetup = &devicesetupService{c}
c.Dhcp = &dhcpService{c}
c.Nat = &natService{c}
Expand Down
35 changes: 35 additions & 0 deletions ciscoasa/save.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Copyright 2017, Rutger te Nijenhuis & Sander van Harmelen
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

package ciscoasa

type saveService struct {
*Client
}

func (s *saveService) WriteMem() error {
req, err := s.newRequest("POST", "/api/commands/writemem", nil)
if err != nil {
return err
}

_, err = s.do(req, nil)
if err != nil {
return err
}

return nil
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/xanzy/go-ciscoasa
module github.com/CiscoDevNet/go-ciscoasa

go 1.16

0 comments on commit e02e6ee

Please sign in to comment.