fleet/server/mdm/android/mock/client.go
Victor Lyuboslavsky 1577d491b2
Hook up Android fleetdm.com/proxy (#29645)
For #26519 

This PR allows Fleet server to use Android with either fleetdm.com proxy
or locally. It also removes the Android feature flag from the backend.
The frontend changes and proxy API documentation will be in separate
PRs.

Updated contributor docs:
https://github.com/fleetdm/fleet/pull/29880/files

Integration tests are missing and tracked as a separate issue:
https://github.com/fleetdm/fleet/issues/27080

# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
- [x] Added/updated automated tests
- [x] Manual QA for all new/changed functionality
2025-06-12 19:42:15 -05:00

90 lines
3.1 KiB
Go

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