cloudflare

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

README

cloudflare-api-client-go

Go Reference Go Report Card Maintainability Test Coverage

A couple of useful functions for Cloudflare API which are currently not supported by the official client

Installation

go get github.com/brokeyourbike/cloudflare-api-client-go

Usage

client := cloudflare.NewClient("securetoken", "00000000-0000-0000-0000-000000000000")

users, err := client.ListZeroTrustUsers(context.TODO())
require.NoError(t, err)

Authors

License

BSD-3-Clause License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(token, accountID string, opts ...ClientOption) *client

Types

type Client

type Client interface {
	ListZeroTrustUsers(ctx context.Context) ([]ZeroTrustUser, error)
}

type ClientOption

type ClientOption func(*client)

ClientOption is a function that configures a Client.

func WithBaseURL

func WithBaseURL(baseUrl string) ClientOption

WithBaseURL sets the base URL for the Cloudflare API client.

func WithHTTPClient added in v0.4.0

func WithHTTPClient(c HttpClient) ClientOption

WithHTTPClient sets the HTTP client for the Cloudflare API client.

type FetchZeroTrustUsersResponse

type FetchZeroTrustUsersResponse struct {
	Success    bool            `json:"success"`
	Result     []ZeroTrustUser `json:"result"`
	ResultInfo struct {
		Page       int `json:"page"`
		PerPage    int `json:"per_page"`
		Count      int `json:"count"`
		TotalCount int `json:"total_count"`
	} `json:"result_info"`
}

type HttpClient

type HttpClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type ZeroTrustUser

type ZeroTrustUser struct {
	ID        uuid.UUID `json:"id"`
	UID       uuid.UUID `json:"uid"`
	Name      string    `json:"name"`
	Email     string    `json:"email"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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