Class: Serverspec::Type::JenkinsCredential
- Inherits:
-
JenkinsBase
- Object
- Base
- ApiBase
- JenkinsBase
- Serverspec::Type::JenkinsCredential
- Defined in:
- lib/serverspec_extra_types/types/jenkins_credential.rb
Instance Method Summary collapse
- #aws_credential? ⇒ Boolean
- #gitlab_api_token? ⇒ Boolean
- #has_description?(desc) ⇒ Boolean
- #has_display_name?(text) ⇒ Boolean
-
#initialize(name = nil, options = {}) ⇒ JenkinsCredential
constructor
A new instance of JenkinsCredential.
- #inspection ⇒ Object
- #length ⇒ Object
- #secret_text? ⇒ Boolean
- #ssh_private_key? ⇒ Boolean
- #url ⇒ Object
- #username_with_password? ⇒ Boolean
Methods inherited from JenkinsBase
Methods inherited from ApiBase
Constructor Details
#initialize(name = nil, options = {}) ⇒ JenkinsCredential
Returns a new instance of JenkinsCredential.
11 12 13 |
# File 'lib/serverspec_extra_types/types/jenkins_credential.rb', line 11 def initialize(name = nil, = {}) super(name, ) end |
Instance Method Details
#aws_credential? ⇒ Boolean
41 42 43 |
# File 'lib/serverspec_extra_types/types/jenkins_credential.rb', line 41 def aws_credential? inspection['typeName'] == 'AWS Credentials' end |
#gitlab_api_token? ⇒ Boolean
37 38 39 |
# File 'lib/serverspec_extra_types/types/jenkins_credential.rb', line 37 def gitlab_api_token? inspection['typeName'] == 'GitLab API token' end |
#has_description?(desc) ⇒ Boolean
53 54 55 |
# File 'lib/serverspec_extra_types/types/jenkins_credential.rb', line 53 def has_description?(desc) inspection['description'] == desc end |
#has_display_name?(text) ⇒ Boolean
57 58 59 |
# File 'lib/serverspec_extra_types/types/jenkins_credential.rb', line 57 def has_display_name?(text) inspection['displayName'] == text end |
#inspection ⇒ Object
15 16 17 |
# File 'lib/serverspec_extra_types/types/jenkins_credential.rb', line 15 def inspection @inspection ||= ::MultiJson.load(get_inspection.stdout) end |
#length ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/serverspec_extra_types/types/jenkins_credential.rb', line 23 def length if inspection.is_a? String inspection.length elsif inspection.is_a? Array inspection.length else 1 end end |
#secret_text? ⇒ Boolean
49 50 51 |
# File 'lib/serverspec_extra_types/types/jenkins_credential.rb', line 49 def secret_text? inspection['typeName'] == 'Secret text' end |
#ssh_private_key? ⇒ Boolean
33 34 35 |
# File 'lib/serverspec_extra_types/types/jenkins_credential.rb', line 33 def ssh_private_key? inspection['typeName'] == 'SSH Username with private key' end |
#url ⇒ Object
19 20 21 |
# File 'lib/serverspec_extra_types/types/jenkins_credential.rb', line 19 def url "#{@url_base}/credentials/store/system/domain/_/credential/#{@name}/api/json" end |
#username_with_password? ⇒ Boolean
45 46 47 |
# File 'lib/serverspec_extra_types/types/jenkins_credential.rb', line 45 def username_with_password? inspection['typeName'] == 'Username with password' end |