Class: Fastlane::Actions::OvoAzureUploadBlobAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/ovo_azure/actions/ovo_azure_upload_blob_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



40
41
42
# File 'lib/fastlane/plugin/ovo_azure/actions/ovo_azure_upload_blob_action.rb', line 40

def self.authors
  ["Christian Borsato"]
end

.available_optionsObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/fastlane/plugin/ovo_azure/actions/ovo_azure_upload_blob_action.rb', line 52

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :account,
      env_name: "AZURE_ACCOUNT_NAME",
      description: "The name of the Azure account where the container is hosted",
      optional: false,
      is_string: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :container,
      env_name: "AZURE_CONTAINER_NAME",
      description: "The name of the Azure container where the file will be stored",
      optional: false,
      is_string: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :sas_token,
      env_name: "AZURE_SAS_TOKEN",
      description: "The Shared Access Signature (SAS) token that grants secure access to the Azure container",
      optional: false,
      is_string: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :blob_path,
      description: "The relative path where the blob file is located, including the file name (e.g., '/test/ios/test.json')",
      optional: false,
      is_string: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :blob_content,
      description: "The content to be written to the blob. This is the actual data that will be uploaded and stored in the specified Azure container",
      optional: false,
      is_string: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :overwrite_blob,
      description: "Optional. Determines whether to overwrite the blob if it already exists. Set to true to allow overwriting, or false to skip creation if the blob is already present. Default is false",
      optional: true,
      type: Boolean,
      default_value: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :blob_cache_control,
      description: "Optional. Sets the Cache-Control header for the blob upload request. This defines caching behavior for the blob, such as how long it can be cached by clients and proxies (e.g., max-age=61)",
      optional: true,
      is_string: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :blob_content_type,
      description: "Optional. Sets the Content-Type header for the blob upload request, indicating the MIME type of the file (e.g., application/json, image/png, etc.)",
      optional: true,
      is_string: true
    )
  ]
end

.categoryObject



113
114
115
# File 'lib/fastlane/plugin/ovo_azure/actions/ovo_azure_upload_blob_action.rb', line 113

def self.category
  :misc
end

.descriptionObject



36
37
38
# File 'lib/fastlane/plugin/ovo_azure/actions/ovo_azure_upload_blob_action.rb', line 36

def self.description
  "An action to check the existence of a blob in an Azure container."
end

.detailsObject



48
49
50
# File 'lib/fastlane/plugin/ovo_azure/actions/ovo_azure_upload_blob_action.rb', line 48

def self.details
  "This action allows you to check whether a specific blob exists within a specified Azure container. It is useful for ensuring that a blob is present before performing further actions, such as uploading or processing files, without needing to manually verify its existence."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/fastlane/plugin/ovo_azure/actions/ovo_azure_upload_blob_action.rb', line 109

def self.is_supported?(platform)
  true
end

.return_valueObject



44
45
46
# File 'lib/fastlane/plugin/ovo_azure/actions/ovo_azure_upload_blob_action.rb', line 44

def self.return_value
  "This action returns a boolean value: true if the blob exists in the specified Azure container, and false if it does not exist. If there is an error during the check (e.g., issues with authentication or container access), it returns nil."
end

.run(params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fastlane/plugin/ovo_azure/actions/ovo_azure_upload_blob_action.rb', line 6

def self.run(params)
  overwrite = params[:overwrite_blob]

  if overwrite == false
    blob_exists = Helper::OvoAzureHelper.is_blob_exists(
      account: params[:account],
      container: params[:container],
      sas_token: params[:sas_token],
      blob_path: params[:blob_path]
    )

    case blob_exists
    when true
      return false
    when nil
      return nil
    end
  end

  Helper::OvoAzureHelper.upload_blob(
    account: params[:account],
    container: params[:container],
    sas_token: params[:sas_token],
    blob_path: params[:blob_path],
    blob_content: params[:blob_content],
    blob_cache_control: params[:blob_cache_control],
    blob_content_type: params[:blob_content_type]
  )
end