@sasjs/core 4.9.3 → 4.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base/mp_streamfile.sas +39 -7
- package/meta/mm_getauthinfo.sas +51 -48
- package/package.json +1 -1
- package/viya/mv_registerclient.sas +64 -48
package/base/mp_streamfile.sas
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
<h4> SAS Macros </h4>
|
|
24
24
|
@li mf_getplatform.sas
|
|
25
|
+
@li mfs_httpheader.sas
|
|
25
26
|
@li mp_binarycopy.sas
|
|
26
27
|
|
|
27
28
|
@author Allan Bowe
|
|
@@ -55,7 +56,7 @@ data _null_;
|
|
|
55
56
|
run;
|
|
56
57
|
|
|
57
58
|
%if &contentype=CSV %then %do;
|
|
58
|
-
%if (&platform=SASMETA and &streamweb=1)
|
|
59
|
+
%if (&platform=SASMETA and &streamweb=1) %then %do;
|
|
59
60
|
data _null_;
|
|
60
61
|
rc=stpsrv_header('Content-type','application/csv');
|
|
61
62
|
rc=stpsrv_header('Content-disposition',"attachment; filename=&outname");
|
|
@@ -66,10 +67,14 @@ run;
|
|
|
66
67
|
contenttype='application/csv'
|
|
67
68
|
contentdisp="attachment; filename=&outname";
|
|
68
69
|
%end;
|
|
70
|
+
%else %if &platform=SASJS %then %do;
|
|
71
|
+
%mfs_httpheader(Content-type,application/csv)
|
|
72
|
+
%mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
|
|
73
|
+
%end;
|
|
69
74
|
%end;
|
|
70
75
|
%else %if &contentype=EXCEL %then %do;
|
|
71
76
|
/* suitable for XLS format */
|
|
72
|
-
%if (&platform=SASMETA and &streamweb=1)
|
|
77
|
+
%if (&platform=SASMETA and &streamweb=1) %then %do;
|
|
73
78
|
data _null_;
|
|
74
79
|
rc=stpsrv_header('Content-type','application/vnd.ms-excel');
|
|
75
80
|
rc=stpsrv_header('Content-disposition',"attachment; filename=&outname");
|
|
@@ -80,9 +85,13 @@ run;
|
|
|
80
85
|
contenttype='application/vnd.ms-excel'
|
|
81
86
|
contentdisp="attachment; filename=&outname";
|
|
82
87
|
%end;
|
|
88
|
+
%else %if &platform=SASJS %then %do;
|
|
89
|
+
%mfs_httpheader(Content-type,application/vnd.ms-excel)
|
|
90
|
+
%mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
|
|
91
|
+
%end;
|
|
83
92
|
%end;
|
|
84
93
|
%else %if &contentype=GIF or &contentype=JPEG or &contentype=PNG %then %do;
|
|
85
|
-
%if (&platform=SASMETA and &streamweb=1)
|
|
94
|
+
%if (&platform=SASMETA and &streamweb=1) %then %do;
|
|
86
95
|
data _null_;
|
|
87
96
|
rc=stpsrv_header('Content-type',"image/%lowcase(&contenttype)");
|
|
88
97
|
run;
|
|
@@ -91,15 +100,21 @@ run;
|
|
|
91
100
|
filename &outref filesrvc parenturi="&SYS_JES_JOB_URI"
|
|
92
101
|
contenttype="image/%lowcase(&contenttype)";
|
|
93
102
|
%end;
|
|
103
|
+
%else %if &platform=SASJS %then %do;
|
|
104
|
+
%mfs_httpheader(Content-type,image/%lowcase(&contenttype))
|
|
105
|
+
%end;
|
|
94
106
|
%end;
|
|
95
107
|
%else %if &contentype=HTML %then %do;
|
|
96
108
|
%if &platform=SASVIYA %then %do;
|
|
97
109
|
filename &outref filesrvc parenturi="&SYS_JES_JOB_URI" name="_webout.json"
|
|
98
110
|
contenttype="text/html";
|
|
99
111
|
%end;
|
|
112
|
+
%else %if &platform=SASJS %then %do;
|
|
113
|
+
%mfs_httpheader(Content-type,text/html)
|
|
114
|
+
%end;
|
|
100
115
|
%end;
|
|
101
116
|
%else %if &contentype=TEXT %then %do;
|
|
102
|
-
%if (&platform=SASMETA and &streamweb=1)
|
|
117
|
+
%if (&platform=SASMETA and &streamweb=1) %then %do;
|
|
103
118
|
data _null_;
|
|
104
119
|
rc=stpsrv_header('Content-type','application/text');
|
|
105
120
|
rc=stpsrv_header('Content-disposition',"attachment; filename=&outname");
|
|
@@ -110,9 +125,13 @@ run;
|
|
|
110
125
|
contenttype='application/text'
|
|
111
126
|
contentdisp="attachment; filename=&outname";
|
|
112
127
|
%end;
|
|
128
|
+
%else %if &platform=SASJS %then %do;
|
|
129
|
+
%mfs_httpheader(Content-type,application/text)
|
|
130
|
+
%mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
|
|
131
|
+
%end;
|
|
113
132
|
%end;
|
|
114
133
|
%else %if &contentype=WOFF or &contentype=WOFF2 or &contentype=TTF %then %do;
|
|
115
|
-
%if (&platform=SASMETA and &streamweb=1)
|
|
134
|
+
%if (&platform=SASMETA and &streamweb=1) %then %do;
|
|
116
135
|
data _null_;
|
|
117
136
|
rc=stpsrv_header('Content-type',"font/%lowcase(&contenttype)");
|
|
118
137
|
run;
|
|
@@ -121,9 +140,12 @@ run;
|
|
|
121
140
|
filename &outref filesrvc parenturi="&SYS_JES_JOB_URI"
|
|
122
141
|
contenttype="font/%lowcase(&contenttype)";
|
|
123
142
|
%end;
|
|
143
|
+
%else %if &platform=SASJS %then %do;
|
|
144
|
+
%mfs_httpheader(Content-type,font/%lowcase(&contenttype))
|
|
145
|
+
%end;
|
|
124
146
|
%end;
|
|
125
147
|
%else %if &contentype=XLSX %then %do;
|
|
126
|
-
%if (&platform=SASMETA and &streamweb=1)
|
|
148
|
+
%if (&platform=SASMETA and &streamweb=1) %then %do;
|
|
127
149
|
data _null_;
|
|
128
150
|
rc=stpsrv_header('Content-type',
|
|
129
151
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
@@ -136,9 +158,15 @@ run;
|
|
|
136
158
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
137
159
|
contentdisp="attachment; filename=&outname";
|
|
138
160
|
%end;
|
|
161
|
+
%else %if &platform=SASJS %then %do;
|
|
162
|
+
%mfs_httpheader(Content-type
|
|
163
|
+
,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
|
164
|
+
)
|
|
165
|
+
%mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
|
|
166
|
+
%end;
|
|
139
167
|
%end;
|
|
140
168
|
%else %if &contentype=ZIP %then %do;
|
|
141
|
-
%if (&platform=SASMETA and &streamweb=1)
|
|
169
|
+
%if (&platform=SASMETA and &streamweb=1) %then %do;
|
|
142
170
|
data _null_;
|
|
143
171
|
rc=stpsrv_header('Content-type','application/zip');
|
|
144
172
|
rc=stpsrv_header('Content-disposition',"attachment; filename=&outname");
|
|
@@ -149,6 +177,10 @@ run;
|
|
|
149
177
|
contenttype='application/zip'
|
|
150
178
|
contentdisp="attachment; filename=&outname";
|
|
151
179
|
%end;
|
|
180
|
+
%else %if &platform=SASJS %then %do;
|
|
181
|
+
%mfs_httpheader(Content-type,application/zip)
|
|
182
|
+
%mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
|
|
183
|
+
%end;
|
|
152
184
|
%end;
|
|
153
185
|
%else %do;
|
|
154
186
|
%put %str(ERR)OR: Content Type &contenttype NOT SUPPORTED by &sysmacroname!;
|
package/meta/mm_getauthinfo.sas
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
@file mm_getauthinfo.sas
|
|
3
|
-
@brief
|
|
4
|
-
@details
|
|
3
|
+
@brief Extracts authentication info for each user in metadata
|
|
4
|
+
@details
|
|
5
|
+
Usage:
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
%mm_getauthinfo(outds=auths)
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
@param [in] mdebug= (0) Set to 1 to enable DEBUG messages and preserve outputs
|
|
11
|
+
@param [out] outds= (mm_getauthinfo) The output dataset to create
|
|
9
12
|
|
|
10
13
|
<h4> SAS Macros </h4>
|
|
11
|
-
@li mm_getobjects.sas
|
|
12
14
|
@li mf_getuniquefileref.sas
|
|
15
|
+
@li mf_getuniquename.sas
|
|
13
16
|
@li mm_getdetails.sas
|
|
17
|
+
@li mm_getobjects.sas
|
|
18
|
+
|
|
14
19
|
|
|
15
20
|
@version 9.4
|
|
16
21
|
@author Allan Bowe
|
|
@@ -18,67 +23,69 @@
|
|
|
18
23
|
**/
|
|
19
24
|
|
|
20
25
|
%macro mm_getauthinfo(outds=mm_getauthinfo
|
|
26
|
+
,mdebug=0
|
|
21
27
|
)/*/STORE SOURCE*/;
|
|
28
|
+
%local prefix fileref;
|
|
29
|
+
%let prefix=%substr(%mf_getuniquename(),1,25);
|
|
22
30
|
|
|
23
|
-
%
|
|
24
|
-
%put %str(ERR)OR: Temp tables are created with the &outds prefix, which
|
|
25
|
-
therefore needs to be 30 characters or less;
|
|
26
|
-
%return;
|
|
27
|
-
%end;
|
|
28
|
-
%if %index(&outds,'.')>0 %then %do;
|
|
29
|
-
%put %str(ERR)OR: Table &outds should be ONE LEVEL (no library);
|
|
30
|
-
%return;
|
|
31
|
-
%end;
|
|
32
|
-
|
|
33
|
-
%mm_getobjects(type=Login,outds=&outds.0)
|
|
31
|
+
%mm_getobjects(type=Login,outds=&prefix.0)
|
|
34
32
|
|
|
35
33
|
%local fileref;
|
|
36
34
|
%let fileref=%mf_getuniquefileref();
|
|
37
35
|
|
|
38
36
|
data _null_;
|
|
39
37
|
file &fileref;
|
|
40
|
-
set &
|
|
38
|
+
set &prefix.0 end=last;
|
|
41
39
|
/* run macro */
|
|
42
|
-
str=cats('%mm_getdetails(uri=',id,",outattrs=&
|
|
43
|
-
,",outassocs=&
|
|
40
|
+
str=cats('%mm_getdetails(uri=',id,",outattrs=&prefix.d",_n_
|
|
41
|
+
,",outassocs=&prefix.a",_n_,")");
|
|
44
42
|
put str;
|
|
45
43
|
/* transpose attributes */
|
|
46
|
-
str=cats("proc transpose data=&
|
|
44
|
+
str=cats("proc transpose data=&prefix.d",_n_,"(drop=type) out=&prefix.da"
|
|
47
45
|
,_n_,"(drop=_name_);var value;id name;run;");
|
|
48
46
|
put str;
|
|
49
47
|
/* add extra info to attributes */
|
|
50
|
-
str=cats("data &
|
|
51
|
-
,quote(trim(id)),";set &
|
|
48
|
+
str=cats("data &prefix.da",_n_,";length login_id login_name $256; login_id="
|
|
49
|
+
,quote(trim(id)),";set &prefix.da",_n_
|
|
52
50
|
,";login_name=trim(subpad(name,1,256));drop name;run;");
|
|
53
51
|
put str;
|
|
54
52
|
/* add extra info to associations */
|
|
55
|
-
str=cats("data &
|
|
53
|
+
str=cats("data &prefix.a",_n_,";length login_id login_name $256; login_id="
|
|
56
54
|
,quote(trim(id)),";login_name=",quote(trim(name))
|
|
57
|
-
,";set &
|
|
55
|
+
,";set &prefix.a",_n_,";run;");
|
|
58
56
|
put str;
|
|
59
57
|
if last then do;
|
|
60
58
|
/* collate attributes */
|
|
61
|
-
str=cats("data &
|
|
59
|
+
str=cats("data &prefix._logat; set &prefix.da1-&prefix.da",_n_,";run;");
|
|
62
60
|
put str;
|
|
63
61
|
/* collate associations */
|
|
64
|
-
str=cats("data &
|
|
62
|
+
str=cats("data &prefix._logas; set &prefix.a1-&prefix.a",_n_,";run;");
|
|
65
63
|
put str;
|
|
66
64
|
/* tidy up */
|
|
67
|
-
str=cats("proc delete data=&
|
|
65
|
+
str=cats("proc delete data=&prefix.da1-&prefix.da",_n_,";run;");
|
|
68
66
|
put str;
|
|
69
|
-
str=cats("proc delete data=&
|
|
67
|
+
str=cats("proc delete data=&prefix.d1-&prefix.d",_n_,";run;");
|
|
70
68
|
put str;
|
|
71
|
-
str=cats("proc delete data=&
|
|
69
|
+
str=cats("proc delete data=&prefix.a1-&prefix.a",_n_,";run;");
|
|
72
70
|
put str;
|
|
73
71
|
end;
|
|
74
72
|
run;
|
|
73
|
+
|
|
74
|
+
%if &mdebug=1 %then %do;
|
|
75
|
+
data _null_;
|
|
76
|
+
infile &fileref;
|
|
77
|
+
if _n_=1 then putlog // "Now executing the following code:" //;
|
|
78
|
+
input; putlog _infile_;
|
|
79
|
+
run;
|
|
80
|
+
%end;
|
|
75
81
|
%inc &fileref;
|
|
82
|
+
filename &fileref clear;
|
|
76
83
|
|
|
77
84
|
/* get libraries */
|
|
78
|
-
proc sort data=&
|
|
85
|
+
proc sort data=&prefix._logas(where=(assoc='Libraries')) out=&prefix._temp;
|
|
79
86
|
by login_id;
|
|
80
|
-
data &
|
|
81
|
-
set &
|
|
87
|
+
data &prefix._temp;
|
|
88
|
+
set &prefix._temp;
|
|
82
89
|
by login_id;
|
|
83
90
|
length library_list $32767;
|
|
84
91
|
retain library_list;
|
|
@@ -86,31 +93,27 @@ data &outds._temp;
|
|
|
86
93
|
else library_list=catx(' !! ',library_list,name);
|
|
87
94
|
proc sql;
|
|
88
95
|
/* get auth domain */
|
|
89
|
-
create table &
|
|
96
|
+
create table &prefix._dom as
|
|
90
97
|
select login_id,name as domain
|
|
91
|
-
from &
|
|
98
|
+
from &prefix._logas
|
|
92
99
|
where assoc='Domain';
|
|
93
|
-
create unique index login_id on &
|
|
100
|
+
create unique index login_id on &prefix._dom(login_id);
|
|
94
101
|
/* join it all together */
|
|
95
|
-
create table &outds
|
|
102
|
+
create table &outds as
|
|
96
103
|
select a.*
|
|
97
104
|
,c.domain
|
|
98
105
|
,b.library_list
|
|
99
|
-
from &
|
|
100
|
-
left join &
|
|
106
|
+
from &prefix._logat (drop=ishidden lockedby usageversion publictype) a
|
|
107
|
+
left join &prefix._temp b
|
|
101
108
|
on a.login_id=b.login_id
|
|
102
|
-
left join &
|
|
109
|
+
left join &prefix._dom c
|
|
103
110
|
on a.login_id=c.login_id;
|
|
104
|
-
drop table &outds._temp;
|
|
105
|
-
drop table &outds._logat;
|
|
106
|
-
drop table &outds._logas;
|
|
107
111
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
%if &mdebug=0 %then %do;
|
|
113
|
+
proc datasets lib=work;
|
|
114
|
+
delete &prefix:;
|
|
115
|
+
run;
|
|
116
|
+
%end;
|
|
113
117
|
|
|
114
|
-
filename &fileref clear;
|
|
115
118
|
|
|
116
119
|
%mend mm_getauthinfo;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
@file mv_registerclient.sas
|
|
3
3
|
@brief Register Client and Secret (admin task)
|
|
4
|
-
@details When building apps on SAS Viya,
|
|
5
|
-
required. In order to generate them,
|
|
6
|
-
|
|
7
|
-
Environment Manager).
|
|
4
|
+
@details When building apps on SAS Viya, a client id and secret are usually
|
|
5
|
+
required. In order to generate them, the Consul Token is required. To access
|
|
6
|
+
this token, you need to be a system administrator (it is not enough to be in
|
|
7
|
+
the SASAdministrator group in SAS Environment Manager).
|
|
8
8
|
|
|
9
9
|
If you are registering a lot of clients / secrets, you may find it more
|
|
10
10
|
convenient to use the [Viya Token Generator]
|
|
@@ -25,51 +25,56 @@
|
|
|
25
25
|
"https://raw.githubusercontent.com/sasjs/core/main/all.sas";
|
|
26
26
|
%inc mc;
|
|
27
27
|
|
|
28
|
+
%* generate random client using consul token as input parameter;
|
|
29
|
+
%mv_registerclient(consul_token=12x34sa43v2345n234lasd)
|
|
30
|
+
|
|
31
|
+
%* generate random client details with all scopes;
|
|
32
|
+
%mv_registerclient(scopes=openid *)
|
|
33
|
+
|
|
28
34
|
%* specific client with just openid scope;
|
|
29
35
|
%mv_registerclient(client_id=YourClient
|
|
30
36
|
,client_secret=YourSecret
|
|
31
37
|
,scopes=openid
|
|
32
38
|
)
|
|
33
39
|
|
|
34
|
-
%* generate random client details with all scopes;
|
|
35
|
-
%mv_registerclient(scopes=openid *)
|
|
36
|
-
|
|
37
40
|
%* generate random client with 90/180 second access/refresh token expiry;
|
|
38
41
|
%mv_registerclient(scopes=openid *
|
|
39
42
|
,access_token_validity=90
|
|
40
43
|
,refresh_token_validity=180
|
|
41
44
|
)
|
|
42
45
|
|
|
43
|
-
@param client_id= The client name. Auto generated if blank.
|
|
44
|
-
@param client_secret= Client secret. Auto generated if client is
|
|
45
|
-
|
|
46
|
-
@param
|
|
47
|
-
|
|
48
|
-
@param
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@param
|
|
46
|
+
@param [in,out] client_id= The client name. Auto generated if blank.
|
|
47
|
+
@param [in,out] client_secret= Client secret. Auto generated if client is
|
|
48
|
+
blank.
|
|
49
|
+
@param [in] consul_token= (0) Provide the actual consul token value here if
|
|
50
|
+
using Viya 4 or above.
|
|
51
|
+
@param [in] scopes= (openid) List of space-seperated unquoted scopes
|
|
52
|
+
@param [in] grant_type= (authorization_code|refresh_token) Valid values are
|
|
53
|
+
"password" or "authorization_code" (unquoted). Pipe seperated.
|
|
54
|
+
@param [out] outds=(mv_registerclient) The dataset to contain the registered
|
|
55
|
+
client id and secret
|
|
56
|
+
@param [in] access_token_validity= (DEFAULT) The access token duration in
|
|
57
|
+
seconds. A value of DEFAULT will omit the entry (and use system default)
|
|
58
|
+
@param [in] refresh_token_validity= (DEFAULT) The duration of validity of the
|
|
54
59
|
refresh token in seconds. A value of DEFAULT will omit the entry (and use
|
|
55
60
|
system default)
|
|
56
|
-
@param
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
@param [in] client_name= (DEFAULT) An optional, human readable name for the
|
|
62
|
+
client.
|
|
63
|
+
@param [in] required_user_groups= A list of group names. If a user does not
|
|
64
|
+
belong to all the required groups, the user will not be authenticated and no
|
|
65
|
+
tokens are issued to this client for that user. If this field is not
|
|
66
|
+
specified, authentication and token issuance proceeds normally.
|
|
67
|
+
@param [in] autoapprove= During the auth step the user can choose which scope
|
|
68
|
+
to apply. Setting this to true will autoapprove all the client scopes.
|
|
69
|
+
@param [in] use_session= If true, access tokens issued to this client will be
|
|
64
70
|
associated with an HTTP session and revoked upon logout or time-out.
|
|
65
|
-
@param outjson= (_null_) A dataset containing the lines of JSON
|
|
66
|
-
Useful for debugging.
|
|
71
|
+
@param [out] outjson= (_null_) A dataset containing the lines of JSON
|
|
72
|
+
submitted. Useful for debugging.
|
|
67
73
|
|
|
68
74
|
@version VIYA V.03.04
|
|
69
75
|
@author Allan Bowe, source: https://github.com/sasjs/core
|
|
70
76
|
|
|
71
77
|
<h4> SAS Macros </h4>
|
|
72
|
-
@li mp_abort.sas
|
|
73
78
|
@li mf_getplatform.sas
|
|
74
79
|
@li mf_getuniquefileref.sas
|
|
75
80
|
@li mf_getuniquelibref.sas
|
|
@@ -81,6 +86,7 @@
|
|
|
81
86
|
|
|
82
87
|
%macro mv_registerclient(client_id=
|
|
83
88
|
,client_secret=
|
|
89
|
+
,consul_token=0
|
|
84
90
|
,client_name=DEFAULT
|
|
85
91
|
,scopes=openid
|
|
86
92
|
,grant_type=authorization_code|refresh_token
|
|
@@ -92,33 +98,40 @@
|
|
|
92
98
|
,refresh_token_validity=DEFAULT
|
|
93
99
|
,outjson=_null_
|
|
94
100
|
);
|
|
95
|
-
%local
|
|
101
|
+
%local fname1 fname2 fname3 libref access_token url tokloc;
|
|
96
102
|
|
|
97
103
|
%if client_name=DEFAULT %then %let client_name=
|
|
98
|
-
Generated by %mf_getuser() on %sysfunc(datetime(),datetime19.
|
|
104
|
+
Generated by %mf_getuser() (&sysuserid) on %sysfunc(datetime(),datetime19.
|
|
105
|
+
) using SASjs;
|
|
99
106
|
|
|
100
107
|
options noquotelenmax;
|
|
101
|
-
/* first, get consul token needed to get client id / secret */
|
|
102
|
-
%let tokloc=/etc/SASSecurityCertificateFramework/tokens/consul/default;
|
|
103
|
-
%let tokloc=%mf_loc(VIYACONFIG)&tokloc/client.token;
|
|
104
108
|
|
|
109
|
+
%if "&consul_token"="0" %then %do;
|
|
110
|
+
/* first, get consul token needed to get client id / secret */
|
|
111
|
+
%let tokloc=/etc/SASSecurityCertificateFramework/tokens/consul/default;
|
|
112
|
+
%let tokloc=%mf_loc(VIYACONFIG)&tokloc/client.token;
|
|
105
113
|
|
|
106
|
-
%
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
%if %sysfunc(fileexist(&tokloc))=0 %then %do;
|
|
115
|
+
%put &sysmacroname: unable to access the consul token at &tokloc;
|
|
116
|
+
%put Try passing the value in the consul= macro parameter;
|
|
117
|
+
%put See docs: https://core.sasjs.io/mv__registerclient_8sas.html;
|
|
118
|
+
%abort;
|
|
119
|
+
%end;
|
|
110
120
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
run;
|
|
121
|
+
data _null_;
|
|
122
|
+
infile "&tokloc";
|
|
123
|
+
input token:$64.;
|
|
124
|
+
call symputx('consul_token',token);
|
|
125
|
+
run;
|
|
117
126
|
|
|
118
|
-
%
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
%if "&consul_token"="0" %then %do;
|
|
128
|
+
%put &sysmacroname: Unable to source the consul token from &tokloc;
|
|
129
|
+
%put It seems your account (&sysuserid) does not have admin rights;
|
|
130
|
+
%put Please speak with your platform adminstrator;
|
|
131
|
+
%put Docs: https://core.sasjs.io/mv__registerclient_8sas.html;
|
|
132
|
+
%abort;
|
|
133
|
+
%end;
|
|
134
|
+
%end;
|
|
122
135
|
|
|
123
136
|
%local base_uri; /* location of rest apis */
|
|
124
137
|
%let base_uri=%mf_getplatform(VIYARESTAPI);
|
|
@@ -131,6 +144,9 @@ proc http method='POST' out=&fname1
|
|
|
131
144
|
headers "X-Consul-Token"="&consul_token";
|
|
132
145
|
run;
|
|
133
146
|
|
|
147
|
+
%put &=SYS_PROCHTTP_STATUS_CODE;
|
|
148
|
+
%put &=SYS_PROCHTTP_STATUS_PHRASE;
|
|
149
|
+
|
|
134
150
|
%let libref=%mf_getuniquelibref();
|
|
135
151
|
libname &libref JSON fileref=&fname1;
|
|
136
152
|
|