Documentation ¶
Index ¶
- Variables
- func Authenticate() (string, error)
- func BuildOutputPathForReportType(fObj FileObject, filePrefix, outputFolder, format string) []string
- func BuildQueryForAssetUsingCreated(fQuery FileQuery) ([]byte, error)
- func BuildQueryForAssetUsingPeriod(fQuery FileQuery) ([]byte, error)
- func CreateUUID() string
- func DaysBetween(startDate, endDate string) (float64, error)
- func DownloadFile(fileReference, fileURL, token, subscriptionKey, format string) ([]byte, error)
- func DownloadFiles(files []FileObject, ...) []error
- func DownloadFilesToZip(fileReferences []FileObject, fileURL, token, subscriptionKey, format string) ([]byte, error)
- func FileOrFolderExists(path string) bool
- func GenerateFileName(fObj FileObject, filePrefix, format string) string
- func MapReportType(reportType int) string
- func ProcessAndRunDownload(downloadConfig CloudDownload) []error
- func RunQueryAndDownloadFiles(fQuery FileQuery, token, subscriptionKey, graphQLUrl, fileDownloadUrl string) error
- func SafeEncodeNameForWinFiles(name string) string
- func StringRFC3339ToTime(timeStamp string) (time.Time, error)
- func TimeToStr(timeObj time.Time, format string) string
- func VerifyCloudDownloadConfig(downloadConfig CloudDownload) error
- type AuthConfig
- type CloudCommonConfig
- type CloudConfig
- type CloudDDRMLConfig
- type CloudDownload
- type CloudProductionConfig
- type DataErrors
- type DataObject
- type DataSource
- type FileGraphResult
- type FileMetaData
- type FileObject
- type FileQuery
- type FileQueryConfig
- type GraphQuery
Constants ¶
This section is empty.
Variables ¶
var AzureClientIdEnvName = "AzureClientId"
globals pointing to enviroinment variables to look for
var AzureClientSecretEnvName = "AzureClientSecret"
var AzureFileDownloadUrlEnvName = "AzureFileDownloadUrl"
var AzureGraphUrlEnvName = "AzureGraphUrl"
var AzureResourceIdEnvName = "AzureResourceId"
var AzureSubscriptionKeyEnvName = "AzureSubscriptionKey"
var AzureTokenUrlEnvName = "AzureTokenUrl"
var MaxNumberOfDaysPeriod = 91.0 //controls the number of days that can be queried for using the period functionality
var MaxRollDays = 30 //control the max number of days that you can roll back in the download setup
Functions ¶
func Authenticate ¶
func BuildOutputPathForReportType ¶
func BuildOutputPathForReportType(fObj FileObject, filePrefix, outputFolder, format string) []string
BuildOutputPathForReportType will build the output folder path based on the report type DDRML data will be stored in outputFolder + name of wellbore and then the actual file the function will return an array of paths based on the source objects as especially ddrml files can contain several wellbores
func BuildQueryForAssetUsingCreated ¶
BuildQueryForAssetUsingCreated builds a qraphql query for file using created to/from date if the report type is either ddrml or dpr20 and the format is pdf it will ask for xml files instead as the minio storage just stores xml files for these report types and the pdf report is generated on the fly.
func BuildQueryForAssetUsingPeriod ¶
BuildQueryForAssetUsingPeriod builds a qraphql query for file using period to/from date if the report type is either ddrml or dpr20 and the format is pdf it will ask for xml files instead as the minio storage just stores xml files for these report types and the pdf report is generated on the fly.
func CreateUUID ¶
func CreateUUID() string
func DaysBetween ¶
DaysBetween will check the numder of days between startdate and enddate where the dates are in the format YYYY-MM-DD e.g. 2019-03-28
func DownloadFile ¶
DownloadFile downloads a single file using the given fileReference id, fileURL for Azure, token from oauth2, subscription key for service and format to download (pdf or xml)
func DownloadFiles ¶
func DownloadFiles(files []FileObject, fileURL, token, subscriptionKey, format, outputFolder, filePrefix string, addTimeStampInName bool) []error
DownloadFiles downloads a set of files from a array of fileobjects, it will call download file function for each entry and dowload the data to the outputfolder, will return an array of possible errors assetName will be used to prefix the files addTimeStampInName will add a unix timestamp to the outputfile name identifying when the file was downloaded
func DownloadFilesToZip ¶
func DownloadFilesToZip(fileReferences []FileObject, fileURL, token, subscriptionKey, format string) ([]byte, error)
DownloadFilesToZip downloads a set of files using the given array of fileReference id fileURL -> to download for from Azure: token -> recieved from oauth2 subscription key -> to use API service format -> the format to download (pdf or xml)
func FileOrFolderExists ¶
func GenerateFileName ¶
func GenerateFileName(fObj FileObject, filePrefix, format string) string
GenerateFileName builds a filename based on the incoming criteria
func MapReportType ¶
func ProcessAndRunDownload ¶
func ProcessAndRunDownload(downloadConfig CloudDownload) []error
ProcessAndRunDownload will process and query for a set of files as defined in the download config any errors will be tracked on a file basis and returned
func RunQueryAndDownloadFiles ¶
func RunQueryAndDownloadFiles(fQuery FileQuery, token, subscriptionKey, graphQLUrl, fileDownloadUrl string) error
RunQueryAndDownloadFiles will take an filequery object and run a graphql query for the specified files and using the file result it will try to download each file locally using the filedownloadurl and the file reference
func StringRFC3339ToTime ¶
StringRFC3339ToTime will take a RFC3339 formatted string, e.g. 2005-01-05T21:59:59.999Z and convert it to a time object
func VerifyCloudDownloadConfig ¶
func VerifyCloudDownloadConfig(downloadConfig CloudDownload) error
VerifyCloudDownloadConfig will check the configuration data for errors
Types ¶
type AuthConfig ¶
type CloudCommonConfig ¶
type CloudConfig ¶
type CloudDDRMLConfig ¶
type CloudDownload ¶
type CloudDownload struct { XMLName xml.Name `xml:"subsurface"` CloudConfig CloudConfig `xml:"config"` DPRS []CloudProductionConfig `xml:"dpr"` MPRGovs []CloudProductionConfig `xml:"mprmlGov"` MPRPartners []CloudProductionConfig `xml:"mprmlPartner"` DDRMLS []CloudDDRMLConfig `xml:"ddrml"` }
func CloudConfigArrayToStruct ¶
func CloudConfigArrayToStruct(data []byte) (CloudDownload, error)
type CloudProductionConfig ¶
type DataErrors ¶
type DataErrors struct {
Message string `json:"message"`
}
type DataObject ¶
type DataObject struct { Files []FileObject `json:"files"` Errors []DataErrors `json:"errors"` }
func RunGraphQueryForFiles ¶
func RunGraphQueryForFiles(token, url, subscriptionKey string, query []byte) (DataObject, interface{}, error)
type DataSource ¶
type FileGraphResult ¶
type FileGraphResult struct {
Data DataObject `json:"data"`
}
type FileMetaData ¶
type FileObject ¶
type FileObject struct { FileName string `json:"fileName"` FileReference string `json:"fileReferenceId"` Created string `json:"created"` MetaData FileMetaData `json:"metadata"` ReportType int `json:"reportType"` Sources []DataSource `json:"sources"` }
type FileQueryConfig ¶
type FileQueryConfig struct { AuthCnfg AuthConfig GraphURL string FileDownloadUrl string Queries []FileQuery }