fleet/server/mdm/android/mock/proxy.go
Victor Lyuboslavsky 3d9072981b
Delete Android PubSub topic when deleting enterprise. (#26676)
For #26218

This is a dev helper feature (since it will be implemented in
fleetdm.com). It fixes the issue of stale PubSub topics. Having stale
PubSub topics around may cause extra traffic/errors on dev server.

- [x] Manual QA for all new/changed functionality
2025-02-28 15:06:52 -06:00

77 lines
2.5 KiB
Go

// Automatically generated by mockimpl. DO NOT EDIT!
package mock
import (
"context"
"sync"
"github.com/fleetdm/fleet/v4/server/mdm/android"
"google.golang.org/api/androidmanagement/v1"
)
var _ android.Proxy = (*Proxy)(nil)
type SignupURLsCreateFunc func(callbackURL string) (*android.SignupDetails, error)
type EnterprisesCreateFunc func(ctx context.Context, req android.ProxyEnterprisesCreateRequest) (string, string, error)
type EnterprisesPoliciesPatchFunc func(enterpriseID string, policyName string, policy *androidmanagement.Policy) error
type EnterprisesEnrollmentTokensCreateFunc func(enterpriseName string, token *androidmanagement.EnrollmentToken) (*androidmanagement.EnrollmentToken, error)
type EnterpriseDeleteFunc func(ctx context.Context, enterpriseID string) error
type Proxy struct {
SignupURLsCreateFunc SignupURLsCreateFunc
SignupURLsCreateFuncInvoked bool
EnterprisesCreateFunc EnterprisesCreateFunc
EnterprisesCreateFuncInvoked bool
EnterprisesPoliciesPatchFunc EnterprisesPoliciesPatchFunc
EnterprisesPoliciesPatchFuncInvoked bool
EnterprisesEnrollmentTokensCreateFunc EnterprisesEnrollmentTokensCreateFunc
EnterprisesEnrollmentTokensCreateFuncInvoked bool
EnterpriseDeleteFunc EnterpriseDeleteFunc
EnterpriseDeleteFuncInvoked bool
mu sync.Mutex
}
func (p *Proxy) SignupURLsCreate(callbackURL string) (*android.SignupDetails, error) {
p.mu.Lock()
p.SignupURLsCreateFuncInvoked = true
p.mu.Unlock()
return p.SignupURLsCreateFunc(callbackURL)
}
func (p *Proxy) EnterprisesCreate(ctx context.Context, req android.ProxyEnterprisesCreateRequest) (string, string, error) {
p.mu.Lock()
p.EnterprisesCreateFuncInvoked = true
p.mu.Unlock()
return p.EnterprisesCreateFunc(ctx, req)
}
func (p *Proxy) EnterprisesPoliciesPatch(enterpriseID string, policyName string, policy *androidmanagement.Policy) error {
p.mu.Lock()
p.EnterprisesPoliciesPatchFuncInvoked = true
p.mu.Unlock()
return p.EnterprisesPoliciesPatchFunc(enterpriseID, policyName, policy)
}
func (p *Proxy) EnterprisesEnrollmentTokensCreate(enterpriseName string, token *androidmanagement.EnrollmentToken) (*androidmanagement.EnrollmentToken, error) {
p.mu.Lock()
p.EnterprisesEnrollmentTokensCreateFuncInvoked = true
p.mu.Unlock()
return p.EnterprisesEnrollmentTokensCreateFunc(enterpriseName, token)
}
func (p *Proxy) EnterpriseDelete(ctx context.Context, enterpriseID string) error {
p.mu.Lock()
p.EnterpriseDeleteFuncInvoked = true
p.mu.Unlock()
return p.EnterpriseDeleteFunc(ctx, enterpriseID)
}