Class: Import::ValidateRemoteGitEndpointService
- Inherits:
- 
      Object
      
        - Object
- Import::ValidateRemoteGitEndpointService
 
- Defined in:
- app/services/import/validate_remote_git_endpoint_service.rb
Instance Attribute Summary collapse
- 
  
    
      #password  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute password. 
- 
  
    
      #uri  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute uri. 
- 
  
    
      #user  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute user. 
Instance Method Summary collapse
- #execute ⇒ Object
- 
  
    
      #initialize(params)  ⇒ ValidateRemoteGitEndpointService 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of ValidateRemoteGitEndpointService. 
Constructor Details
#initialize(params) ⇒ ValidateRemoteGitEndpointService
| 7 8 9 10 11 12 | # File 'app/services/import/validate_remote_git_endpoint_service.rb', line 7 def initialize(params) @params = params @uri = Gitlab::Utils.parse_url(@params[:url]) @user = @params[:user].presence @password = @params[:password].presence end | 
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
| 5 6 7 | # File 'app/services/import/validate_remote_git_endpoint_service.rb', line 5 def password @password end | 
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
| 5 6 7 | # File 'app/services/import/validate_remote_git_endpoint_service.rb', line 5 def uri @uri end | 
#user ⇒ Object (readonly)
Returns the value of attribute user.
| 5 6 7 | # File 'app/services/import/validate_remote_git_endpoint_service.rb', line 5 def user @user end | 
Instance Method Details
#execute ⇒ Object
| 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # File 'app/services/import/validate_remote_git_endpoint_service.rb', line 14 def execute if uri && uri.hostname && Project::VALID_IMPORT_PROTOCOLS.include?(uri.scheme) ensure_auth_credentials! return ServiceResponse.success if Gitlab::GitalyClient::RemoteService.exists?(uri.to_s) # rubocop: disable CodeReuse/ActiveRecord -- false positive end failure_response rescue GRPC::BadStatus # There are a several subclasses of GRPC::BadStatus, but in our case the # scenario we're interested in the presence of a valid, accessible # repository, so this treats them all as equivalent. failure_response end |