Skip to content

Commit 7a87ff0

Browse files
committed
chore(SCC): Manual change example test test_replace_rule_example
Signed-off-by: Bryan Bosely <[email protected]>
1 parent 7176d3b commit 7a87ff0

File tree

1 file changed

+51
-56
lines changed

1 file changed

+51
-56
lines changed

examples/test_security_and_compliance_center_api_v3_examples.py

Lines changed: 51 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,62 +1896,57 @@ def test_get_rule_example(self):
18961896

18971897
@needscredentials
18981898
def test_replace_rule_example(self):
1899-
"""
1900-
replace_rule request example
1901-
"""
1902-
try:
1903-
print('\nreplace_rule() result:')
1904-
1905-
# begin-replace_rule
1906-
1907-
additional_target_attribute_model = {
1908-
'name': 'location',
1909-
'operator': 'string_equals',
1910-
'value': 'us-south',
1911-
}
1912-
1913-
rule_target_prototype_model = {
1914-
'service_name': 'cloud-object-storage',
1915-
'resource_kind': 'bucket',
1916-
'additional_target_attributes': [additional_target_attribute_model],
1917-
}
1918-
1919-
required_config_model = {
1920-
'description': 'The Cloud Object Storage rule.',
1921-
'property': 'testString',
1922-
'operator': 'string_equals',
1923-
}
1924-
1925-
rule_parameter_model = {
1926-
'name': 'hard_quota',
1927-
'display_name': 'The Cloud Object Storage bucket quota.',
1928-
'description': 'The maximum bytes that are allocated to the Cloud Object Storage bucket.',
1929-
'type': 'numeric',
1930-
}
1931-
1932-
import_model = {
1933-
'parameters': [rule_parameter_model],
1934-
}
1935-
1936-
response = security_and_compliance_center_api_service.replace_rule(
1937-
instance_id='acd7032c-15a3-484f-bf5b-67d41534d940',
1938-
rule_id=rule_id_link,
1939-
if_match=e_tag_link,
1940-
description='Example rule',
1941-
target=rule_target_prototype_model,
1942-
required_config=required_config_model,
1943-
version='1.0.1',
1944-
import_=import_model,
1945-
labels=[],
1946-
)
1947-
rule = response.get_result()
1948-
1949-
print(json.dumps(rule, indent=2))
1950-
1951-
# end-replace_rule
1952-
1953-
except ApiException as e:
1954-
pytest.fail(str(e))
1899+
# Construct a dict representation of a AdditionalTargetAttribute model
1900+
additional_target_attribute_model = {
1901+
'name': 'location',
1902+
'operator': 'string_equals',
1903+
'value': 'us-south',
1904+
}
1905+
# Construct a dict representation of a RuleTargetPrototype model
1906+
rule_target_prototype_model = {
1907+
'service_name': 'cloud-object-storage',
1908+
'resource_kind': 'bucket',
1909+
'additional_target_attributes': [additional_target_attribute_model],
1910+
}
1911+
# Construct a dict representation of ConditionItemConditionBase model
1912+
condition_item_model = {
1913+
'description': 'The Cloud Object Storage rule.',
1914+
'property': 'hard_quota',
1915+
'operator': 'num_equals',
1916+
'value': '${hard_quota}',
1917+
}
1918+
# Construct a dict representation of a RequiredConfigConditionBase model
1919+
required_config_model = {
1920+
'description': 'The Cloud Object Storage rule.',
1921+
'and': [condition_item_model],
1922+
}
1923+
# Construct a dict representation of a RuleParameter model
1924+
rule_parameter_model = {
1925+
'name': 'hard_quota',
1926+
'display_name': 'The Cloud Object Storage bucket quota.',
1927+
'description': 'The maximum bytes that are allocated to the Cloud Object Storage bucket.',
1928+
'type': 'numeric',
1929+
}
1930+
# Construct a dict representation of a Import model
1931+
import_model = {
1932+
'parameters': [rule_parameter_model],
1933+
}
1934+
1935+
response = security_and_compliance_center_api_service.replace_rule(
1936+
instance_id='acd7032c-15a3-484f-bf5b-67d41534d940',
1937+
rule_id=rule_id_link,
1938+
if_match=e_tag_link,
1939+
description='Example rule',
1940+
target=rule_target_prototype_model,
1941+
required_config=required_config_model,
1942+
version='1.0.1',
1943+
import_=import_model,
1944+
labels=[],
1945+
)
1946+
1947+
assert response.get_status_code() == 200
1948+
rule = response.get_result()
1949+
assert rule is not None
19551950

19561951
@needscredentials
19571952
def test_list_services_example(self):

0 commit comments

Comments
 (0)