Documentation
¶
Index ¶
- Constants
- func DecodeError(statusCode int, body []byte) error
- func IsAuthFailure(err error) bool
- func IsNotFound(err error) bool
- func IsRateLimited(err error) bool
- func NewHTTPClient() *http.Client
- type APIError
- type AccessConfig
- type BillingAccount
- type Binding
- type Client
- type ComputeOperation
- type ComputeOperationError
- type ComputeOperationErrorItem
- type CreateServiceAccountKeyRequest
- type GCSBucket
- type GCSBucketsListResponse
- type GCSObject
- type GCSObjectsListResponse
- type GCSPolicy
- type GCSPolicyBind
- type GetIamPolicyRequest
- type GetPolicyOptions
- type IamPolicy
- type Instance
- type InstanceMetadata
- type InstanceMetadataItem
- type InstanceWithMetadata
- type ListBillingAccountsResponse
- type ListInstancesResponse
- type ListLogEntriesRequest
- type ListLogEntriesResponse
- type ListLogsResponse
- type ListManagedZonesResponse
- type ListRRSetsResponse
- type ListServiceAccountKeysResponse
- type ListServiceAccountsResponse
- type ListZonesResponse
- type LogEntry
- type LogEntryOperation
- type LogEntryResource
- type LogProtoAuthInfo
- type LogProtoAuthorize
- type LogProtoPayload
- type LogProtoRequestMeta
- type LogProtoStatus
- type ManagedZone
- type NetworkInterface
- type Option
- type Pager
- type RRSet
- type Request
- type RetryPolicy
- type SQLInstance
- type SQLInstanceIPAddress
- type SQLInstanceSettings
- type SQLInstancesListResponse
- type SQLOperation
- type SQLUser
- type SQLUsersListResponse
- type ServiceAccount
- type ServiceAccountKey
- type SetIamPolicyRequest
- type Zone
Constants ¶
const CloudBillingBaseURL = "https://cloudbilling.googleapis.com"
const ComputeBaseURL = "https://compute.googleapis.com"
const DNSBaseURL = "https://dns.googleapis.com"
const IAMBaseURL = "https://iam.googleapis.com"
const LoggingBaseURL = "https://logging.googleapis.com"
const ResourceManagerBaseURL = "https://cloudresourcemanager.googleapis.com"
const SQLAdminBaseURL = "https://sqladmin.googleapis.com"
const StorageBaseURL = "https://storage.googleapis.com"
Variables ¶
This section is empty.
Functions ¶
func DecodeError ¶
func IsAuthFailure ¶
func IsNotFound ¶
func IsRateLimited ¶
func NewHTTPClient ¶
Types ¶
type APIError ¶
type AccessConfig ¶
type AccessConfig struct {
NatIP string `json:"natIP"`
}
type BillingAccount ¶ added in v0.3.1
type BillingAccount struct {
Name string `json:"name"`
DisplayName string `json:"displayName"`
Open bool `json:"open"`
MasterBillingAccount string `json:"masterBillingAccount"`
}
BillingAccount mirrors `google.cloud.billing.v1.BillingAccount`. The validation flow surfaces "open" billing accounts as the closest analogue to the alibaba/tencent "credit balance" — Google does not expose an account balance directly via API, so listing the active billing accounts is the management-plane signal CSPM detectors track.
type ComputeOperation ¶ added in v0.3.1
type ComputeOperation struct {
Name string `json:"name"`
Zone string `json:"zone"`
Status string `json:"status"`
OperationType string `json:"operationType"`
TargetLink string `json:"targetLink"`
Error *ComputeOperationError `json:"error,omitempty"`
}
ComputeOperation is the LRO surface returned by setMetadata / reset.
type ComputeOperationError ¶ added in v0.3.1
type ComputeOperationError struct {
Errors []ComputeOperationErrorItem `json:"errors"`
}
type ComputeOperationErrorItem ¶ added in v0.3.1
type CreateServiceAccountKeyRequest ¶ added in v0.3.1
type CreateServiceAccountKeyRequest struct {
PrivateKeyType string `json:"privateKeyType,omitempty"`
KeyAlgorithm string `json:"keyAlgorithm,omitempty"`
}
CreateServiceAccountKeyRequest is the body of POST .../keys. CTK uses the default key type (TYPE_GOOGLE_CREDENTIALS_FILE) by leaving the field empty.
type GCSBucketsListResponse ¶ added in v0.3.1
type GCSObjectsListResponse ¶ added in v0.3.1
type GCSPolicy ¶ added in v0.3.1
type GCSPolicy struct {
Version int `json:"version"`
Bindings []GCSPolicyBind `json:"bindings"`
Etag string `json:"etag"`
}
GCSPolicy mirrors the IAM policy returned by the GCS bucket `getIamPolicy` action and accepted by `setIamPolicy`.
type GCSPolicyBind ¶ added in v0.3.1
type GetIamPolicyRequest ¶ added in v0.3.1
type GetIamPolicyRequest struct {
Options *GetPolicyOptions `json:"options,omitempty"`
}
GetIamPolicyRequest is the body of projects:getIamPolicy. The requestedPolicyVersion lets the caller select v3 features (conditions); CTK does not use conditions and asks for v1.
type GetPolicyOptions ¶ added in v0.3.1
type GetPolicyOptions struct {
RequestedPolicyVersion int `json:"requestedPolicyVersion,omitempty"`
}
type IamPolicy ¶ added in v0.3.1
type IamPolicy struct {
Version int `json:"version,omitempty"`
Etag string `json:"etag,omitempty"`
Bindings []Binding `json:"bindings,omitempty"`
}
IamPolicy is the policy document used by both projects:getIamPolicy and projects:setIamPolicy. Etag must be round-tripped to detect concurrent modifications.
type Instance ¶
type Instance struct {
Hostname string `json:"hostname"`
Name string `json:"name"`
Zone string `json:"zone"`
Status string `json:"status"`
NetworkInterfaces []NetworkInterface `json:"networkInterfaces"`
}
type InstanceMetadata ¶ added in v0.3.1
type InstanceMetadata struct {
Fingerprint string `json:"fingerprint"`
Items []InstanceMetadataItem `json:"items"`
Kind string `json:"kind,omitempty"`
}
InstanceMetadata is the wrapper Compute Engine returns; SetMetadata requires the fingerprint to detect concurrent edits.
type InstanceMetadataItem ¶ added in v0.3.1
InstanceMetadataItem mirrors GCE's instance metadata key/value pair.
type InstanceWithMetadata ¶ added in v0.3.1
type InstanceWithMetadata struct {
Name string `json:"name"`
Zone string `json:"zone"`
Status string `json:"status"`
Metadata InstanceMetadata `json:"metadata"`
}
InstanceWithMetadata is the subset of `compute.instances.get` we need to run the metadata startup-script + reboot path. Compute Engine's full Instance shape is much larger; we only project metadata + the basics.
type ListBillingAccountsResponse ¶ added in v0.3.1
type ListBillingAccountsResponse struct {
BillingAccounts []BillingAccount `json:"billingAccounts"`
NextPageToken string `json:"nextPageToken"`
}
type ListInstancesResponse ¶
type ListLogEntriesRequest ¶ added in v0.3.1
type ListLogEntriesResponse ¶ added in v0.3.1
type ListLogsResponse ¶ added in v0.3.1
type ListLogsResponse struct {
LogNames []string `json:"logNames"`
NextPageToken string `json:"nextPageToken"`
}
ListLogsResponse is the typed result of `projects/<p>/logs.list`. Returns just the log names available in the project — one per cloudlist `log` asset entry, which is a closer fit than the heavy `entries.list` payload.
type ListManagedZonesResponse ¶
type ListManagedZonesResponse struct {
ManagedZones []ManagedZone `json:"managedZones"`
NextPageToken string `json:"nextPageToken"`
}
type ListRRSetsResponse ¶
type ListServiceAccountKeysResponse ¶ added in v0.3.1
type ListServiceAccountKeysResponse struct {
Keys []ServiceAccountKey `json:"keys"`
}
type ListServiceAccountsResponse ¶
type ListServiceAccountsResponse struct {
Accounts []ServiceAccount `json:"accounts"`
NextPageToken string `json:"nextPageToken"`
}
type ListZonesResponse ¶
type LogEntry ¶ added in v0.3.1
type LogEntry struct {
InsertID string `json:"insertId"`
LogName string `json:"logName"`
Timestamp string `json:"timestamp"`
ReceiveTimestamp string `json:"receiveTimestamp"`
Severity string `json:"severity"`
Resource LogEntryResource `json:"resource"`
ProtoPayload LogProtoPayload `json:"protoPayload"`
Operation LogEntryOperation `json:"operation"`
Labels map[string]string `json:"labels"`
}
LogEntry maps the subset of a Cloud Logging LogEntry resource that event-check surfaces. Real responses include many more fields (json / proto payloads, severity, labels) we don't need.
type LogEntryOperation ¶ added in v0.3.1
type LogEntryResource ¶ added in v0.3.1
type LogProtoAuthInfo ¶ added in v0.3.1
type LogProtoAuthInfo struct {
PrincipalEmail string `json:"principalEmail"`
}
type LogProtoAuthorize ¶ added in v0.3.1
type LogProtoPayload ¶ added in v0.3.1
type LogProtoPayload struct {
Type string `json:"@type"`
ServiceName string `json:"serviceName"`
MethodName string `json:"methodName"`
ResourceName string `json:"resourceName"`
AuthInfo LogProtoAuthInfo `json:"authenticationInfo"`
RequestMeta LogProtoRequestMeta `json:"requestMetadata"`
Status LogProtoStatus `json:"status"`
AuthorizationInfo []LogProtoAuthorize `json:"authorizationInfo"`
}
type LogProtoRequestMeta ¶ added in v0.3.1
type LogProtoStatus ¶ added in v0.3.1
type ManagedZone ¶
type NetworkInterface ¶
type NetworkInterface struct {
NetworkIP string `json:"networkIP"`
AccessConfigs []AccessConfig `json:"accessConfigs"`
}
type Option ¶
type Option func(*Client)
func WithHTTPClient ¶
func WithRetryPolicy ¶
func WithRetryPolicy(p RetryPolicy) Option
type RetryPolicy ¶
type RetryPolicy = httpclient.RetryPolicy
func DefaultRetryPolicy ¶
func DefaultRetryPolicy() RetryPolicy
type SQLInstance ¶ added in v0.3.1
type SQLInstance struct {
Name string `json:"name"`
DatabaseVersion string `json:"databaseVersion"`
Region string `json:"region"`
State string `json:"state"`
IPAddresses []SQLInstanceIPAddress `json:"ipAddresses"`
BackendType string `json:"backendType"`
InstanceType string `json:"instanceType"`
GceZone string `json:"gceZone"`
ConnectionName string `json:"connectionName"`
Settings SQLInstanceSettings `json:"settings"`
}
SQLInstance is the typed Cloud SQL instance shape (instances.list).
type SQLInstanceIPAddress ¶ added in v0.3.1
type SQLInstanceSettings ¶ added in v0.3.1
type SQLInstancesListResponse ¶ added in v0.3.1
type SQLInstancesListResponse struct {
Items []SQLInstance `json:"items"`
NextPageToken string `json:"nextPageToken"`
Kind string `json:"kind,omitempty"`
}
SQLInstancesListResponse is the typed result of `instances.list`.
type SQLOperation ¶ added in v0.3.1
type SQLUsersListResponse ¶ added in v0.3.1
type ServiceAccount ¶
type ServiceAccountKey ¶ added in v0.3.1
type ServiceAccountKey struct {
Name string `json:"name"`
KeyAlgorithm string `json:"keyAlgorithm,omitempty"`
PrivateKeyType string `json:"privateKeyType,omitempty"`
PrivateKeyData string `json:"privateKeyData,omitempty"`
ValidAfterTime string `json:"validAfterTime,omitempty"`
ValidBeforeTime string `json:"validBeforeTime,omitempty"`
KeyOrigin string `json:"keyOrigin,omitempty"`
KeyType string `json:"keyType,omitempty"`
Disabled bool `json:"disabled,omitempty"`
}
ServiceAccountKey represents the resource returned by projects.serviceAccounts.keys.{list,create,get}. PrivateKeyData is only populated by `create` and is base64 of the credential JSON.
type SetIamPolicyRequest ¶ added in v0.3.1
type SetIamPolicyRequest struct {
Policy IamPolicy `json:"policy"`
}
SetIamPolicyRequest is the body of projects:setIamPolicy. The Policy embeds the etag returned by the previous Get for optimistic concurrency.