-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #223 from sujithramagesh/EUM_TERRAFORM_PROVIDER_BR…
…ANCH Changes for Web Transaction Browser, FTP Transfer and ISP Resource.
- Loading branch information
Showing
39 changed files
with
5,087 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package fake | ||
|
||
import ( | ||
"github.com/site24x7/terraform-provider-site24x7/api" | ||
"github.com/site24x7/terraform-provider-site24x7/api/endpoints/monitors" | ||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
var _ monitors.FTPTransferMonitors = &FTPTransferMonitors{} | ||
|
||
type FTPTransferMonitors struct { | ||
mock.Mock | ||
} | ||
|
||
func (e *FTPTransferMonitors) Get(monitorID string) (*api.FTPTransferMonitor, error) { | ||
args := e.Called(monitorID) | ||
if obj, ok := args.Get(0).(*api.FTPTransferMonitor); ok { | ||
return obj, args.Error(1) | ||
} | ||
return nil, args.Error(1) | ||
} | ||
|
||
func (e *FTPTransferMonitors) Create(monitor *api.FTPTransferMonitor) (*api.FTPTransferMonitor, error) { | ||
args := e.Called(monitor) | ||
if obj, ok := args.Get(0).(*api.FTPTransferMonitor); ok { | ||
return obj, args.Error(1) | ||
} | ||
return nil, args.Error(1) | ||
} | ||
|
||
func (e *FTPTransferMonitors) Update(monitor *api.FTPTransferMonitor) (*api.FTPTransferMonitor, error) { | ||
args := e.Called(monitor) | ||
if obj, ok := args.Get(0).(*api.FTPTransferMonitor); ok { | ||
return obj, args.Error(1) | ||
} | ||
return nil, args.Error(1) | ||
} | ||
|
||
func (e *FTPTransferMonitors) Delete(monitorID string) error { | ||
args := e.Called(monitorID) | ||
return args.Error(0) | ||
} | ||
|
||
func (e *FTPTransferMonitors) List() ([]*api.FTPTransferMonitor, error) { | ||
args := e.Called() | ||
if obj, ok := args.Get(0).([]*api.FTPTransferMonitor); ok { | ||
return obj, args.Error(1) | ||
} | ||
return nil, args.Error(1) | ||
} | ||
|
||
func (e *FTPTransferMonitors) Activate(monitorID string) error { | ||
args := e.Called(monitorID) | ||
return args.Error(0) | ||
} | ||
|
||
func (e *FTPTransferMonitors) Suspend(monitorID string) error { | ||
args := e.Called(monitorID) | ||
return args.Error(0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package fake | ||
|
||
import ( | ||
"github.com/site24x7/terraform-provider-site24x7/api" | ||
"github.com/site24x7/terraform-provider-site24x7/api/endpoints/monitors" | ||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
var _ monitors.ISPMonitors = &ISPMonitors{} | ||
|
||
type ISPMonitors struct { | ||
mock.Mock | ||
} | ||
|
||
func (e *ISPMonitors) Get(monitorID string) (*api.ISPMonitor, error) { | ||
args := e.Called(monitorID) | ||
if obj, ok := args.Get(0).(*api.ISPMonitor); ok { | ||
return obj, args.Error(1) | ||
} | ||
return nil, args.Error(1) | ||
} | ||
|
||
func (e *ISPMonitors) Create(monitor *api.ISPMonitor) (*api.ISPMonitor, error) { | ||
args := e.Called(monitor) | ||
if obj, ok := args.Get(0).(*api.ISPMonitor); ok { | ||
return obj, args.Error(1) | ||
} | ||
return nil, args.Error(1) | ||
} | ||
|
||
func (e *ISPMonitors) Update(monitor *api.ISPMonitor) (*api.ISPMonitor, error) { | ||
args := e.Called(monitor) | ||
if obj, ok := args.Get(0).(*api.ISPMonitor); ok { | ||
return obj, args.Error(1) | ||
} | ||
return nil, args.Error(1) | ||
} | ||
|
||
func (e *ISPMonitors) Delete(monitorID string) error { | ||
args := e.Called(monitorID) | ||
return args.Error(0) | ||
} | ||
|
||
func (e *ISPMonitors) List() ([]*api.ISPMonitor, error) { | ||
args := e.Called() | ||
if obj, ok := args.Get(0).([]*api.ISPMonitor); ok { | ||
return obj, args.Error(1) | ||
} | ||
return nil, args.Error(1) | ||
} | ||
|
||
func (e *ISPMonitors) Activate(monitorID string) error { | ||
args := e.Called(monitorID) | ||
return args.Error(0) | ||
} | ||
|
||
func (e *ISPMonitors) Suspend(monitorID string) error { | ||
args := e.Called(monitorID) | ||
return args.Error(0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package fake | ||
|
||
import ( | ||
"github.com/site24x7/terraform-provider-site24x7/api" | ||
"github.com/site24x7/terraform-provider-site24x7/api/endpoints/monitors" | ||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
var _ monitors.WebTransactionBrowserMonitors = &WebTransactionBrowserMonitors{} | ||
|
||
//var _ monitors.WebTransactionBrowserMonitorsUpdate = &WebTransactionBrowserMonitorsUpdate{} | ||
|
||
type WebTransactionBrowserMonitors struct { | ||
mock.Mock | ||
} | ||
|
||
func (e *WebTransactionBrowserMonitors) Get(monitorID string) (*api.WebTransactionBrowserMonitor, error) { | ||
args := e.Called(monitorID) | ||
if obj, ok := args.Get(0).(*api.WebTransactionBrowserMonitor); ok { | ||
return obj, args.Error(1) | ||
} | ||
return nil, args.Error(1) | ||
} | ||
|
||
func (e *WebTransactionBrowserMonitors) Create(monitor *api.WebTransactionBrowserMonitor) (*api.WebTransactionBrowserMonitor, error) { | ||
args := e.Called(monitor) | ||
if obj, ok := args.Get(0).(*api.WebTransactionBrowserMonitor); ok { | ||
return obj, args.Error(1) | ||
} | ||
return nil, args.Error(1) | ||
} | ||
|
||
func (e *WebTransactionBrowserMonitors) Update(monitor *api.WebTransactionBrowserMonitor) (*api.WebTransactionBrowserMonitor, error) { | ||
args := e.Called(monitor) | ||
if obj, ok := args.Get(0).(*api.WebTransactionBrowserMonitor); ok { | ||
return obj, args.Error(1) | ||
} | ||
return nil, args.Error(1) | ||
} | ||
|
||
func (e *WebTransactionBrowserMonitors) Delete(monitorID string) error { | ||
args := e.Called(monitorID) | ||
return args.Error(0) | ||
} | ||
|
||
func (e *WebTransactionBrowserMonitors) List() ([]*api.WebTransactionBrowserMonitor, error) { | ||
args := e.Called() | ||
if obj, ok := args.Get(0).([]*api.WebTransactionBrowserMonitor); ok { | ||
return obj, args.Error(1) | ||
} | ||
return nil, args.Error(1) | ||
} | ||
|
||
func (e *WebTransactionBrowserMonitors) Activate(monitorID string) error { | ||
args := e.Called(monitorID) | ||
return args.Error(0) | ||
} | ||
|
||
func (e *WebTransactionBrowserMonitors) Suspend(monitorID string) error { | ||
args := e.Called(monitorID) | ||
return args.Error(0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package monitors | ||
|
||
import ( | ||
"github.com/site24x7/terraform-provider-site24x7/api" | ||
"github.com/site24x7/terraform-provider-site24x7/rest" | ||
) | ||
|
||
type FTPTransferMonitors interface { | ||
Get(monitorID string) (*api.FTPTransferMonitor, error) | ||
Create(monitor *api.FTPTransferMonitor) (*api.FTPTransferMonitor, error) | ||
Update(monitor *api.FTPTransferMonitor) (*api.FTPTransferMonitor, error) | ||
Delete(monitorID string) error | ||
List() ([]*api.FTPTransferMonitor, error) | ||
Activate(monitorID string) error | ||
Suspend(monitorID string) error | ||
} | ||
|
||
type ftptransfermonitors struct { | ||
client rest.Client | ||
} | ||
|
||
func NewFTPTransferMonitors(client rest.Client) FTPTransferMonitors { | ||
return &ftptransfermonitors{ | ||
client: client, | ||
} | ||
} | ||
|
||
func (c *ftptransfermonitors) Get(monitorID string) (*api.FTPTransferMonitor, error) { | ||
monitor := &api.FTPTransferMonitor{} | ||
err := c.client. | ||
Get(). | ||
Resource("monitors"). | ||
ResourceID(monitorID). | ||
Do(). | ||
Parse(monitor) | ||
|
||
return monitor, err | ||
} | ||
|
||
func (c *ftptransfermonitors) Create(monitor *api.FTPTransferMonitor) (*api.FTPTransferMonitor, error) { | ||
newMonitor := &api.FTPTransferMonitor{} | ||
err := c.client. | ||
Post(). | ||
Resource("monitors"). | ||
AddHeader("Content-Type", "application/json;charset=UTF-8"). | ||
Body(monitor). | ||
Do(). | ||
Parse(newMonitor) | ||
|
||
return newMonitor, err | ||
} | ||
|
||
func (c *ftptransfermonitors) Update(monitor *api.FTPTransferMonitor) (*api.FTPTransferMonitor, error) { | ||
updatedMonitor := &api.FTPTransferMonitor{} | ||
err := c.client. | ||
Put(). | ||
Resource("monitors"). | ||
ResourceID(monitor.MonitorID). | ||
AddHeader("Content-Type", "application/json;charset=UTF-8"). | ||
Body(monitor). | ||
Do(). | ||
Parse(updatedMonitor) | ||
|
||
return updatedMonitor, err | ||
} | ||
|
||
func (c *ftptransfermonitors) Delete(monitorID string) error { | ||
return c.client. | ||
Delete(). | ||
Resource("monitors"). | ||
ResourceID(monitorID). | ||
Do(). | ||
Err() | ||
} | ||
|
||
func (c *ftptransfermonitors) List() ([]*api.FTPTransferMonitor, error) { | ||
ftptransfermonitors := []*api.FTPTransferMonitor{} | ||
err := c.client. | ||
Get(). | ||
Resource("monitors"). | ||
Do(). | ||
Parse(&ftptransfermonitors) | ||
|
||
return ftptransfermonitors, err | ||
} | ||
|
||
func (c *ftptransfermonitors) Activate(monitorID string) error { | ||
return c.client. | ||
Put(). | ||
Resource("monitors/activate"). | ||
ResourceID(monitorID). | ||
Do(). | ||
Err() | ||
} | ||
|
||
func (c *ftptransfermonitors) Suspend(monitorID string) error { | ||
return c.client. | ||
Put(). | ||
Resource("monitors/suspend"). | ||
ResourceID(monitorID). | ||
Do(). | ||
Err() | ||
} |
Oops, something went wrong.