Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requireAdminApproval/requireCorpOwned in AccessLevel's devicePolicy #4931

Merged
merged 1 commit into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions google/resource_access_context_manager_access_level.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ Format: "major.minor.patch" such as "10.5.301", "9.2.1".`,
},
},
},
"require_admin_approval": {
Type: schema.TypeBool,
Optional: true,
Description: `Whether the device needs to be approved by the customer admin.`,
},
"require_corp_owned": {
Type: schema.TypeBool,
Optional: true,
Description: `Whether the device needs to be corp owned.`,
},
"require_screen_lock": {
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -511,6 +521,10 @@ func flattenAccessContextManagerAccessLevelBasicConditionsDevicePolicy(v interfa
flattenAccessContextManagerAccessLevelBasicConditionsDevicePolicyAllowedDeviceManagementLevels(original["allowedDeviceManagementLevels"], d)
transformed["os_constraints"] =
flattenAccessContextManagerAccessLevelBasicConditionsDevicePolicyOsConstraints(original["osConstraints"], d)
transformed["require_admin_approval"] =
flattenAccessContextManagerAccessLevelBasicConditionsDevicePolicyRequireAdminApproval(original["requireAdminApproval"], d)
transformed["require_corp_owned"] =
flattenAccessContextManagerAccessLevelBasicConditionsDevicePolicyRequireCorpOwned(original["requireCorpOwned"], d)
return []interface{}{transformed}
}
func flattenAccessContextManagerAccessLevelBasicConditionsDevicePolicyRequireScreenLock(v interface{}, d *schema.ResourceData) interface{} {
Expand Down Expand Up @@ -552,6 +566,14 @@ func flattenAccessContextManagerAccessLevelBasicConditionsDevicePolicyOsConstrai
return v
}

func flattenAccessContextManagerAccessLevelBasicConditionsDevicePolicyRequireAdminApproval(v interface{}, d *schema.ResourceData) interface{} {
return v
}

func flattenAccessContextManagerAccessLevelBasicConditionsDevicePolicyRequireCorpOwned(v interface{}, d *schema.ResourceData) interface{} {
return v
}

func flattenAccessContextManagerAccessLevelName(v interface{}, d *schema.ResourceData) interface{} {
return v
}
Expand Down Expand Up @@ -697,6 +719,20 @@ func expandAccessContextManagerAccessLevelBasicConditionsDevicePolicy(v interfac
transformed["osConstraints"] = transformedOsConstraints
}

transformedRequireAdminApproval, err := expandAccessContextManagerAccessLevelBasicConditionsDevicePolicyRequireAdminApproval(original["require_admin_approval"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedRequireAdminApproval); val.IsValid() && !isEmptyValue(val) {
transformed["requireAdminApproval"] = transformedRequireAdminApproval
}

transformedRequireCorpOwned, err := expandAccessContextManagerAccessLevelBasicConditionsDevicePolicyRequireCorpOwned(original["require_corp_owned"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedRequireCorpOwned); val.IsValid() && !isEmptyValue(val) {
transformed["requireCorpOwned"] = transformedRequireCorpOwned
}

return transformed, nil
}

Expand Down Expand Up @@ -749,6 +785,14 @@ func expandAccessContextManagerAccessLevelBasicConditionsDevicePolicyOsConstrain
return v, nil
}

func expandAccessContextManagerAccessLevelBasicConditionsDevicePolicyRequireAdminApproval(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandAccessContextManagerAccessLevelBasicConditionsDevicePolicyRequireCorpOwned(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandAccessContextManagerAccessLevelParent(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
Expand Down
2 changes: 2 additions & 0 deletions google/resource_access_context_manager_access_level_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ resource "google_access_context_manager_access_level" "test-access" {
negate = false
device_policy {
require_screen_lock = false
require_admin_approval = false
require_corp_owned = true
os_constraints {
os_type = "DESKTOP_CHROME_OS"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ The `device_policy` block supports:
A list of allowed OS versions.
An empty list allows all types and all versions. Structure is documented below.

* `require_admin_approval` -
(Optional)
Whether the device needs to be approved by the customer admin.

* `require_corp_owned` -
(Optional)
Whether the device needs to be corp owned.


The `os_constraints` block supports:

Expand Down