def validateEnvironment(self, root, path): fields = {'kind', 'project', 'region', 'sshUser', 'serviceAccount'} validate.obj_only(root, path, fields) validate.path_val(root, path + ['project'], 'string') validate.path_val(root, path + ['region'], 'string') validate.path_val(root, path + ['sshUser'], 'string') acc = validate.path_val(root, path + ['serviceAccount'], 'object') validate.path_val(root, path + ['serviceAccount', 'client_email'], 'string') validate.path_val(root, path + ['serviceAccount', 'private_key'], 'string') validate.path_val(root, path + ['serviceAccount', 'type'], validate.is_value('service_account'), 'service_account') validate.path_val(root, path + ['serviceAccount', 'client_id'], 'string', '') validate.path_val(root, path + ['serviceAccount', 'private_key_id'], 'string', '') fields = {'client_email', 'private_key', 'type', 'client_id', 'private_key_id'} validate.obj_only(root, path + ['serviceAccount'], fields)
def validateEnvironment(self, env_name, env): ctx = 'Environment "%s"' % env_name fields = ['kind', 'project', 'region', 'sshUser', 'serviceAccount'] validate.obj_only(ctx, env, fields) validate.obj_field(ctx, env, 'project', 'string') validate.obj_field(ctx, env, 'region', 'string') validate.obj_field(ctx, env, 'sshUser', 'string') acc = validate.obj_field(ctx, env, 'serviceAccount', validate.is_type('object')) validate.obj_field(ctx + ' serviceAccount', acc, 'client_email', 'string') validate.obj_field(ctx + ' serviceAccount', acc, 'private_key', 'string') validate.obj_field_opt(ctx + ' serviceAccount', acc, 'type', validate.is_value('service_account')) validate.obj_field_opt(ctx + ' serviceAccount', acc, 'client_id', 'string') validate.obj_field_opt(ctx + ' serviceAccount', acc, 'private_key_id', 'string') fields = ['client_email', 'private_key', 'type', 'client_id', 'private_key_id'] validate.obj_only(ctx + ' serviceAccount', acc, fields)