Skip to content

Commit

Permalink
requireAdminApproval/requireCorpOwned in AccessLevel's devicePolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
megan07 authored Nov 18, 2019
2 parents b486de7 + 2b52264 commit 2a828f4
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
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

0 comments on commit 2a828f4

Please sign in to comment.