Skip to content

Commit

Permalink
fix(security_center)!: Remove unused resource path helpers
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Removed SecurityCenterClient.asset_path and SecurityCenterClient.organization_sources_path
  • Loading branch information
yoshi-automation committed Feb 24, 2020
1 parent 327eda6 commit b55ced5
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 110 deletions.
Expand Up @@ -18,14 +18,6 @@ module SecurityCenter
module V1
class SecurityCenterClient

# Alias for Google::Cloud::SecurityCenter::V1::SecurityCenterClient.asset_path.
# @param organization [String]
# @param asset [String]
# @return [String]
def asset_path organization, asset
self.class.asset_path organization, asset
end

# Alias for Google::Cloud::SecurityCenter::V1::SecurityCenterClient.asset_security_marks_path.
# @param organization [String]
# @param asset [String]
Expand Down Expand Up @@ -66,13 +58,6 @@ def organization_settings_path organization
self.class.organization_settings_path organization
end

# Alias for Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_sources_path.
# @param organization [String]
# @return [String]
def organization_sources_path organization
self.class.organization_sources_path organization
end

# Alias for Google::Cloud::SecurityCenter::V1::SecurityCenterClient.source_path.
# @param organization [String]
# @param source [String]
Expand Down
Expand Up @@ -91,12 +91,6 @@ class OperationsClient < Google::Longrunning::OperationsClient
self::GRPC_INTERCEPTORS = SecurityCenterClient::GRPC_INTERCEPTORS
end

ASSET_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
"organizations/{organization}/assets/{asset}"
)

private_constant :ASSET_PATH_TEMPLATE

ASSET_SECURITY_MARKS_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
"organizations/{organization}/assets/{asset}/securityMarks"
)
Expand Down Expand Up @@ -127,30 +121,15 @@ class OperationsClient < Google::Longrunning::OperationsClient

private_constant :ORGANIZATION_SETTINGS_PATH_TEMPLATE

ORGANIZATION_SOURCES_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
"organizations/{organization}/sources/-"
)

private_constant :ORGANIZATION_SOURCES_PATH_TEMPLATE

SOURCE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
"organizations/{organization}/sources/{source}"
)

private_constant :SOURCE_PATH_TEMPLATE

# Returns a fully-qualified asset resource name string.
# @param organization [String]
# @param asset [String]
# @return [String]
def self.asset_path organization, asset
ASSET_PATH_TEMPLATE.render(
:"organization" => organization,
:"asset" => asset
)
end

# Returns a fully-qualified asset_security_marks resource name string.
# @deprecated Multi-pattern resource names will have unified creation and parsing helper functions.
# This helper function will be deleted in the next major version.
# @param organization [String]
# @param asset [String]
# @return [String]
Expand All @@ -175,6 +154,8 @@ def self.finding_path organization, source, finding
end

# Returns a fully-qualified finding_security_marks resource name string.
# @deprecated Multi-pattern resource names will have unified creation and parsing helper functions.
# This helper function will be deleted in the next major version.
# @param organization [String]
# @param source [String]
# @param finding [String]
Expand Down Expand Up @@ -205,15 +186,6 @@ def self.organization_settings_path organization
)
end

# Returns a fully-qualified organization_sources resource name string.
# @param organization [String]
# @return [String]
def self.organization_sources_path organization
ORGANIZATION_SOURCES_PATH_TEMPLATE.render(
:"organization" => organization
)
end

# Returns a fully-qualified source resource name string.
# @param organization [String]
# @param source [String]
Expand Down Expand Up @@ -608,8 +580,10 @@ def create_finding \
# require "google/cloud/security_center"
#
# security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
# formatted_resource = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.source_path("[ORGANIZATION]", "[SOURCE]")
# response = security_center_client.get_iam_policy(formatted_resource)
#
# # TODO: Initialize `resource`:
# resource = ''
# response = security_center_client.get_iam_policy(resource)

def get_iam_policy \
resource,
Expand Down Expand Up @@ -1583,11 +1557,13 @@ def set_finding_state \
# require "google/cloud/security_center"
#
# security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
# formatted_resource = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.source_path("[ORGANIZATION]", "[SOURCE]")
#
# # TODO: Initialize `resource`:
# resource = ''
#
# # TODO: Initialize `policy`:
# policy = {}
# response = security_center_client.set_iam_policy(formatted_resource, policy)
# response = security_center_client.set_iam_policy(resource, policy)

def set_iam_policy \
resource,
Expand Down Expand Up @@ -1624,11 +1600,13 @@ def set_iam_policy \
# require "google/cloud/security_center"
#
# security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
# formatted_resource = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.source_path("[ORGANIZATION]", "[SOURCE]")
#
# # TODO: Initialize `resource`:
# resource = ''
#
# # TODO: Initialize `permissions`:
# permissions = []
# response = security_center_client.test_iam_permissions(formatted_resource, permissions)
# response = security_center_client.test_iam_permissions(resource, permissions)

def test_iam_permissions \
resource,
Expand Down
Expand Up @@ -13,9 +13,9 @@
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 480000,
"initial_rpc_timeout_millis": 20000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 480000,
"max_rpc_timeout_millis": 20000,
"total_timeout_millis": 600000
}
},
Expand All @@ -32,7 +32,7 @@
},
"GetIamPolicy": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"GetOrganizationSettings": {
Expand All @@ -47,12 +47,12 @@
},
"GroupAssets": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"GroupFindings": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"ListAssets": {
Expand Down Expand Up @@ -87,7 +87,7 @@
},
"TestIamPermissions": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"UpdateFinding": {
Expand Down

0 comments on commit b55ced5

Please sign in to comment.