-
Notifications
You must be signed in to change notification settings - Fork 160
/
UriServiceInfo.cs
48 lines (33 loc) · 1.3 KB
/
UriServiceInfo.cs
1
2
3
4
5
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
using System.Net;
namespace Steeltoe.Connector.Services;
public abstract class UriServiceInfo : ServiceInfo
{
public UriServiceInfo(string id, string scheme, string host, int port, string username, string password, string path)
: base(id)
{
Info = new UriInfo(scheme, host, port, username, password, path);
}
public UriServiceInfo(string id, string uriString, string username, string password)
: base(id)
{
Info = new UriInfo(uriString, username, password);
}
public UriServiceInfo(string id, string uriString)
: base(id)
{
Info = new UriInfo(uriString);
}
public UriInfo Info { get; internal protected set; }
public string Uri => Info.UriString;
public string UserName => WebUtility.UrlDecode(Info.UserName);
public string Password => WebUtility.UrlDecode(Info.Password);
public string Host => Info.Host;
public string[] Hosts => Info.Hosts;
public int Port => Info.Port;
public string Path => Info.Path;
public string Query => Info.Query;
public string Scheme => Info.Scheme;
}