client

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

* GoWinds API Client * * Copyright 2023 Christopher O'Connell * * 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.

* GoWinds API Client * * Copyright 2023 Christopher O'Connell * * 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.

* GoWinds API Client * * Copyright 2020 Christopher O'Connell * * 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.

* GoWinds API Client * * Copyright 2020 Christopher O'Connell * * 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.

* GoWinds API Client * * Copyright 2020 Christopher O'Connell * * 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.

* GoWinds API Client * * Copyright 2020 Christopher O'Connell * * 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.

* GoWinds API Client * * Copyright 2020 Christopher O'Connell * * 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.

* GoWinds API Client * * Copyright 2020 Christopher O'Connell * * 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.

* GoWinds API Client * * Copyright 2023 Christopher O'Connell * * 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.

* GoWinds API Client * * Copyright 2023 Christopher O'Connell * * 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.

* GoWinds API Client * * Copyright 2023 Christopher O'Connell * * 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.

* GoWinds API Client * * Copyright 2020 Christopher O'Connell * * 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.

* GoWinds API Client * * Copyright 2020 Christopher O'Connell * * 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.

* GoWinds API Client * * Copyright 2020 Christopher O'Connell * * 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.

Index

Constants

View Source
const (
	Monthly Granularity = "P1M"
	Weekly              = "P1W"
	Daily               = "P1D"
	Hourly              = "PT1D"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account added in v0.0.2

type Account struct {
	Name                      string         `json:"accountName"`
	Status                    string         `json:"accountStatus"`
	BillingAccountID          string         `json:"billingAccountId"`
	BillingAccountNumber      string         `json:"billingAccountNumber"`
	BillingContact            BillingContact `json:"billingContact"`
	GCSLogsBucket             string         `json:"gcsLogsBucket"`
	HashCode                  string         `json:"accountHash"` // Default account identifier
	ParentHash                string         `json:"parentHash"`
	ID                        int            `json:"id"`
	MaxHCSTenants             int            `json:"maxHcsTenants"`
	MaxDirectSubAccounts      int            `json:"maximumDirectSubAccounts"`
	MaxHosts                  int            `json:"maximumHosts"`
	NOCContact                Contact        `json:"nocContact"`
	Parent                    int            `json:"parent"`
	PrimaryContact            Contact        `json:"primaryContact"`
	Services                  []Service      `json:"services"`
	SubAccountCreationEnabled bool           `json:"subAccountCreationEnabled"`
	SubAccounts               []Account      `json:"subAccounts"`
	SupportEmail              string         `json:"supportEmailAddress"`
	TechnicalContact          Contact        `json:"technicalContact"`
}

type AnalyticsEntry

type AnalyticsEntry struct {
	Transfer float64 `hwnd:"xferUsedTotalMB"`
	Rate     float64 `hwnd:"ninetyFiveFiveMbps"`
	Requests int     `hwnd:"requestsCountTotal"`
}

type AnalyticsList

type AnalyticsList struct {
	Type string
	Key  string
	Data []AnalyticsEntry
}

type BillingContact added in v0.0.2

type BillingContact struct {
	Contact
	BillingAccountNumber string `json:"billingAccountNumber"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func DefaultClient

func DefaultClient() (*Client, error)

func NewClient

func NewClient(credentials *config.Credentials) (*Client, error)

func (*Client) FetchAccount added in v0.0.2

func (c *Client) FetchAccount(hash string) (Account, error)

func (*Client) FetchCurrentAccount added in v0.0.2

func (c *Client) FetchCurrentAccount() (Account, error)

func (*Client) FetchHosts added in v0.0.2

func (c *Client) FetchHosts() ([]Host, error)

func (*Client) FetchHostsOf added in v0.0.2

func (c *Client) FetchHostsOf(hash string) ([]Host, error)

func (*Client) FetchOrigins added in v0.0.2

func (c *Client) FetchOrigins() ([]Origin, error)

func (*Client) FetchOriginsOf added in v0.0.2

func (c *Client) FetchOriginsOf(hash string) ([]Origin, error)

func (*Client) FetchPlatforms

func (c *Client) FetchPlatforms() ([]PlatformsResponse, error)

func (*Client) FetchRawConfiguration added in v0.0.2

func (c *Client) FetchRawConfiguration(acct, host string, scope int) (map[string]any, error)

func (*Client) FetchSubAccounts added in v0.0.2

func (c *Client) FetchSubAccounts() ([]Account, error)

func (*Client) FetchSubAccountsOf added in v0.0.2

func (c *Client) FetchSubAccountsOf(hash string) ([]Account, error)

func (*Client) FetchUsageByAccount

func (c *Client) FetchUsageByAccount(from, to time.Time, gran Granularity, plat Platform) ([]AnalyticsList, error)

type Contact added in v0.0.2

type Contact struct {
	ID    int    `json:"id"`
	First string `json:"firstName"`
	Last  string `json:"lastName"`
	Email string `json:"email"`
	Phone string `json:"phone"`
	Fax   string `json:"fax"`
}

type Granularity

type Granularity string

func (Granularity) String

func (g Granularity) String() string

type Host added in v0.0.2

type Host struct {
	Name        string    `json:"name"`
	HashCode    string    `json:"hashCode"` // Primary key
	Type        string    `json:"type"`
	CreatedDate string    `json:"createdDate"`
	UpdatedDate string    `json:"updatedDate"`
	Services    []Service `json:"services"`
	Scopes      []Scope   `json:"scopes"`
}

type ListHostsResponse added in v0.0.2

type ListHostsResponse struct {
	Hosts []Host `json:"list"`
}

type ListOriginsResponse added in v0.0.2

type ListOriginsResponse struct {
	Origins []Origin `json:"list"`
}

type Origin added in v0.0.2

type Origin struct {
	ID                 int    `json:"id"`
	Name               string `json:"name"`
	Type               string `json:"type"`
	Path               string `json:"path"`
	CreatedDate        string `json:"createdDate"`
	UpdatedDate        string `json:"updatedDate"`
	RequestTimeout     int    `json:"requestTimeoutSeconds"`
	ErrorCacheTTL      int    `json:"errorCacheTTLSeconds"`
	MaxRetryCount      int    `json:"maxRetryCount"`
	AuthenticationType string `json:"authenticationType"`
	Hostname           string `json:"hostname"`
	Port               int    `json:"port"`
	SecurePort         int    `json:"securePort"`
	OriginPullHeaders  string `json:"originPullHeaders"`
	OriginCacheHeaders string `json:"originCacheHeaders"`
	VerifyCertificate  bool   `json:"verifyCertificate"`
	CertificateCN      string `json:"certificateCN"`
}

type Platform

type Platform int
const (
	PlatformFLS                    Platform = 1
	FlashLiveStreaming             Platform = 1
	PlatformOLS                    Platform = 2
	OctoshapeLiveStreaming         Platform = 2
	PlatformCDS                    Platform = 3
	HTTPCaching                    Platform = 3
	PlatformMPS                    Platform = 5
	HTTPStreaming                  Platform = 5
	PlatformAIS                    Platform = 6
	AppleiPhoneiPadStreaming       Platform = 6
	PlatformADS                    Platform = 7
	AdobeDynamicStreaming          Platform = 7
	PlatformMSS                    Platform = 8
	MicrosoftSmoothStreaming       Platform = 8
	PlatformMPI                    Platform = 12
	MultiProtocolIngest            Platform = 12
	PlatformMTC                    Platform = 13
	MidTierCache                   Platform = 13
	PlatformIOS                    Platform = 23
	InternalOriginService          Platform = 23
	PlatformDSS                    Platform = 33
	DistributedStorageService      Platform = 33
	PlatformSDS                    Platform = 34
	HTTPSCachingSDS                Platform = 34
	PlatformSIS                    Platform = 35
	SecureAppleiPhoneiPadStreaming Platform = 35
	PlatformSMS                    Platform = 36
	SecureMicrosoftSmoothStreaming Platform = 36
	PlatformSAS                    Platform = 37
	SecureAdobeDynamicStreaming    Platform = 37
	PlatformFMS                    Platform = 38
	FlashMediaStreaming            Platform = 38
	PlatformWMS                    Platform = 39
	WindowsMediaStreaming          Platform = 39
	PlatformCDD                    Platform = 40
	CDSOriginShielding             Platform = 40
	PlatformCDI                    Platform = 41
	CDSIngest                      Platform = 41
	PlatformCDR                    Platform = 43
	ContentDeliveryReceipts        Platform = 43
	PlatformSDI                    Platform = 44
	SecureIngest                   Platform = 44
	PlatformSDD                    Platform = 45
	SecureOriginShielding          Platform = 45
	PlatformCDP                    Platform = 52
	HTTPProxy                      Platform = 52
	PlatformCDE                    Platform = 53
	CDNDeliveryEnduser             Platform = 53
	PlatformCDO                    Platform = 54
	CDNDeliveryOrigin              Platform = 54
	PlatformWSD                    Platform = 55
	EdgetoWAFSecure                Platform = 55
	PlatformWDD                    Platform = 56
	EdgetoWAF                      Platform = 56
	PlatformWDS                    Platform = 57
	WAFHTTPDelivery                Platform = 57
	PlatformWSS                    Platform = 58
	WAFSSLDelivery                 Platform = 58
	PlatformWDI                    Platform = 59
	WAFIngest                      Platform = 59
	PlatformWSI                    Platform = 60
	WAFSecureIngest                Platform = 60
	PlatformSLC                    Platform = 61
	ServerlessCompute              Platform = 61
	PlatformSLS                    Platform = 62
	ServerlessComputeSecure        Platform = 62
	PlatformCWS                    Platform = 63
	CleartextWebSocket             Platform = 63
	PlatformSWS                    Platform = 64
	SecureWebSocket                Platform = 64
	PlatformCWI                    Platform = 65
	CleartextWebSocketIngest       Platform = 65
	PlatformSWI                    Platform = 66
	SecureWebSocketIngest          Platform = 66
	PlatformEEC                    Platform = 67
	EdgeEngineCacheAPI             Platform = 67
	PlatformEEI                    Platform = 68
	EdgeEngineIngest               Platform = 68
	PlatformCLE                    Platform = 69
	CDNEnduserLogStreaming         Platform = 69
)

func PlatformFromCode

func PlatformFromCode(s string) Platform

func (Platform) Code

func (p Platform) Code() string

func (Platform) IsAnalyzable

func (p Platform) IsAnalyzable() bool

func (Platform) IsArchivable

func (p Platform) IsArchivable() bool

func (Platform) IsConfigurable

func (p Platform) IsConfigurable() bool

func (Platform) IsReportable

func (p Platform) IsReportable() bool

func (Platform) String

func (p Platform) String() string

type PlatformsResponse

type PlatformsResponse struct {
	ID           int      `json:"id"`
	Code         string   `json:"code"`
	Name         string   `json:"name"`
	Capabilities []string `json:"capabilities"`
}

type Scope added in v0.0.2

type Scope struct {
	ID          int    `json:"id"`
	Platform    string `json:"platform"`
	Path        string `json:"path"`
	CreatedDate string `json:"createdDate"`
	UpdatedDate string `json:"updatedDate"`
}

type Service added in v0.0.2

type Service struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Type        string `json:"type"`
}

type StatusCodeError

type StatusCodeError int

func (StatusCodeError) Error

func (s StatusCodeError) Error() string

func (StatusCodeError) StatusCode

func (s StatusCodeError) StatusCode() int

Jump to

Keyboard shortcuts

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