func NewService()

in sharedlibraries/gce/wlm/wlm.go [86:111]


func NewService(ctx context.Context, opts ...option.ClientOption) (*DataWarehouseService, error) {
	log.CtxLogger(ctx).Debug("NewService")
	scopesOption := internaloption.WithDefaultScopes(
		"https://www.googleapis.com/auth/cloud-platform",
	)
	log.CtxLogger(ctx).Debug("Adding default options")
	// NOTE: prepend, so we don't override user-specified scopes.
	opts = append([]option.ClientOption{scopesOption}, opts...)
	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
	opts = append(opts, internaloption.WithDefaultUniverseDomain(defaultUniverseDomain))
	log.CtxLogger(ctx).Debugw("Creating client with opts", "opts", opts)
	client, endpoint, err := htransport.NewClient(ctx, opts...)
	log.CtxLogger(ctx).Debug("Created client")
	if err != nil {
		return nil, err
	}
	if client == nil {
		return nil, fmt.Errorf("client is nil")

	}
	log.CtxLogger(ctx).Debug("Creating service")
	s := &DataWarehouseService{c: client, BasePath: endpoint}
	log.CtxLogger(ctx).Debug("Created service")
	return s, nil
}