logzio_client

package module
v1.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 9 Imported by: 0

README

Logz.io Terraform client library

Client library for Logz.io API, see below for supported endpoints.

The primary purpose of this library is to act as the API interface for the logz.io Terraform provider. To use it, you'll need to create an API token and provide it to the client library along with your logz.io regional API server address.

The library currently supports the following API endpoints:

Contributing
  1. Clone this repo locally.
  2. As this package uses Go modules, make sure you are outside of $GOPATH or you have the GO111MODULE=on environment variable set. Then run go get to pull down the dependencies.
  3. Use logzio_client.CallLogzioApi when you need to make a Logz.io API call.
  4. Use structs to represent the requests/responses body, rather than maps.
  5. Sample responses for tests should be under testdata/fixtures.
Run tests

go test -v -race ./...

Changelog
  • 1.22.0
    • Validate account existence before updating it, and set an empty account name if the name did not change to prevent API errors.
  • 1.21.0
  • 1.20.1
    • Add limitation, Grafana Alert name cannot contain / or \.
  • 1.20.0
  • 1.19.0
  • v1.18.0
  • v1.17.0
    • Add Grafana Folders API.
    • Remove deprecated alerts (v1).
Exapnd to check old versions
  • v1.16.0
  • v1.15.0
  • v1.14.0
    • alerts_v2 - support new field schedule
  • v1.13.1
    • Add retry mechanism for requests.
  • v1.13.0
    • Bug fix - sub_accounts: field ReservedDailyGB in requests can be 0.
  • v1.12.0
    • Upgrade to Go 1.18.
    • Refactor users, adjust to the recent API fields.
    • Add field UserName to restore initiate request, to match recent API fields.
  • v1.11.0
  • v1.10.3
    • Bug fix - sub_accounts: omit maxDailyGb if needed.
  • v1.10.2
    • Bug fix - alerts_v2: allow sending with columns without sort.
  • v1.10.1
    • Bug fix - custom endpoint: allow empty string for Headers field.
  • v1.10.0
  • v1.9.1
    • Bug fix - adjust "not found" message to all resources.
  • v1.9.0
  • v1.8.0
    • sub_accounts:
      • Add flexible & reservedDailyGB.
      • Breaking changes: refactor resource.
    • endpoints:
      • Breaking changes: refactor resource.
      • Add new endpoint types (OpsGenie, ServiceNow, Microsoft Teams).
  • v1.7.0
  • v1.6.0
  • v1.5.3
    • Fix for sub account: return token & account id on Create.
  • v1.5.2
    • Fix custom endpoint -empty headers bug.
    • Allow empty array for sharing accounts in sub account.
  • v1.5.1
    • Fix alerts_v2 sort bug.
  • v1.5
    • Add alerts v2 compatibility.
  • v1.3.2
    • fix client custom endpoint headers bug
    • improve tests
  • v1.3
    • unnecessary resource updates bug fix.
    • support tags in alerts
  • v1.2
    • Add subaccount support
Trademark Disclaimer

Terraform is a trademark of HashiCorp, Inc.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHttpHeaders

func AddHttpHeaders(apiToken string, req *http.Request)

func CallLogzioApi added in v1.9.0

func CallLogzioApi(logzioCall LogzioApiCallDetails) ([]byte, error)

func CheckValidStatus

func CheckValidStatus(response *http.Response, status []int) bool

func Contains

func Contains(slice []string, s string) bool

func CreateHttpRequest

func CreateHttpRequest(req *http.Request) (map[string]interface{}, error)

func CreateHttpRequestBytesResponse added in v1.5.0

func CreateHttpRequestBytesResponse(req *http.Request) ([]byte, error)

Types

type LogzioApiCallDetails added in v1.9.0

type LogzioApiCallDetails struct {
	ApiToken     string
	HttpMethod   string
	Url          string
	Body         []byte
	SuccessCodes []int
	NotFoundCode int
	ResourceId   interface{}
	ApiAction    string
	ResourceName string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL