Documentation ¶
Overview ¶
Copyright 2021 Crunchy Data Solutions, Inc.
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.
Copyright 2022 Crunchy Data Solutions, Inc.
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.
Copyright 2022 Crunchy Data Solutions, Inc.
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.
bridgeapi provides a client interface to the Crunchy Bridge Platform API for use of the Terraform provider. It lives within the internal tree to prevent external dependencies.
External dependencies are a signal that this package should be moved to its own repository and maintained as a public library.
Copyright 2022 Crunchy Data Solutions, Inc.
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.
Copyright 2022 Crunchy Data Solutions, Inc.
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.
Copyright 2022 Crunchy Data Solutions, Inc.
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.
Copyright 2022 Crunchy Data Solutions, Inc.
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 ¶
- Variables
- func DefaultClusterName() string
- type APIMessage
- type Account
- type Client
- func (c *Client) Account() (Account, error)
- func (c *Client) AccountTeams() (Teams, error)
- func (c *Client) Close() error
- func (c *Client) ClusterDetail(id string) (ClusterDetail, error)
- func (c *Client) ClusterRoles(id string) ([]ClusterRole, error)
- func (c *Client) ClusterStatus(id string) (ClusterStatus, error)
- func (c *Client) ClustersForTeam(team_id string) ([]ClusterDetail, error)
- func (c *Client) CreateCluster(cr CreateRequest) (string, error)
- func (c *Client) DeleteCluster(id string) error
- func (c *Client) GetAllClusters() ([]ClusterDetail, error)
- func (c *Client) Providers() ([]Provider, error)
- func (c *Client) UpdateCluster(id string, ur ClusterUpdateRequest) error
- func (c *Client) UpgradeCluster(id string, ur ClusterUpgradeRequest) error
- type ClientOption
- type ClusterDetail
- type ClusterDiskUsage
- type ClusterList
- type ClusterRole
- type ClusterStatus
- type ClusterUpdateRequest
- type ClusterUpgrade
- type ClusterUpgradeOperation
- type ClusterUpgradeRequest
- type CreateRequest
- type Login
- type Plan
- type Provider
- type ProviderDisk
- type Region
- type Team
- type Teams
Constants ¶
This section is empty.
Variables ¶
var ( ErrorBadRequest = errors.New("invalid request") ErrorConflict = errors.New("non-unique name specified in request") ErrorOldSecretFormat = errors.New("unexpected format for api secret, regeneration may be needed") )
var (
BridgeProviderNS = uuid.MustParse("cc67b0e5-7152-4d54-85ff-49a5c17fbbfe")
)
Functions ¶
func DefaultClusterName ¶
func DefaultClusterName() string
returns a randomized cluster name in the form of adverb-adjective-animal-dd (d = digit from 1-8)
Types ¶
type APIMessage ¶
type Client ¶
func (*Client) AccountTeams ¶
func (*Client) Close ¶
Close allows an explicit request to log out of the current session There is no explicit login, as login is triggered for every client call to ensure an active session state.
func (*Client) ClusterDetail ¶
func (c *Client) ClusterDetail(id string) (ClusterDetail, error)
func (*Client) ClusterRoles ¶
func (c *Client) ClusterRoles(id string) ([]ClusterRole, error)
func (*Client) ClusterStatus ¶
func (c *Client) ClusterStatus(id string) (ClusterStatus, error)
func (*Client) ClustersForTeam ¶
func (c *Client) ClustersForTeam(team_id string) ([]ClusterDetail, error)
func (*Client) CreateCluster ¶
func (c *Client) CreateCluster(cr CreateRequest) (string, error)
func (*Client) DeleteCluster ¶
func (*Client) GetAllClusters ¶
func (c *Client) GetAllClusters() ([]ClusterDetail, error)
func (*Client) UpdateCluster ¶
func (c *Client) UpdateCluster(id string, ur ClusterUpdateRequest) error
func (*Client) UpgradeCluster ¶
func (c *Client) UpgradeCluster(id string, ur ClusterUpgradeRequest) error
type ClientOption ¶
func WithContext ¶
func WithContext(ctx context.Context) ClientOption
WithContext allows the client to be aware of a parent context. Currently, it is used to invalidate the access token when the provided context closes
func WithHTTPClient ¶
func WithHTTPClient(hc *http.Client) ClientOption
WithHTTPClient allows the use of a custom-configured HTTP client for API requests, Client defaults to a default http.Client{} otherwise Setter - always returns nil error
func WithIdempotencyKey ¶
func WithIdempotencyKey() ClientOption
WithIdempotencyKey causes the client to send an Idempotency Key header on cluster create N.B. This may have unexpected behavior tied to cached responses after system state changes invalidate the correctness of those responses
func WithImmediateLogin ¶
func WithImmediateLogin() ClientOption
WithImmediateLogin triggers a login instead of waiting for lazy-initialization to occcur once a data function is called
func WithTokenExchange ¶
func WithTokenExchange() ClientOption
WithTokenExchange instructs the client to force a token exchange for a short- lived token (gen 1 auth) instead of the user-managed bearer token (gen 2 auth)
func WithUserAgent ¶
func WithUserAgent(ua string) ClientOption
WithUserAgent configures a UserAgent string to use in all requests to the API Setter - always returns nil error
type ClusterDetail ¶
type ClusterDetail struct { CPU int `json:"cpu"` Created time.Time `json:"created_at"` ID string `json:"id"` HighAvailability bool `json:"is_ha"` PGMajorVersion int `json:"major_version"` MaintWindowStart int `json:"maintenance_window_start"` MemoryGB float64 `json:"memory"` // 64 precision isn't required, but likely default arch Name string `json:"name"` PlanID string `json:"plan_id"` ProviderID string `json:"provider_id"` RegionID string `json:"region_id"` State string `json:"state"` // NOTE: Deprecated, but using to avoid extra status call on sync create for now StorageGB int `json:"storage"` TeamID string `json:"team_id"` Updated time.Time `json:"updated_at"` }
type ClusterDiskUsage ¶
type ClusterList ¶
type ClusterList struct {
Clusters []ClusterDetail `json:"clusters"`
}
type ClusterRole ¶
type ClusterStatus ¶
type ClusterStatus struct { DiskUsage ClusterDiskUsage `json:"disk_usage"` OldestBackup time.Time `json:"oldest_backup_at"` OngoingUpgrade ClusterUpgrade `json:"ongoing_upgrade"` State string `json:"state"` }
type ClusterUpdateRequest ¶
type ClusterUpgrade ¶
type ClusterUpgrade struct {
Operations []ClusterUpgradeOperation
}
type ClusterUpgradeOperation ¶
type ClusterUpgradeRequest ¶
type CreateRequest ¶
type CreateRequest struct { Name string `json:"name"` TeamID string `json:"team_id"` Plan string `json:"plan_id"` StorageGB int `json:"storage"` Provider string `json:"provider_id"` Region string `json:"region_id"` PGMajorVersion int `json:"postgres_version_id"` HighAvailability bool `json:"is_ha"` }
type ProviderDisk ¶
type ProviderDisk struct {
Rate int `json:"rate"`
}