From 471bb69703d9d4be38a92fc8ec8edc6433b09506 Mon Sep 17 00:00:00 2001 From: Bohdan Mateiko Date: Wed, 22 Sep 2021 20:16:17 +0300 Subject: [PATCH 1/4] adds support for writemem command --- ciscoasa/ciscoasa.go | 10 ++++++---- ciscoasa/save.go | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 ciscoasa/save.go diff --git a/ciscoasa/ciscoasa.go b/ciscoasa/ciscoasa.go index f9873e3..defc747 100644 --- a/ciscoasa/ciscoasa.go +++ b/ciscoasa/ciscoasa.go @@ -45,10 +45,11 @@ type Client struct { password string pageLimit int - Access *accessService - Interfaces *interfaceService - Objects *objectsService - Routing *routingService + Access *accessService + Interfaces *interfaceService + Objects *objectsService + Routing *routingService + SaveService *saveService } // ErrorResponse represents an error response @@ -115,6 +116,7 @@ func NewClient(apiURL, username, password string, sslNoVerify bool) (*Client, er c.Interfaces = &interfaceService{c} c.Objects = &objectsService{c} c.Routing = &routingService{c} + c.SaveService = &saveService{c} return c, nil } diff --git a/ciscoasa/save.go b/ciscoasa/save.go new file mode 100644 index 0000000..510af5d --- /dev/null +++ b/ciscoasa/save.go @@ -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 +} \ No newline at end of file From dd16fe32d3db19e4334d44d5f472069d6f288960 Mon Sep 17 00:00:00 2001 From: Bohdan Mateiko Date: Wed, 22 Sep 2021 20:21:23 +0300 Subject: [PATCH 2/4] renames SaceService property of a client struct --- ciscoasa/ciscoasa.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ciscoasa/ciscoasa.go b/ciscoasa/ciscoasa.go index defc747..0f72ee4 100644 --- a/ciscoasa/ciscoasa.go +++ b/ciscoasa/ciscoasa.go @@ -49,7 +49,7 @@ type Client struct { Interfaces *interfaceService Objects *objectsService Routing *routingService - SaveService *saveService + Save *saveService } // ErrorResponse represents an error response @@ -116,7 +116,7 @@ func NewClient(apiURL, username, password string, sslNoVerify bool) (*Client, er c.Interfaces = &interfaceService{c} c.Objects = &objectsService{c} c.Routing = &routingService{c} - c.SaveService = &saveService{c} + c.Save = &saveService{c} return c, nil } From c4473a1a60651d0bf1f7f879b3050a3e2ea3ba16 Mon Sep 17 00:00:00 2001 From: Bohdan Mateiko Date: Wed, 22 Sep 2021 22:06:21 +0300 Subject: [PATCH 3/4] fixes code formatting --- ciscoasa/ciscoasa.go | 10 +++++----- ciscoasa/save.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ciscoasa/ciscoasa.go b/ciscoasa/ciscoasa.go index 0f72ee4..f72f71a 100644 --- a/ciscoasa/ciscoasa.go +++ b/ciscoasa/ciscoasa.go @@ -45,11 +45,11 @@ type Client struct { password string pageLimit int - Access *accessService - Interfaces *interfaceService - Objects *objectsService - Routing *routingService - Save *saveService + Access *accessService + Interfaces *interfaceService + Objects *objectsService + Routing *routingService + Save *saveService } // ErrorResponse represents an error response diff --git a/ciscoasa/save.go b/ciscoasa/save.go index 510af5d..3ee20c5 100644 --- a/ciscoasa/save.go +++ b/ciscoasa/save.go @@ -32,4 +32,4 @@ func (s *saveService) WriteMem() error { } return nil -} \ No newline at end of file +} From 06cb7e54d0185b462d2587cf630d01f822128c8c Mon Sep 17 00:00:00 2001 From: Bohdan Mateiko Date: Thu, 23 Sep 2021 20:04:49 +0300 Subject: [PATCH 4/4] fixes module identificator in go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 983ae59..fa44094 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/xanzy/go-ciscoasa +module github.com/CiscoDevNet/go-ciscoasa go 1.16