func NewClient()

in compute/compute.go [300:343]


func NewClient(ctx context.Context, opts ...option.ClientOption) (Client, error) {
	// Set these scopes to be align with compute.NewService
	o := []option.ClientOption{
		option.WithScopes(
			compute.CloudPlatformScope,
			compute.ComputeScope,
			compute.ComputeReadonlyScope,
			compute.DevstorageFullControlScope,
			compute.DevstorageReadOnlyScope,
			compute.DevstorageReadWriteScope,
		),
	}
	opts = append(o, opts...)
	hc, ep, err := transport.NewHTTPClient(ctx, opts...)
	if err != nil {
		return nil, fmt.Errorf("error creating HTTP API client: %v", err)
	}
	rawService, err := compute.New(hc)
	if err != nil {
		return nil, fmt.Errorf("compute client: %v", err)
	}
	if ep != "" {
		rawService.BasePath = ep
	}
	rawBetaService, err := computeBeta.New(hc)
	if err != nil {
		return nil, fmt.Errorf("beta compute client: %v", err)
	}
	if ep != "" {
		rawBetaService.BasePath = ep
	}
	rawAlphaService, err := computeAlpha.New(hc)
	if err != nil {
		return nil, fmt.Errorf("alpha compute client: %v", err)
	}
	if ep != "" {
		rawAlphaService.BasePath = ep
	}

	c := &client{hc: hc, raw: rawService, rawBeta: rawBetaService, rawAlpha: rawAlphaService}
	c.i = c

	return c, nil
}