Пример #1
0
        public async Task <dynamic> CreateTask(BucketKey key)
        {
            IBucketsApi buckets =
                GeneralTokenConfigurationSettings <IBucketsApi> .SetToken(new BucketsApi(),
                                                                          await _authServiceAdapter.GetSecondaryTokenTask());

            var clientId  = AppSettings.GetAppSetting("FORGE_CLIENT_ID").ToLower();
            var bucketKey = key.bucketKey.ToLower();

            PostBucketsPayload bucketPayload = new PostBucketsPayload(string.Format("{0}{1}", bucketKey, clientId.Substring(0, 18)), null,
                                                                      PostBucketsPayload.PolicyKeyEnum.Transient);

            var result = await buckets.CreateBucketAsync(bucketPayload, "US");

            return(result);
        }
Пример #2
0
        public async Task <dynamic> TranslateTask(TranslateObject translateObject)
        {
            string Urn          = translateObject.objectName;
            string rootFileName = translateObject.RootFileName;

            JobPayload job = BusinessLogicRunner.RunnerStatmentOptional <JobPayload>((rootFileName != null),
                                                                                     new JobPayload(new JobPayloadInput(Urn, true, rootFileName), new JobPayloadOutput(outputs)),
                                                                                     new JobPayload(new JobPayloadInput(Urn), new JobPayloadOutput(outputs)));

            DerivativesApi derivativesApi =
                GeneralTokenConfigurationSettings <IDerivativesApi> .SetToken(new DerivativesApi(),
                                                                              await _authServiceAdapter.GetSecondaryTokenTask());



            dynamic jobTranslate = await derivativesApi.TranslateAsync(job, true);

            return(jobTranslate);
        }
        public async Task <dynamic> GetModelDetailMetaDataAsync(ModelDetails modelDetails)
        {
            string key = "metadata";

            if (_cacheManager.IsAdd(key))
            {
                return(_cacheManager.Get <dynamic>(key));
            }

            else
            {
                DerivativesApi derivativesApi =
                    GeneralTokenConfigurationSettings <IDerivativesApi> .SetToken(new DerivativesApi(),
                                                                                  await _authServiceAdapter.GetSecondaryTokenTask());

                dynamic detail = await GetModelDetailGuid(derivativesApi, modelDetails.urn);

                dynamic metadata = detail.data.metadata;


                List <dynamic> results = new List <dynamic>();


                foreach (KeyValuePair <string, dynamic> m in new DynamicDictionaryItems(metadata))
                {
                    var value = m.Value;

                    results.Add(await derivativesApi.GetModelviewPropertiesAsync(modelDetails.urn, value.guid));
                }

                _cacheManager.Add(key, results, 60);


                return(results);
            }
        }