Skip to content
Snippets Groups Projects
Verified Commit 4cb0eeed authored by Dzmitry (Dima) Meshcharakou's avatar Dzmitry (Dima) Meshcharakou
Browse files

Rename the namespace GoogleCloudPlatform to GoogleCloud

parent 6fe7c627
No related branches found
No related tags found
1 merge request!147798Rename the namespace GoogleCloudPlatform to GoogleCloud
Showing
with 81 additions and 88 deletions
......@@ -27,13 +27,13 @@ export default {
<template>
<gl-empty-state
:svg-path="$options.EmptyAdminAppsSvg"
:title="s__('GoogleCloudPlatformService|Connect to Google Cloud')"
:title="s__('GoogleCloud|Connect to Google Cloud')"
>
<template #description>
<gl-sprintf
:message="
s__(
'GoogleCloudPlatformService|Connect to Google Cloud with workload identity federation. Select %{strongStart}Guided setup%{strongEnd} if you can manage workload identity federation in Google Cloud. %{linkStart}What are the required permissions?%{linkEnd}',
'GoogleCloud|Connect to Google Cloud with workload identity federation. Select %{strongStart}Guided setup%{strongEnd} if you can manage workload identity federation in Google Cloud. %{linkStart}What are the required permissions?%{linkEnd}',
)
"
>
......@@ -54,13 +54,13 @@ export default {
<template #actions>
<div class="gl-display-flex gl-gap-3">
<gl-button variant="confirm" @click="show($options.STATE_GUIDED)">{{
s__('GoogleCloudPlatformService|Guided setup')
s__('GoogleCloud|Guided setup')
}}</gl-button>
<gl-button @click="show($options.STATE_MANUAL)">{{
s__('GoogleCloudPlatformService|Manual setup')
s__('GoogleCloud|Manual setup')
}}</gl-button>
<invite-members-trigger
:display-text="s__('GoogleCloudPlatformService|Invite member to set up')"
:display-text="s__('GoogleCloud|Invite member to set up')"
trigger-source="google_cloud_artifact_registry_setup"
/>
</div>
......
......@@ -33,12 +33,12 @@ export default {
<div>
<connection />
<h4 class="gl-mt-0">{{ s__('GoogleCloudPlatformService|Google Cloud project') }}</h4>
<h4 class="gl-mt-0">{{ s__('GoogleCloud|Google Cloud project') }}</h4>
<p>
<gl-sprintf
:message="
s__(
'GoogleCloudPlatformService|Identify the Google Cloud project with the workload identity pool and provider. %{linkStart}Where are my project ID and project number?%{linkEnd}',
'GoogleCloud|Identify the Google Cloud project with the workload identity pool and provider. %{linkStart}Where are my project ID and project number?%{linkEnd}',
)
"
>
......@@ -59,11 +59,11 @@ export default {
class="gl-border-b gl-mb-6 gl-sm-display-flex gl-flex-direction-row gl-gap-5"
/>
<h4 class="gl-mt-0">{{ s__('GoogleCloudPlatformService|Workload identity federation') }}</h4>
<h4 class="gl-mt-0">{{ s__('GoogleCloud|Workload identity federation') }}</h4>
<p>
{{
s__(
'GoogleCloudPlatformService|Connect to Google Cloud with workload identity federation for secure access without accounts or keys.',
'GoogleCloud|Connect to Google Cloud with workload identity federation for secure access without accounts or keys.',
)
}}
</p>
......
......@@ -34,12 +34,12 @@ curl --request GET \\
<template>
<div>
<h3>{{ s__('GoogleCloudPlatformService|Guided setup') }}</h3>
<h3>{{ s__('GoogleCloud|Guided setup') }}</h3>
<p>
<gl-sprintf
:message="
s__(
'GoogleCloudPlatformService|%{linkStart}Switch to the manual setup%{linkEnd} if you cannot manage workload identity federation in Google Cloud. %{link2Start}What are the required permissions?%{link2End}',
'GoogleCloud|%{linkStart}Switch to the manual setup%{linkEnd} if you cannot manage workload identity federation in Google Cloud. %{link2Start}What are the required permissions?%{link2End}',
)
"
>
......@@ -59,13 +59,11 @@ curl --request GET \\
</gl-sprintf>
</p>
<h4>{{ s__('GoogleCloudPlatformService|Instructions') }}</h4>
<h4>{{ s__('GoogleCloud|Instructions') }}</h4>
<p>
<gl-sprintf
:message="
s__(
'GoogleCloudPlatformService|Before you begin, %{linkStart}install the Google Cloud CLI%{linkEnd}.',
)
s__('GoogleCloud|Before you begin, %{linkStart}install the Google Cloud CLI%{linkEnd}.')
"
>
<template #link="{ content }">
......@@ -82,7 +80,7 @@ curl --request GET \\
<p>
{{
s__(
'GoogleCloudPlatformService|Run the following command to set up and connect to your Google Cloud project with workload identity federation.',
'GoogleCloud|Run the following command to set up and connect to your Google Cloud project with workload identity federation.',
)
}}
</p>
......@@ -91,7 +89,7 @@ curl --request GET \\
<gl-sprintf
:message="
s__(
'GoogleCloudPlatformService|Replace %{codeStart}your_access_token%{codeEnd} with a %{linkStart}new personal access token%{linkEnd} with the %{strongStart}api%{strongEnd} scope. This token sets up your Google Cloud IAM integration in GitLab.',
'GoogleCloud|Replace %{codeStart}your_access_token%{codeEnd} with a %{linkStart}new personal access token%{linkEnd} with the %{strongStart}api%{strongEnd} scope. This token sets up your Google Cloud IAM integration in GitLab.',
)
"
>
......@@ -112,7 +110,7 @@ curl --request GET \\
<gl-sprintf
:message="
s__(
'GoogleCloudPlatformService|Replace %{codeStart}your_google_cloud_project_id%{codeEnd} with your Google Cloud project ID. To improve security, use a dedicated project for identity management, separate from resources and CI/CD projects. %{linkStart}Where’s my project ID?%{linkEnd}',
'GoogleCloud|Replace %{codeStart}your_google_cloud_project_id%{codeEnd} with your Google Cloud project ID. To improve security, use a dedicated project for identity management, separate from resources and CI/CD projects. %{linkStart}Where’s my project ID?%{linkEnd}',
)
"
>
......@@ -129,7 +127,7 @@ curl --request GET \\
</template>
</gl-sprintf>
</li>
<li>{{ s__('GoogleCloudPlatformService|You might be prompted to sign in to Google.') }}</li>
<li>{{ s__('GoogleCloud|You might be prompted to sign in to Google.') }}</li>
</ul>
<div class="position-relative">
<code-block-highlighted
......@@ -148,7 +146,7 @@ curl --request GET \\
<gl-sprintf
:message="
s__(
'GoogleCloudPlatformService|After Google Cloud workload identity federation has been set up, select %{strongStart}Continue%{strongEnd}.',
'GoogleCloud|After Google Cloud workload identity federation has been set up, select %{strongStart}Continue%{strongEnd}.',
)
"
>
......
......@@ -16,12 +16,12 @@ export default {
<template>
<div>
<h3>{{ s__('GoogleCloudPlatformService|Manual setup') }}</h3>
<h3>{{ s__('GoogleCloud|Manual setup') }}</h3>
<p>
<gl-sprintf
:message="
s__(
'GoogleCloudPlatformService|%{linkStart}Switch to the guided setup%{linkEnd} if you can manage workload identity federation in Google Cloud. %{link2Start}What are the required permissions?%{link2End}',
'GoogleCloud|%{linkStart}Switch to the guided setup%{linkEnd} if you can manage workload identity federation in Google Cloud. %{link2Start}What are the required permissions?%{link2End}',
)
"
>
......@@ -40,13 +40,13 @@ export default {
</template>
</gl-sprintf>
</p>
<h4>{{ s__('GoogleCloudPlatformService|Instructions') }}</h4>
<h4>{{ s__('GoogleCloud|Instructions') }}</h4>
<ol>
<li>
<gl-sprintf
:message="
s__(
'GoogleCloudPlatformService|Share the following information with someone that can manage Google Cloud workload identity federation. Or %{linkStart}invite them%{linkEnd} to set up.',
'GoogleCloud|Share the following information with someone that can manage Google Cloud workload identity federation. Or %{linkStart}invite them%{linkEnd} to set up.',
)
"
>
......@@ -63,21 +63,19 @@ export default {
</li>
<ol type="a">
<li>
{{ s__('GoogleCloudPlatformService|The setup instructions page') }}
{{ s__('GoogleCloud|The setup instructions page') }}
</li>
<li>
{{ s__('GoogleCloudPlatformService|Your GitLab project ID') }}
{{ s__('GoogleCloud|Your GitLab project ID') }}
</li>
<li>
{{
s__('GoogleCloudPlatformService|Your workload identify federation (WLIF) issuer URL.')
}}
{{ s__('GoogleCloud|Your workload identify federation (WLIF) issuer URL.') }}
</li>
</ol>
<li>
{{
s__(
'GoogleCloudPlatformService|After Google Cloud workload identity federation has been set up, enter the details in the following form.',
'GoogleCloud|After Google Cloud workload identity federation has been set up, enter the details in the following form.',
)
}}
</li>
......
......@@ -7,7 +7,7 @@ class ArtifactResolver < BaseResolver
include Gitlab::Graphql::Authorize::AuthorizeResource
NO_ARTIFACT_REGISTRY_INTEGRATION_MESSAGE =
::GoogleCloudPlatform::ArtifactRegistry::GetDockerImageService::ERROR_RESPONSES[
::GoogleCloud::ArtifactRegistry::GetDockerImageService::ERROR_RESPONSES[
:no_artifact_registry_integration
].message
......@@ -48,7 +48,7 @@ def ready?(google_cloud_project_id:, location:, repository:, image:, project_pat
field: :artifact_registry_project_id,
value: google_cloud_project_id,
argument: :googleCloudProjectId,
field_title: s_('GoogleCloudPlatformService|Google Cloud project ID')
field_title: s_('GoogleCloud|Google Cloud project ID')
)
validate_on_integration(
......@@ -56,7 +56,7 @@ def ready?(google_cloud_project_id:, location:, repository:, image:, project_pat
field: :artifact_registry_location,
value: location,
argument: :location,
field_title: s_('GoogleCloudPlatformService|Repository location')
field_title: s_('GoogleCloud|Repository location')
)
validate_on_integration(
......@@ -64,7 +64,7 @@ def ready?(google_cloud_project_id:, location:, repository:, image:, project_pat
field: :artifact_registry_repository,
value: repository,
argument: :repository,
field_title: s_('GoogleCloudPlatformService|Repository name')
field_title: s_('GoogleCloud|Repository name')
)
super
......@@ -74,7 +74,7 @@ def resolve(google_cloud_project_id:, location:, repository:, image:, project_pa
name = "projects/#{google_cloud_project_id}/locations/#{location}/repositories/#{repository}/" \
"dockerImages/#{image}"
response = ::GoogleCloudPlatform::ArtifactRegistry::GetDockerImageService.new(
response = ::GoogleCloud::ArtifactRegistry::GetDockerImageService.new(
current_user: current_user,
project: find_project!(project_path),
params: {
......
......@@ -30,7 +30,7 @@ def resolve(first: nil, last: nil, before: nil, after: nil, sort: nil) # rubocop
private
def list_docker_images_service(params)
::GoogleCloudPlatform::ArtifactRegistry::ListDockerImagesService.new(
::GoogleCloud::ArtifactRegistry::ListDockerImagesService.new(
project: project,
current_user: current_user,
params: {
......
......@@ -30,20 +30,20 @@ class ArtifactRegistry < Integration
field :artifact_registry_project_id,
required: true,
section: SECTION_TYPE_CONFIGURATION,
title: -> { s_('GoogleCloudPlatformService|Google Cloud project ID') },
label_description: -> { s_('GoogleCloudPlatformService|Project with the Artifact Registry repository.') },
title: -> { s_('GoogleCloud|Google Cloud project ID') },
label_description: -> { s_('GoogleCloud|Project with the Artifact Registry repository.') },
help: -> { artifact_registry_project_id_help }
field :artifact_registry_repositories,
required: true,
section: SECTION_TYPE_CONFIGURATION,
title: -> { s_('GoogleCloudPlatformService|Repository name') },
help: -> { s_('GoogleCloudPlatformService|Repository must be Docker format and Standard mode.') }
title: -> { s_('GoogleCloud|Repository name') },
help: -> { s_('GoogleCloud|Repository must be Docker format and Standard mode.') }
field :artifact_registry_location,
required: true,
section: SECTION_TYPE_CONFIGURATION,
title: -> { s_('GoogleCloudPlatformService|Repository location') }
title: -> { s_('GoogleCloud|Repository location') }
alias_method :artifact_registry_repository, :artifact_registry_repositories
......@@ -52,7 +52,7 @@ def self.title
end
def self.description
s_('GoogleCloudPlatformService|Manage your artifacts in Google Artifact Registry.')
s_('GoogleCloud|Manage your artifacts in Google Artifact Registry.')
end
def self.to_param
......@@ -105,7 +105,7 @@ def self.artifact_registry_project_id_help
url = 'https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects'
format(
s_('GoogleCloudPlatformService|To improve security, use a dedicated project for resources, separate from ' \
s_('GoogleCloud|To improve security, use a dedicated project for resources, separate from ' \
'CI/CD and identity management projects. %{link_start}Where’s my project ID? %{icon}%{link_end}'),
link_start: format('<a target="_blank" rel="noopener noreferrer" href="%{url}">', url: url).html_safe, # rubocop:disable Rails/OutputSafety -- It is fine to call html_safe here
link_end: '</a>'.html_safe,
......@@ -114,7 +114,7 @@ def self.artifact_registry_project_id_help
end
def test(data)
response = ::GoogleCloudPlatform::ArtifactRegistry::GetRepositoryService # rubocop:disable CodeReuse/ServiceClass -- the implementation is tied to existing strategy of testing an integration
response = ::GoogleCloud::ArtifactRegistry::GetRepositoryService # rubocop:disable CodeReuse/ServiceClass -- the implementation is tied to existing strategy of testing an integration
.new(project: project, current_user: data[:current_user]).execute
{ success: response.success?, result: response.message }
......
......@@ -31,13 +31,13 @@ class WorkloadIdentityFederation < Integration
field :workload_identity_federation_project_id,
required: true,
section: SECTION_TYPE_CONFIGURATION,
title: -> { s_('GoogleCloudPlatformService|Project ID') },
title: -> { s_('GoogleCloud|Project ID') },
description: -> {
s_('GoogleCloudPlatformService|Google Cloud project ID for the Workload Identity Federation.')
s_('GoogleCloud|Google Cloud project ID for the Workload Identity Federation.')
},
help: -> {
format(
s_('GoogleCloudPlatformService|Example: %{code_open}my-sample-project-191923%{code_close}'),
s_('GoogleCloud|Example: %{code_open}my-sample-project-191923%{code_close}'),
{
code_open: '<code>',
code_close: '</code>'
......@@ -48,13 +48,13 @@ class WorkloadIdentityFederation < Integration
field :workload_identity_federation_project_number,
required: true,
section: SECTION_TYPE_CONFIGURATION,
title: -> { s_('GoogleCloudPlatformService|Project number') },
title: -> { s_('GoogleCloud|Project number') },
description: -> {
s_('GoogleCloudPlatformService|Google Cloud project number for the Workload Identity Federation.')
s_('GoogleCloud|Google Cloud project number for the Workload Identity Federation.')
},
help: -> {
format(
s_('GoogleCloudPlatformService|Example: %{code_open}314053285323%{code_close}'),
s_('GoogleCloud|Example: %{code_open}314053285323%{code_close}'),
{
code_open: '<code>',
code_close: '</code>'
......@@ -65,24 +65,21 @@ class WorkloadIdentityFederation < Integration
field :workload_identity_pool_id,
required: true,
section: SECTION_TYPE_CONFIGURATION,
title: -> { s_('GoogleCloudPlatformService|Pool ID') },
description: -> { s_('GoogleCloudPlatformService|ID of the Workload Identity Pool.') }
title: -> { s_('GoogleCloud|Pool ID') },
description: -> { s_('GoogleCloud|ID of the Workload Identity Pool.') }
field :workload_identity_pool_provider_id,
required: true,
section: SECTION_TYPE_CONFIGURATION,
title: -> { s_('GoogleCloudPlatformService|Provider ID') },
description: -> { s_('GoogleCloudPlatformService|ID of the Workload Identity Pool provider.') }
title: -> { s_('GoogleCloud|Provider ID') },
description: -> { s_('GoogleCloud|ID of the Workload Identity Pool provider.') }
def self.title
s_('GoogleCloudPlatformService|Google Cloud IAM')
s_('GoogleCloud|Google Cloud IAM')
end
def self.description
s_(
'GoogleCloudPlatformService|' \
'Manage permissions for Google Cloud resources with Identity and Access Management (IAM).'
)
s_('GoogleCloud|Manage permissions for Google Cloud resources with Identity and Access Management (IAM).')
end
def self.to_param
......@@ -102,7 +99,7 @@ def self.supported_events
end
def self.wlif_issuer_url(group_or_project)
"#{::GoogleCloudPlatform.glgo_base_url}/oidc/#{group_or_project.root_ancestor.path}"
"#{::GoogleCloud.glgo_base_url}/oidc/#{group_or_project.root_ancestor.path}"
end
# used when setting up WLIF pools
......
# frozen_string_literal: true
module GoogleCloudPlatform
module GoogleCloud
module ArtifactRegistry
class BaseProjectService < ::BaseProjectService
ERROR_RESPONSES = {
......@@ -52,7 +52,7 @@ def allowed?
end
def client
::GoogleCloudPlatform::ArtifactRegistry::Client.new(wlif_integration: wlif_integration, user: current_user)
::GoogleCloud::ArtifactRegistry::Client.new(wlif_integration: wlif_integration, user: current_user)
end
def wlif_integration
......@@ -65,10 +65,10 @@ def artifact_registry_integration
def handling_client_errors
yield
rescue ::GoogleCloudPlatform::AuthenticationError => e
rescue ::GoogleCloud::AuthenticationError => e
log_error_with_project_id(message: e.message)
ERROR_RESPONSES[:authentication_error]
rescue ::GoogleCloudPlatform::ApiError => e
rescue ::GoogleCloud::ApiError => e
log_error_with_project_id(message: e.message)
ERROR_RESPONSES[:api_error]
end
......
# frozen_string_literal: true
module GoogleCloudPlatform
module GoogleCloud
module ArtifactRegistry
class GetDockerImageService < ::GoogleCloudPlatform::ArtifactRegistry::BaseProjectService
class GetDockerImageService < ::GoogleCloud::ArtifactRegistry::BaseProjectService
NO_NAME_ERROR_RESPONSE = ServiceResponse.error(message: 'Name parameter is blank')
private
......
# frozen_string_literal: true
module GoogleCloudPlatform
module GoogleCloud
module ArtifactRegistry
class GetRepositoryService < ::GoogleCloudPlatform::ArtifactRegistry::BaseProjectService
class GetRepositoryService < ::GoogleCloud::ArtifactRegistry::BaseProjectService
private
def call_client
......
# frozen_string_literal: true
module GoogleCloudPlatform
module GoogleCloud
module ArtifactRegistry
class ListDockerImagesService < ::GoogleCloudPlatform::ArtifactRegistry::BaseProjectService
class ListDockerImagesService < ::GoogleCloud::ArtifactRegistry::BaseProjectService
VALID_ORDER_BY_COLUMNS = %w[name image_size_bytes upload_time build_time update_time media_type].freeze
VALID_ORDER_BY_DIRECTIONS = %w[asc desc].freeze
......
# frozen_string_literal: true
module GoogleCloudPlatform
module GoogleCloud
module Compute
class BaseService < ::BaseContainerService
VALID_ORDER_BY_COLUMNS = %w[creationTimestamp name].freeze
......@@ -69,7 +69,7 @@ def valid_order_by?(value)
end
def client
::GoogleCloudPlatform::Compute::Client.new(
::GoogleCloud::Compute::Client.new(
wlif_integration: wlif_integration,
user: current_user,
params: params.slice(:google_cloud_project_id).compact
......@@ -99,10 +99,10 @@ def page_token
def handling_client_errors
yield
rescue ::GoogleCloudPlatform::AuthenticationError => e
rescue ::GoogleCloud::AuthenticationError => e
log_error_with_container_id(message: e.message)
ERROR_RESPONSES[:google_cloud_authentication_error]
rescue ::GoogleCloudPlatform::ApiError => e
rescue ::GoogleCloud::ApiError => e
log_error_with_container_id(message: e.message)
ServiceResponse.error(message: "#{GCP_API_ERROR_MESSAGE}: #{e.message}")
end
......
# frozen_string_literal: true
module GoogleCloudPlatform
module GoogleCloud
module Compute
class ListMachineTypesService < ::GoogleCloudPlatform::Compute::BaseService
class ListMachineTypesService < ::GoogleCloud::Compute::BaseService
MISSING_ZONE_ERROR_RESPONSE = ServiceResponse.error(message: 'Zone value must be provided').freeze
def initialize(container:, current_user:, zone:, params: {})
......
# frozen_string_literal: true
module GoogleCloudPlatform
module GoogleCloud
module Compute
class ListRegionsService < ::GoogleCloudPlatform::Compute::BaseService
class ListRegionsService < ::GoogleCloud::Compute::BaseService
private
def call_client
......
# frozen_string_literal: true
module GoogleCloudPlatform
module GoogleCloud
module Compute
class ListZonesService < ::GoogleCloudPlatform::Compute::BaseService
class ListZonesService < ::GoogleCloud::Compute::BaseService
private
def call_client
......
.info-well
.well-segment
%p.gl-font-weight-bold
= s_('GoogleCloudPlatformService|Manage permissions for Google Cloud resources with Identity and Access Management (IAM). Simplify and secure your usage, without the need to manage accounts or keys.')
= s_('GoogleCloud|Manage permissions for Google Cloud resources with Identity and Access Management (IAM). Simplify and secure your usage, without the need to manage accounts or keys.')
%p
- tag_pair_docs = tag_pair(link_to('', help_page_path('ci/gitlab_google_cloud_integration/index'), target: '_blank', rel: 'noopener noreferrer'), :link_start, :link_end)
= safe_format(s_('GoogleCloudPlatformService|%{link_start}Explore Google Cloud integration with GitLab%{link_end}, for CI/CD and more.'), tag_pair_docs)
= safe_format(s_('GoogleCloud|%{link_start}Explore Google Cloud integration with GitLab%{link_end}, for CI/CD and more.'), tag_pair_docs)
......@@ -4,7 +4,7 @@ module AuditEvents
module Strategies
class BaseGoogleCloudLoggingDestinationStrategy < ExternalDestinationStrategy
def initialize(audit_operation, audit_event)
@logger = GoogleCloud::LoggingService::Logger.new
@logger = AuditEvents::GoogleCloud::LoggingService::Logger.new
super(audit_operation, audit_event)
end
......
......@@ -20,7 +20,7 @@ def validate_job_identity!(name, job)
return if job[:identity].blank?
unless google_cloud_support_saas_feature?
error!("#{name} job: #{s_('GoogleCloudPlatformService|The google_cloud_support feature is not available')}")
error!("#{name} job: #{s_('GoogleCloud|The google_cloud_support feature is not available')}")
end
unless google_cloud_support_feature_flag?
......@@ -30,13 +30,13 @@ def validate_job_identity!(name, job)
integration = project.google_cloud_platform_workload_identity_federation_integration
if integration.nil?
error!("#{name} job: #{s_('GoogleCloudPlatformService|The Google Cloud Identity and Access Management ' \
error!("#{name} job: #{s_('GoogleCloud|The Google Cloud Identity and Access Management ' \
'integration is not configured for this project')}")
end
return if integration.active?
error!("#{name} job: #{s_('GoogleCloudPlatformService|The Google Cloud Identity and Access Management ' \
error!("#{name} job: #{s_('GoogleCloud|The Google Cloud Identity and Access Management ' \
'integration is not enabled for this project')}")
end
......
......@@ -13,7 +13,7 @@ def initialize(build)
def execute
return [] unless @integration&.active
config_json = ::GoogleCloudPlatform.credentials(
config_json = ::GoogleCloud.credentials(
identity_provider_resource_name: @integration.identity_provider_resource_name,
encoded_jwt: encoded_jwt
).to_json
......@@ -30,7 +30,7 @@ def execute
def encoded_jwt
JwtV2.for_build(
@build,
aud: ::GoogleCloudPlatform::GLGO_BASE_URL,
aud: ::GoogleCloud::GLGO_BASE_URL,
target_audience: @integration.identity_provider_resource_name
)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment