| // Copyright 2021 Google LLC |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| // package devicepolicy provides utility functions for generating Chrome OS |
| // device policy file and the key files. |
| package devicepolicy |
| |
| import "policy_manager/policymanagerproto" |
| |
| // Manager maintains Chrome OS device policy file and COS device policy file. |
| type Manager interface { |
| // InitDevicePolicy initializes instance's environment to support device |
| // policies. Users of the Manager are expected to call the this function |
| // before any other device policy related functions. The settings in |
| // baseConfig (if not nil) are retained in the generated devicepolicy. |
| InitDevicePolicy(baseConfig *policymanagerproto.InstanceConfig) error |
| |
| // SetInstanceConfig sets a new device policy from an InstanceConfig. The |
| // new policy will atomically replace the existing policy. |
| // Must be called after InitDevicePolicy() has been called. |
| SetInstanceConfig(config *policymanagerproto.InstanceConfig) error |
| |
| // GetInstanceConfig reads the policy file from disk and returns the |
| // InstanceConfig proto. |
| GetInstanceConfig() (*policymanagerproto.InstanceConfig, error) |
| } |