コード例 #1
0
 private Task EndpointEvent(EndpointEventApiModel ev)
 {
     EndpointList.Results.Update(ev);
     PagedendpointList = EndpointList.GetPaged(int.Parse(Page), CommonHelper.PageLength, EndpointList.Error);
     StateHasChanged();
     return(Task.CompletedTask);
 }
コード例 #2
0
        public void GetsEndpoint()
        {
            var mockChildMatches = new EndpointList
            {
                ["{id}"] = new ElementEndpoint
                {
                    Schema   = Sample.ContactSchema,
                    Children = { ["sub"] = new Endpoint {
                                     Description = "sub"
                                 } }
                },
                ["other"] = new Endpoint {
                    Description = "other"
                }
            };

            TryGetEndpoint(CollectionTree, mockChildMatches).Should().BeEquivalentTo(new CollectionEndpoint
            {
                Schema  = Sample.ContactSchema,
                Element = new ElementEndpoint
                {
                    Children = { ["sub"] = new Endpoint {
                                     Description = "sub"
                                 } }
                },
                Children =
                {
                    ["other"] = new Endpoint {
                        Description = "other"
                    }
                },
                Description = "Collection of contacts."
            }, options => options.IncludingAllRuntimeProperties());
        }
コード例 #3
0
        public void GetsEndpoint()
        {
            var mockChildMatches = new EndpointList
            {
                ["{id}"] = new Endpoint {
                    Description = "element"
                },
                ["other"] = new Endpoint {
                    Description = "other"
                }
            };

            TryGetEndpoint(new PathTree(), mockChildMatches).Should().BeEquivalentTo(new IndexerEndpoint
            {
                Element = new Endpoint {
                    Description = "element"
                },
                Children =
                {
                    ["other"] = new Endpoint {
                        Description = "other"
                    }
                }
            }, options => options.IncludingAllRuntimeProperties());
        }
コード例 #4
0
        protected IEndpoint TryGetEndpoint(PathTree tree, EndpointList mockChildMatches = null)
        {
            var patternMatcherMock = new Mock <IPatternMatcher>();

            patternMatcherMock.Setup(x => x.GetEndpoints(tree))
            .Returns(mockChildMatches ?? new EndpointList());

            return(new TPattern().TryGetEndpoint(tree, patternMatcherMock.Object));
        }
コード例 #5
0
 private static Endpoints Convert(EndpointList response)
 {
     return(new Endpoints {
         MapsUrl = response.MapsUrl,
         ActivitiesUrl = response.ActivitiesUrl,
         ActorsUrl = response.ActorsUrl,
         ActionsUrl = response.ActionsUrl
     });
 }
コード例 #6
0
ファイル: AzureBlob.cs プロジェクト: modulexcite/pash-1
        public static Uri UploadPackageToBlob(IServiceManagement channel, string storageName, string subscriptionId, string packagePath)
        {
            StorageService storageKeys = channel.GetStorageKeys(subscriptionId, storageName);
            string         primary     = storageKeys.StorageServiceKeys.Primary;

            storageKeys = channel.GetStorageService(subscriptionId, storageName);
            EndpointList endpoints = storageKeys.StorageServiceProperties.Endpoints;
            string       str       = ((List <string>)endpoints).Find((string p) => p.Contains(".blob."));

            return(AzureBlob.UploadFile(storageName, primary, str, packagePath));
        }
コード例 #7
0
 /// <summary>
 /// Notify page change
 /// </summary>
 /// <param name="page"></param>
 public async Task PagerPageChangedAsync(int page)
 {
     CommonHelper.Spinner = "loader-big";
     StateHasChanged();
     if (!string.IsNullOrEmpty(EndpointList.ContinuationToken) && page > PagedendpointList.PageCount)
     {
         EndpointList = await RegistryHelper.GetEndpointListAsync(DiscovererId, ApplicationId, SupervisorId, EndpointList);
     }
     PagedendpointList = EndpointList.GetPaged(page, CommonHelper.PageLength, null);
     NavigationManager.NavigateTo(NavigationManager.BaseUri + "endpoints/" + page + "/" + DiscovererId + "/" + ApplicationId + "/" + SupervisorId);
     CommonHelper.Spinner = string.Empty;
     StateHasChanged();
 }
コード例 #8
0
        public ITypeList Generate([NotNull] EndpointList endpoints, IDictionary <string, OpenApiSchema> schemas)
        {
            var typeList = new TypeList();

            GenerateSchemas(schemas, typeList);

            var entryEndpoint = GenerateEntryEndpoint();

            entryEndpoint.Properties.AddRange(GenerateEndpoints(endpoints, typeList));
            typeList.Add(new Endpoint(), entryEndpoint);

            return(typeList);
        }
コード例 #9
0
        private static IEndpoint ExtractElementEndpoint(EndpointList childEndpoints)
        {
            var match = childEndpoints.FirstOrDefault(x => x.Key.StartsWith("{") && x.Key.EndsWith("}"));

            if (match.Value == null)
            {
                return(null);
            }
            childEndpoints.Remove(match.Key);

            match.Value.Uri = null;
            return(match.Value);
        }
コード例 #10
0
ファイル: AzureBlob.cs プロジェクト: modulexcite/pash-1
        public static void DeletePackageFromBlob(IServiceManagement channel, string storageName, string subscriptionId, Uri packageUri)
        {
            StorageService storageKeys = channel.GetStorageKeys(subscriptionId, storageName);
            string         primary     = storageKeys.StorageServiceKeys.Primary;

            storageKeys = channel.GetStorageService(subscriptionId, storageName);
            EndpointList endpoints = storageKeys.StorageServiceProperties.Endpoints;
            string       str       = ((List <string>)endpoints).Find((string p) => p.Contains(".blob."));
            StorageCredentialsAccountAndKey storageCredentialsAccountAndKey = new StorageCredentialsAccountAndKey(storageName, primary);
            CloudBlobClient cloudBlobClient = new CloudBlobClient(str, storageCredentialsAccountAndKey);
            CloudBlob       blobReference   = cloudBlobClient.GetBlobReference(packageUri.AbsoluteUri);

            blobReference.DeleteIfExists();
        }
コード例 #11
0
        public EndpointList GetEndpoints(PathTree tree)
        {
            var result = new EndpointList();

            foreach (var pair in tree.Children)
            {
                var endpoint = _patterns.Select(x => x.TryGetEndpoint(pair.Value, this))
                               .First(x => x != null);
                endpoint.Uri = "./" + pair.Key;

                result[pair.Key] = endpoint;
            }
            return(result);
        }
コード例 #12
0
        /// <summary>
        /// OnAfterRenderAsync
        /// </summary>
        /// <param name="firstRender"></param>
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                EndpointList = await RegistryHelper.GetEndpointListAsync(DiscovererId, ApplicationId, SupervisorId);

                Page = "1";
                PagedendpointList    = EndpointList.GetPaged(int.Parse(Page), CommonHelper.PageLength, EndpointList.Error);
                CommonHelper.Spinner = string.Empty;
                CommonHelper.CheckErrorOrEmpty(PagedendpointList, ref _tableView, ref _tableEmpty);
                StateHasChanged();

                _endpointEvents = await RegistryServiceEvents.SubscribeEndpointEventsAsync(
                    ev => InvokeAsync(() => EndpointEvent(ev)));
            }
        }
コード例 #13
0
 private IEnumerable <CSharpProperty> GenerateEndpoints(EndpointList endpoints, TypeList typeList)
 => endpoints.Select(x => GenerateEndpoint(x.Key, x.Value, typeList));
コード例 #14
0
 public static OpenApiDocument SetTypedRestEndpoints([NotNull] this OpenApiDocument document, [NotNull] EndpointList list)
 {
     document.Extensions[EndpointList.ExtensionKey] = list;
     return(document);
 }