@@ -20,6 +20,7 @@ import (
2020
2121 assuredworkloads "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/assuredworkloads/beta"
2222 cloudbuild "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/cloudbuild/beta"
23+ compute "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/compute/beta"
2324 dataproc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataproc/beta"
2425 eventarc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/eventarc/beta"
2526 gkehub "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/gkehub/beta"
@@ -63,6 +64,25 @@ func NewDCLCloudbuildClient(config *Config, userAgent, billingProject string) *c
6364 return cloudbuild .NewClient (dclConfig )
6465}
6566
67+ func NewDCLComputeClient (config * Config , userAgent , billingProject string ) * compute.Client {
68+ configOptions := []dcl.ConfigOption {
69+ dcl .WithHTTPClient (config .client ),
70+ dcl .WithUserAgent (userAgent ),
71+ dcl .WithLogger (dclLogger {}),
72+ dcl .WithBasePath (config .ComputeBasePath ),
73+ }
74+
75+ if config .UserProjectOverride {
76+ configOptions = append (configOptions , dcl .WithUserProjectOverride ())
77+ if billingProject != "" {
78+ configOptions = append (configOptions , dcl .WithBillingProject (billingProject ))
79+ }
80+ }
81+
82+ dclConfig := dcl .NewConfig (configOptions ... )
83+ return compute .NewClient (dclConfig )
84+ }
85+
6686func NewDCLDataprocClient (config * Config , userAgent , billingProject string ) * dataproc.Client {
6787 configOptions := []dcl.ConfigOption {
6888 dcl .WithHTTPClient (config .client ),
0 commit comments