Source File
uptime_check_client.go
Belonging Package
cloud.google.com/go/monitoring/apiv3
package monitoring
import (
gax
gtransport
monitoringpb
)
var newUptimeCheckClientHook clientHook
type UptimeCheckCallOptions struct {
ListUptimeCheckConfigs []gax.CallOption
GetUptimeCheckConfig []gax.CallOption
CreateUptimeCheckConfig []gax.CallOption
UpdateUptimeCheckConfig []gax.CallOption
DeleteUptimeCheckConfig []gax.CallOption
ListUptimeCheckIps []gax.CallOption
}
func () []option.ClientOption {
return []option.ClientOption{
option.WithEndpoint("monitoring.googleapis.com:443"),
option.WithGRPCDialOption(grpc.WithDisableServiceConfig()),
option.WithScopes(DefaultAuthScopes()...),
option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(math.MaxInt32))),
}
}
func () *UptimeCheckCallOptions {
return &UptimeCheckCallOptions{
ListUptimeCheckConfigs: []gax.CallOption{
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 30000 * time.Millisecond,
Multiplier: 1.30,
})
}),
},
GetUptimeCheckConfig: []gax.CallOption{
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 30000 * time.Millisecond,
Multiplier: 1.30,
})
}),
},
CreateUptimeCheckConfig: []gax.CallOption{},
UpdateUptimeCheckConfig: []gax.CallOption{},
DeleteUptimeCheckConfig: []gax.CallOption{
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 30000 * time.Millisecond,
Multiplier: 1.30,
})
}),
},
ListUptimeCheckIps: []gax.CallOption{
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 30000 * time.Millisecond,
Multiplier: 1.30,
})
}),
},
}
}
func ( context.Context, ...option.ClientOption) (*UptimeCheckClient, error) {
:= defaultUptimeCheckClientOptions()
if newUptimeCheckClientHook != nil {
, := newUptimeCheckClientHook(, clientHookParams{})
if != nil {
return nil,
}
= append(, ...)
}
, := gtransport.DialPool(, append(, ...)...)
if != nil {
return nil,
}
:= &UptimeCheckClient{
connPool: ,
CallOptions: defaultUptimeCheckCallOptions(),
uptimeCheckClient: monitoringpb.NewUptimeCheckServiceClient(),
}
.setGoogleClientInfo()
return , nil
}
func ( *UptimeCheckClient) () *grpc.ClientConn {
return .connPool.Conn()
}
func ( *UptimeCheckClient) () error {
return .connPool.Close()
}
func ( *UptimeCheckClient) ( ...string) {
:= append([]string{"gl-go", versionGo()}, ...)
= append(, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(...))
}
func ( *UptimeCheckClient) ( context.Context, *monitoringpb.ListUptimeCheckConfigsRequest, ...gax.CallOption) *UptimeCheckConfigIterator {
:= metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(.GetParent())))
= insertMetadata(, .xGoogMetadata, )
= append(.CallOptions.ListUptimeCheckConfigs[0:len(.CallOptions.ListUptimeCheckConfigs):len(.CallOptions.ListUptimeCheckConfigs)], ...)
:= &UptimeCheckConfigIterator{}
= proto.Clone().(*monitoringpb.ListUptimeCheckConfigsRequest)
.InternalFetch = func( int, string) ([]*monitoringpb.UptimeCheckConfig, string, error) {
var *monitoringpb.ListUptimeCheckConfigsResponse
.PageToken =
if > math.MaxInt32 {
.PageSize = math.MaxInt32
} else {
.PageSize = int32()
}
:= gax.Invoke(, func( context.Context, gax.CallSettings) error {
var error
, = .uptimeCheckClient.ListUptimeCheckConfigs(, , .GRPC...)
return
}, ...)
if != nil {
return nil, "",
}
.Response =
return .UptimeCheckConfigs, .NextPageToken, nil
}
:= func( int, string) (string, error) {
, , := .InternalFetch(, )
if != nil {
return "",
}
.items = append(.items, ...)
return , nil
}
.pageInfo, .nextFunc = iterator.NewPageInfo(, .bufLen, .takeBuf)
.pageInfo.MaxSize = int(.PageSize)
.pageInfo.Token = .PageToken
return
}
func ( *UptimeCheckClient) ( context.Context, *monitoringpb.GetUptimeCheckConfigRequest, ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error) {
:= metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
= insertMetadata(, .xGoogMetadata, )
= append(.CallOptions.GetUptimeCheckConfig[0:len(.CallOptions.GetUptimeCheckConfig):len(.CallOptions.GetUptimeCheckConfig)], ...)
var *monitoringpb.UptimeCheckConfig
:= gax.Invoke(, func( context.Context, gax.CallSettings) error {
var error
, = .uptimeCheckClient.GetUptimeCheckConfig(, , .GRPC...)
return
}, ...)
if != nil {
return nil,
}
return , nil
}
func ( *UptimeCheckClient) ( context.Context, *monitoringpb.CreateUptimeCheckConfigRequest, ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error) {
:= metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(.GetParent())))
= insertMetadata(, .xGoogMetadata, )
= append(.CallOptions.CreateUptimeCheckConfig[0:len(.CallOptions.CreateUptimeCheckConfig):len(.CallOptions.CreateUptimeCheckConfig)], ...)
var *monitoringpb.UptimeCheckConfig
:= gax.Invoke(, func( context.Context, gax.CallSettings) error {
var error
, = .uptimeCheckClient.CreateUptimeCheckConfig(, , .GRPC...)
return
}, ...)
if != nil {
return nil,
}
return , nil
}
func ( *UptimeCheckClient) ( context.Context, *monitoringpb.UpdateUptimeCheckConfigRequest, ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error) {
:= metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "uptime_check_config.name", url.QueryEscape(.GetUptimeCheckConfig().GetName())))
= insertMetadata(, .xGoogMetadata, )
= append(.CallOptions.UpdateUptimeCheckConfig[0:len(.CallOptions.UpdateUptimeCheckConfig):len(.CallOptions.UpdateUptimeCheckConfig)], ...)
var *monitoringpb.UptimeCheckConfig
:= gax.Invoke(, func( context.Context, gax.CallSettings) error {
var error
, = .uptimeCheckClient.UpdateUptimeCheckConfig(, , .GRPC...)
return
}, ...)
if != nil {
return nil,
}
return , nil
}
func ( *UptimeCheckClient) ( context.Context, *monitoringpb.DeleteUptimeCheckConfigRequest, ...gax.CallOption) error {
:= metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
= insertMetadata(, .xGoogMetadata, )
= append(.CallOptions.DeleteUptimeCheckConfig[0:len(.CallOptions.DeleteUptimeCheckConfig):len(.CallOptions.DeleteUptimeCheckConfig)], ...)
:= gax.Invoke(, func( context.Context, gax.CallSettings) error {
var error
_, = .uptimeCheckClient.DeleteUptimeCheckConfig(, , .GRPC...)
return
}, ...)
return
}
func ( *UptimeCheckClient) ( context.Context, *monitoringpb.ListUptimeCheckIpsRequest, ...gax.CallOption) *UptimeCheckIpIterator {
= insertMetadata(, .xGoogMetadata)
= append(.CallOptions.ListUptimeCheckIps[0:len(.CallOptions.ListUptimeCheckIps):len(.CallOptions.ListUptimeCheckIps)], ...)
:= &UptimeCheckIpIterator{}
= proto.Clone().(*monitoringpb.ListUptimeCheckIpsRequest)
.InternalFetch = func( int, string) ([]*monitoringpb.UptimeCheckIp, string, error) {
var *monitoringpb.ListUptimeCheckIpsResponse
.PageToken =
if > math.MaxInt32 {
.PageSize = math.MaxInt32
} else {
.PageSize = int32()
}
:= gax.Invoke(, func( context.Context, gax.CallSettings) error {
var error
, = .uptimeCheckClient.ListUptimeCheckIps(, , .GRPC...)
return
}, ...)
if != nil {
return nil, "",
}
.Response =
return .UptimeCheckIps, .NextPageToken, nil
}
:= func( int, string) (string, error) {
, , := .InternalFetch(, )
if != nil {
return "",
}
.items = append(.items, ...)
return , nil
}
.pageInfo, .nextFunc = iterator.NewPageInfo(, .bufLen, .takeBuf)
.pageInfo.MaxSize = int(.PageSize)
.pageInfo.Token = .PageToken
return
}
type UptimeCheckConfigIterator struct {
items []*monitoringpb.UptimeCheckConfig
pageInfo *iterator.PageInfo
nextFunc func() error
Response interface{}
InternalFetch func(pageSize int, pageToken string) (results []*monitoringpb.UptimeCheckConfig, nextPageToken string, err error)
}
func ( *UptimeCheckConfigIterator) () *iterator.PageInfo {
return .pageInfo
}
func ( *UptimeCheckConfigIterator) () (*monitoringpb.UptimeCheckConfig, error) {
var *monitoringpb.UptimeCheckConfig
if := .nextFunc(); != nil {
return ,
}
= .items[0]
.items = .items[1:]
return , nil
}
func ( *UptimeCheckConfigIterator) () int {
return len(.items)
}
func ( *UptimeCheckConfigIterator) () interface{} {
:= .items
.items = nil
return
}
type UptimeCheckIpIterator struct {
items []*monitoringpb.UptimeCheckIp
pageInfo *iterator.PageInfo
nextFunc func() error
Response interface{}
InternalFetch func(pageSize int, pageToken string) (results []*monitoringpb.UptimeCheckIp, nextPageToken string, err error)
}
func ( *UptimeCheckIpIterator) () *iterator.PageInfo {
return .pageInfo
}
func ( *UptimeCheckIpIterator) () (*monitoringpb.UptimeCheckIp, error) {
var *monitoringpb.UptimeCheckIp
if := .nextFunc(); != nil {
return ,
}
= .items[0]
.items = .items[1:]
return , nil
}
func ( *UptimeCheckIpIterator) () int {
return len(.items)
}
func ( *UptimeCheckIpIterator) () interface{} {
:= .items
.items = nil
return
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |