Class: Types::ContainerRegistry::ContainerRepositoryType

Inherits:
BaseObject
  • Object
show all
Includes:
Gitlab::Graphql::Authorize::AuthorizeResource
Defined in:
app/graphql/types/container_registry/container_repository_type.rb

Direct Known Subclasses

ContainerRepositoryDetailsType

Constant Summary

Constants included from Gitlab::Graphql::Authorize::AuthorizeResource

Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR

Instance Method Summary collapse

Methods included from Gitlab::Graphql::Authorize::AuthorizeResource

#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!

Methods inherited from BaseObject

accepts, assignable?, authorization, authorization_scopes, authorize, authorized?, #current_user, #id

Methods included from Gitlab::Graphql::Present

#present, #unpresented

Instance Method Details

#migration_stateObject

The migration has now completed and we are cleaning up the migration db columns. For backward compatibility, we are keeping this field accessible. This field will be removed in 18.0.



67
68
69
# File 'app/graphql/types/container_registry/container_repository_type.rb', line 67

def migration_state
  ''
end

#projectObject



51
52
53
# File 'app/graphql/types/container_registry/container_repository_type.rb', line 51

def project
  Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, object.project_id).find
end

#protection_rule_existsObject



71
72
73
74
75
76
77
78
79
# File 'app/graphql/types/container_registry/container_repository_type.rb', line 71

def protection_rule_exists
  return false if Feature.disabled?(:container_registry_protected_containers, object.project.root_ancestor)

  BatchLoader::GraphQL.for(object.path).batch do |repository_paths, loader|
    ::ContainerRegistry::Protection::Rule
      .for_push_exists_for_multiple_containers(repository_paths: repository_paths, project_id: object.project_id)
      .each { |row| loader.call(row['repository_path'], row['protected']) }
  end
end

#tags_countObject



55
56
57
58
59
60
61
62
# File 'app/graphql/types/container_registry/container_repository_type.rb', line 55

def tags_count
  object.tags_count
rescue Faraday::Error
  raise_resource_not_available_error!(
    'We are having trouble connecting to the Container Registry. ' \
      'If this error persists, please review the troubleshooting documentation.'
  )
end