Skip to content

Commit

Permalink
Add SetSslPolicy to global TargetHttpsProxies
Browse files Browse the repository at this point in the history
Regenerates with additional SetSslPolicy() and includes mocks as well
  • Loading branch information
spencerhance authored and bowei committed Feb 3, 2020
1 parent 1f8eb91 commit 44b4a80
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 0 deletions.
129 changes: 129 additions & 0 deletions pkg/cloud/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -24076,6 +24076,7 @@ type TargetHttpsProxies interface {
Insert(ctx context.Context, key *meta.Key, obj *ga.TargetHttpsProxy) error
Delete(ctx context.Context, key *meta.Key) error
SetSslCertificates(context.Context, *meta.Key, *ga.TargetHttpsProxiesSetSslCertificatesRequest) error
SetSslPolicy(context.Context, *meta.Key, *ga.SslPolicyReference) error
SetUrlMap(context.Context, *meta.Key, *ga.UrlMapReference) error
}

Expand Down Expand Up @@ -24117,6 +24118,7 @@ type MockTargetHttpsProxies struct {
InsertHook func(ctx context.Context, key *meta.Key, obj *ga.TargetHttpsProxy, m *MockTargetHttpsProxies) (bool, error)
DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpsProxies) (bool, error)
SetSslCertificatesHook func(context.Context, *meta.Key, *ga.TargetHttpsProxiesSetSslCertificatesRequest, *MockTargetHttpsProxies) error
SetSslPolicyHook func(context.Context, *meta.Key, *ga.SslPolicyReference, *MockTargetHttpsProxies) error
SetUrlMapHook func(context.Context, *meta.Key, *ga.UrlMapReference, *MockTargetHttpsProxies) error

// X is extra state that can be used as part of the mock. Generated code
Expand Down Expand Up @@ -24271,6 +24273,14 @@ func (m *MockTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *me
return nil
}

// SetSslPolicy is a mock for the corresponding method.
func (m *MockTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *ga.SslPolicyReference) error {
if m.SetSslPolicyHook != nil {
return m.SetSslPolicyHook(ctx, key, arg0, m)
}
return nil
}

// SetUrlMap is a mock for the corresponding method.
func (m *MockTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *ga.UrlMapReference) error {
if m.SetUrlMapHook != nil {
Expand Down Expand Up @@ -24454,6 +24464,39 @@ func (g *GCETargetHttpsProxies) SetSslCertificates(ctx context.Context, key *met
return err
}

// SetSslPolicy is a method on GCETargetHttpsProxies.
func (g *GCETargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *ga.SslPolicyReference) error {
klog.V(5).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...): called", ctx, key)

if !key.Valid() {
klog.V(2).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...): key is invalid (%#v)", ctx, key, key)
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpsProxies")
rk := &RateLimitKey{
ProjectID: projectID,
Operation: "SetSslPolicy",
Version: meta.Version("ga"),
Service: "TargetHttpsProxies",
}
klog.V(5).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, rk = %+v", ctx, key, projectID, rk)

if err := g.s.RateLimiter.Accept(ctx, rk); err != nil {
klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err)
return err
}
call := g.s.GA.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0)
call.Context(ctx)
op, err := call.Do()
if err != nil {
klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err)
return err
}
err = g.s.WaitForCompletion(ctx, op)
klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err)
return err
}

// SetUrlMap is a method on GCETargetHttpsProxies.
func (g *GCETargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *ga.UrlMapReference) error {
klog.V(5).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...): called", ctx, key)
Expand Down Expand Up @@ -24494,6 +24537,7 @@ type AlphaTargetHttpsProxies interface {
Insert(ctx context.Context, key *meta.Key, obj *alpha.TargetHttpsProxy) error
Delete(ctx context.Context, key *meta.Key) error
SetSslCertificates(context.Context, *meta.Key, *alpha.TargetHttpsProxiesSetSslCertificatesRequest) error
SetSslPolicy(context.Context, *meta.Key, *alpha.SslPolicyReference) error
SetUrlMap(context.Context, *meta.Key, *alpha.UrlMapReference) error
}

Expand Down Expand Up @@ -24535,6 +24579,7 @@ type MockAlphaTargetHttpsProxies struct {
InsertHook func(ctx context.Context, key *meta.Key, obj *alpha.TargetHttpsProxy, m *MockAlphaTargetHttpsProxies) (bool, error)
DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpsProxies) (bool, error)
SetSslCertificatesHook func(context.Context, *meta.Key, *alpha.TargetHttpsProxiesSetSslCertificatesRequest, *MockAlphaTargetHttpsProxies) error
SetSslPolicyHook func(context.Context, *meta.Key, *alpha.SslPolicyReference, *MockAlphaTargetHttpsProxies) error
SetUrlMapHook func(context.Context, *meta.Key, *alpha.UrlMapReference, *MockAlphaTargetHttpsProxies) error

// X is extra state that can be used as part of the mock. Generated code
Expand Down Expand Up @@ -24689,6 +24734,14 @@ func (m *MockAlphaTargetHttpsProxies) SetSslCertificates(ctx context.Context, ke
return nil
}

// SetSslPolicy is a mock for the corresponding method.
func (m *MockAlphaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *alpha.SslPolicyReference) error {
if m.SetSslPolicyHook != nil {
return m.SetSslPolicyHook(ctx, key, arg0, m)
}
return nil
}

// SetUrlMap is a mock for the corresponding method.
func (m *MockAlphaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *alpha.UrlMapReference) error {
if m.SetUrlMapHook != nil {
Expand Down Expand Up @@ -24872,6 +24925,39 @@ func (g *GCEAlphaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key
return err
}

// SetSslPolicy is a method on GCEAlphaTargetHttpsProxies.
func (g *GCEAlphaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *alpha.SslPolicyReference) error {
klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): called", ctx, key)

if !key.Valid() {
klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): key is invalid (%#v)", ctx, key, key)
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "TargetHttpsProxies")
rk := &RateLimitKey{
ProjectID: projectID,
Operation: "SetSslPolicy",
Version: meta.Version("alpha"),
Service: "TargetHttpsProxies",
}
klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, rk = %+v", ctx, key, projectID, rk)

if err := g.s.RateLimiter.Accept(ctx, rk); err != nil {
klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err)
return err
}
call := g.s.Alpha.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0)
call.Context(ctx)
op, err := call.Do()
if err != nil {
klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err)
return err
}
err = g.s.WaitForCompletion(ctx, op)
klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err)
return err
}

// SetUrlMap is a method on GCEAlphaTargetHttpsProxies.
func (g *GCEAlphaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *alpha.UrlMapReference) error {
klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...): called", ctx, key)
Expand Down Expand Up @@ -24912,6 +24998,7 @@ type BetaTargetHttpsProxies interface {
Insert(ctx context.Context, key *meta.Key, obj *beta.TargetHttpsProxy) error
Delete(ctx context.Context, key *meta.Key) error
SetSslCertificates(context.Context, *meta.Key, *beta.TargetHttpsProxiesSetSslCertificatesRequest) error
SetSslPolicy(context.Context, *meta.Key, *beta.SslPolicyReference) error
SetUrlMap(context.Context, *meta.Key, *beta.UrlMapReference) error
}

Expand Down Expand Up @@ -24953,6 +25040,7 @@ type MockBetaTargetHttpsProxies struct {
InsertHook func(ctx context.Context, key *meta.Key, obj *beta.TargetHttpsProxy, m *MockBetaTargetHttpsProxies) (bool, error)
DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpsProxies) (bool, error)
SetSslCertificatesHook func(context.Context, *meta.Key, *beta.TargetHttpsProxiesSetSslCertificatesRequest, *MockBetaTargetHttpsProxies) error
SetSslPolicyHook func(context.Context, *meta.Key, *beta.SslPolicyReference, *MockBetaTargetHttpsProxies) error
SetUrlMapHook func(context.Context, *meta.Key, *beta.UrlMapReference, *MockBetaTargetHttpsProxies) error

// X is extra state that can be used as part of the mock. Generated code
Expand Down Expand Up @@ -25107,6 +25195,14 @@ func (m *MockBetaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key
return nil
}

// SetSslPolicy is a mock for the corresponding method.
func (m *MockBetaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *beta.SslPolicyReference) error {
if m.SetSslPolicyHook != nil {
return m.SetSslPolicyHook(ctx, key, arg0, m)
}
return nil
}

// SetUrlMap is a mock for the corresponding method.
func (m *MockBetaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *beta.UrlMapReference) error {
if m.SetUrlMapHook != nil {
Expand Down Expand Up @@ -25290,6 +25386,39 @@ func (g *GCEBetaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key
return err
}

// SetSslPolicy is a method on GCEBetaTargetHttpsProxies.
func (g *GCEBetaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *beta.SslPolicyReference) error {
klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): called", ctx, key)

if !key.Valid() {
klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): key is invalid (%#v)", ctx, key, key)
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "TargetHttpsProxies")
rk := &RateLimitKey{
ProjectID: projectID,
Operation: "SetSslPolicy",
Version: meta.Version("beta"),
Service: "TargetHttpsProxies",
}
klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, rk = %+v", ctx, key, projectID, rk)

if err := g.s.RateLimiter.Accept(ctx, rk); err != nil {
klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err)
return err
}
call := g.s.Beta.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0)
call.Context(ctx)
op, err := call.Do()
if err != nil {
klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err)
return err
}
err = g.s.WaitForCompletion(ctx, op)
klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err)
return err
}

// SetUrlMap is a method on GCEBetaTargetHttpsProxies.
func (g *GCEBetaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *beta.UrlMapReference) error {
klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...): called", ctx, key)
Expand Down
3 changes: 3 additions & 0 deletions pkg/cloud/meta/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ var AllServices = []*ServiceInfo{
serviceType: reflect.TypeOf(&ga.TargetHttpsProxiesService{}),
additionalMethods: []string{
"SetSslCertificates",
"SetSslPolicy",
"SetUrlMap",
},
},
Expand All @@ -669,6 +670,7 @@ var AllServices = []*ServiceInfo{
serviceType: reflect.TypeOf(&alpha.TargetHttpsProxiesService{}),
additionalMethods: []string{
"SetSslCertificates",
"SetSslPolicy",
"SetUrlMap",
},
},
Expand All @@ -681,6 +683,7 @@ var AllServices = []*ServiceInfo{
serviceType: reflect.TypeOf(&beta.TargetHttpsProxiesService{}),
additionalMethods: []string{
"SetSslCertificates",
"SetSslPolicy",
"SetUrlMap",
},
},
Expand Down
41 changes: 41 additions & 0 deletions pkg/cloud/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,16 @@ func SetSslCertificateAlphaTargetHTTPSProxyHook(ctx context.Context, key *meta.K
return nil
}

// SetSslCertificateAlphaTargetHTTPSProxyHook defines the hook for setting ssl certificates on a TargetHttpsProxy.
func SetSslCertificateBetaTargetHTTPSProxyHook(ctx context.Context, key *meta.Key, req *beta.TargetHttpsProxiesSetSslCertificatesRequest, m *cloud.MockBetaTargetHttpsProxies) error {
tp, err := m.Get(ctx, key)
if err != nil {
return err
}
tp.SslCertificates = req.SslCertificates
return nil
}

// SetSslCertificateAlphaRegionTargetHTTPSProxyHook defines the hook for setting ssl certificates on a TargetHttpsProxy.
func SetSslCertificateAlphaRegionTargetHTTPSProxyHook(ctx context.Context, key *meta.Key, req *alpha.TargetHttpsProxiesSetSslCertificatesRequest, m *cloud.MockAlphaRegionTargetHttpsProxies) error {
tp, err := m.Get(ctx, key)
Expand Down Expand Up @@ -894,6 +904,37 @@ func SetSslCertificateRegionTargetHTTPSProxyHook(ctx context.Context, key *meta.
return nil
}

// SetSslCertificateTargetHTTPSProxyHook defines the hook for setting ssl certificates on a TargetHttpsProxy.
func SetSslPolicyTargetHTTPSProxyHook(ctx context.Context, key *meta.Key, ref *ga.SslPolicyReference, m *cloud.MockTargetHttpsProxies) error {
tp, err := m.Get(ctx, key)
if err != nil {
return err
}

tp.SslPolicy = ref.SslPolicy
return nil
}

// SetSslCertificateAlphaTargetHTTPSProxyHook defines the hook for setting ssl certificates on a TargetHttpsProxy.
func SetSslPolicyAlphaTargetHTTPSProxyHook(ctx context.Context, key *meta.Key, ref *alpha.SslPolicyReference, m *cloud.MockAlphaTargetHttpsProxies) error {
tp, err := m.Get(ctx, key)
if err != nil {
return err
}
tp.SslPolicy = ref.SslPolicy
return nil
}

// SetSslCertificateAlphaTargetHTTPSProxyHook defines the hook for setting ssl certificates on a TargetHttpsProxy.
func SetSslPolicyBetaTargetHTTPSProxyHook(ctx context.Context, key *meta.Key, ref *beta.SslPolicyReference, m *cloud.MockBetaTargetHttpsProxies) error {
tp, err := m.Get(ctx, key)
if err != nil {
return err
}
tp.SslPolicy = ref.SslPolicy
return nil
}


// InsertFirewallsUnauthorizedErrHook mocks firewall insertion. A forbidden error will be thrown as return.
func InsertFirewallsUnauthorizedErrHook(ctx context.Context, key *meta.Key, obj *ga.Firewall, m *cloud.MockFirewalls) (bool, error) {
Expand Down

0 comments on commit 44b4a80

Please sign in to comment.