mirror of
https://github.com/fleetdm/fleet
synced 2026-05-18 14:38:53 +00:00
> Closes #33581 <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves # # Checklist for submitter If some of the following don't apply, delete the relevant line. - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. - [x] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) ## Testing - [x] Added/updated automated tests - [x] QA'd all new/changed functionality manually ## Database migrations - [x] Checked table schema to confirm autoupdate - [x] Checked schema for all modified table for columns that will auto-update timestamps during migration. - [x] Ensured the correct collation is explicitly set for character columns (`COLLATE utf8mb4_unicode_ci`). --------- Co-authored-by: RachelElysia <rachel@fleetdm.com>
174 lines
6.8 KiB
Go
174 lines
6.8 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) (*androidmanagement.Policy, error)
|
|
|
|
type EnterprisesDevicesPatchFunc func(ctx context.Context, deviceName string, device *androidmanagement.Device) (*androidmanagement.Device, error)
|
|
|
|
type EnterprisesDevicesGetFunc func(ctx context.Context, deviceName string) (*androidmanagement.Device, error)
|
|
|
|
type EnterprisesDevicesDeleteFunc func(ctx context.Context, deviceName string) 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 EnterprisesListFunc func(ctx context.Context, serverURL string) ([]*androidmanagement.Enterprise, error)
|
|
|
|
type SetAuthenticationSecretFunc func(secret string) error
|
|
|
|
type EnterprisesPoliciesModifyPolicyApplicationsFunc func(ctx context.Context, policyName string, policy *androidmanagement.ApplicationPolicy) (*androidmanagement.Policy, error)
|
|
|
|
type EnterprisesPoliciesRemovePolicyApplicationsFunc func(ctx context.Context, policyName string, appIDs []string) (*androidmanagement.Policy, error)
|
|
|
|
type EnterprisesApplicationsFunc func(ctx context.Context, enterpriseName string, packageName string) (*androidmanagement.Application, error)
|
|
|
|
type Client struct {
|
|
SignupURLsCreateFunc SignupURLsCreateFunc
|
|
SignupURLsCreateFuncInvoked bool
|
|
|
|
EnterprisesCreateFunc EnterprisesCreateFunc
|
|
EnterprisesCreateFuncInvoked bool
|
|
|
|
EnterprisesPoliciesPatchFunc EnterprisesPoliciesPatchFunc
|
|
EnterprisesPoliciesPatchFuncInvoked bool
|
|
|
|
EnterprisesDevicesPatchFunc EnterprisesDevicesPatchFunc
|
|
EnterprisesDevicesPatchFuncInvoked bool
|
|
|
|
EnterprisesDevicesGetFunc EnterprisesDevicesGetFunc
|
|
EnterprisesDevicesGetFuncInvoked bool
|
|
|
|
EnterprisesDevicesDeleteFunc EnterprisesDevicesDeleteFunc
|
|
EnterprisesDevicesDeleteFuncInvoked bool
|
|
|
|
EnterprisesEnrollmentTokensCreateFunc EnterprisesEnrollmentTokensCreateFunc
|
|
EnterprisesEnrollmentTokensCreateFuncInvoked bool
|
|
|
|
EnterpriseDeleteFunc EnterpriseDeleteFunc
|
|
EnterpriseDeleteFuncInvoked bool
|
|
|
|
EnterprisesListFunc EnterprisesListFunc
|
|
EnterprisesListFuncInvoked bool
|
|
|
|
SetAuthenticationSecretFunc SetAuthenticationSecretFunc
|
|
SetAuthenticationSecretFuncInvoked bool
|
|
|
|
EnterprisesPoliciesModifyPolicyApplicationsFunc EnterprisesPoliciesModifyPolicyApplicationsFunc
|
|
EnterprisesPoliciesModifyPolicyApplicationsFuncInvoked bool
|
|
|
|
EnterprisesPoliciesRemovePolicyApplicationsFunc EnterprisesPoliciesRemovePolicyApplicationsFunc
|
|
EnterprisesPoliciesRemovePolicyApplicationsFuncInvoked bool
|
|
|
|
EnterprisesApplicationsFunc EnterprisesApplicationsFunc
|
|
EnterprisesApplicationsFuncInvoked 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) (*androidmanagement.Policy, error) {
|
|
p.mu.Lock()
|
|
p.EnterprisesPoliciesPatchFuncInvoked = true
|
|
p.mu.Unlock()
|
|
return p.EnterprisesPoliciesPatchFunc(ctx, policyName, policy)
|
|
}
|
|
|
|
func (p *Client) EnterprisesDevicesPatch(ctx context.Context, deviceName string, device *androidmanagement.Device) (*androidmanagement.Device, error) {
|
|
p.mu.Lock()
|
|
p.EnterprisesDevicesPatchFuncInvoked = true
|
|
p.mu.Unlock()
|
|
return p.EnterprisesDevicesPatchFunc(ctx, deviceName, device)
|
|
}
|
|
|
|
func (p *Client) EnterprisesDevicesGet(ctx context.Context, deviceName string) (*androidmanagement.Device, error) {
|
|
p.mu.Lock()
|
|
p.EnterprisesDevicesGetFuncInvoked = true
|
|
p.mu.Unlock()
|
|
return p.EnterprisesDevicesGetFunc(ctx, deviceName)
|
|
}
|
|
|
|
func (p *Client) EnterprisesDevicesDelete(ctx context.Context, deviceName string) error {
|
|
p.mu.Lock()
|
|
p.EnterprisesDevicesDeleteFuncInvoked = true
|
|
p.mu.Unlock()
|
|
return p.EnterprisesDevicesDeleteFunc(ctx, deviceName)
|
|
}
|
|
|
|
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) EnterprisesList(ctx context.Context, serverURL string) ([]*androidmanagement.Enterprise, error) {
|
|
p.mu.Lock()
|
|
p.EnterprisesListFuncInvoked = true
|
|
p.mu.Unlock()
|
|
return p.EnterprisesListFunc(ctx, serverURL)
|
|
}
|
|
|
|
func (p *Client) SetAuthenticationSecret(secret string) error {
|
|
p.mu.Lock()
|
|
p.SetAuthenticationSecretFuncInvoked = true
|
|
p.mu.Unlock()
|
|
return p.SetAuthenticationSecretFunc(secret)
|
|
}
|
|
|
|
func (p *Client) EnterprisesPoliciesModifyPolicyApplications(ctx context.Context, policyName string, policy *androidmanagement.ApplicationPolicy) (*androidmanagement.Policy, error) {
|
|
p.mu.Lock()
|
|
p.EnterprisesPoliciesModifyPolicyApplicationsFuncInvoked = true
|
|
p.mu.Unlock()
|
|
return p.EnterprisesPoliciesModifyPolicyApplicationsFunc(ctx, policyName, policy)
|
|
}
|
|
|
|
func (p *Client) EnterprisesPoliciesRemovePolicyApplications(ctx context.Context, policyName string, appIDs []string) (*androidmanagement.Policy, error) {
|
|
p.mu.Lock()
|
|
p.EnterprisesPoliciesRemovePolicyApplicationsFuncInvoked = true
|
|
p.mu.Unlock()
|
|
return p.EnterprisesPoliciesRemovePolicyApplicationsFunc(ctx, policyName, appIDs)
|
|
}
|
|
|
|
func (p *Client) EnterprisesApplications(ctx context.Context, enterpriseName string, packageName string) (*androidmanagement.Application, error) {
|
|
p.mu.Lock()
|
|
p.EnterprisesApplicationsFuncInvoked = true
|
|
p.mu.Unlock()
|
|
return p.EnterprisesApplicationsFunc(ctx, enterpriseName, packageName)
|
|
}
|