C# 클래스 Google.Api.Gax.PathTemplate

Represents a path template used for resource names which may be composed of multiple IDs.

Templates use a subset of the syntax of the API platform. See https://github.com/googleapis/googleapis/blob/master/google/api/http.proto for details of the API platform.

This class performs no URL escaping or unescaping. It is designed for use within GRPC, where no URL encoding is required.

파일 보기 프로젝트 열기: googleapis/gax-dotnet 1 사용 예제들

공개 메소드들

메소드 설명
Expand ( ) : string

Validates that the given resource IDs are valid for this template, and returns a string representation

This is equivalent to calling new ResourceName(template, resourceIds).ToString(), but simpler in calling code and more efficient in terms of memory allocation.

This method assumes no service name is required. Call ExpandWithService to specify a service name.

ExpandWithService ( string serviceName ) : string

Validates that the given resource IDs are valid for this template, and returns a string representation

ParseName ( string name ) : ResourceName

Attempts to parse the given resource name against this template, throwing ArgumentException on failure.

PathTemplate ( string template ) : System

Constructs a template from its textual representation, such as shelves/*/books/**.

ToString ( ) : string

Returns the textual representation of this template.

TryParseName ( string name, ResourceName &result ) : bool

Attempts to parse the given resource name against this template, returning null on failure.

Although this method returns null if a name is passed in which doesn't match the template, it still throws ArgumentNullException if name is null, as this would usually indicate a programming error rather than a data error.

비공개 메소드들

메소드 설명
ReplaceParameters ( string serviceName, string resourceIds ) : string

Returns a string representation of the template with parameters replaced by resource IDs.

TryParseNameInternal ( string name, ResourceName &result ) : string

Implementation of parsing, returning the error message for a FormatException if parsing fails.

ValidateResourceId ( int index, string resourceId ) : void

Validate a single value from a sequence. This is used in both parsing and instantiating.

ValidateResourceIds ( string resourceIds ) : void

Validates a whole array of resource IDs, including that the count matches.

ValidateServiceName ( string serviceName, string parameterName ) : void

Validates a service name, ensuring it is not empty and doesn't contain any slashes. (In the future, we may want to make this stricter, e.g. that it's a valid DNS-like name.)

메소드 상세

Expand() 공개 메소드

Validates that the given resource IDs are valid for this template, and returns a string representation

This is equivalent to calling new ResourceName(template, resourceIds).ToString(), but simpler in calling code and more efficient in terms of memory allocation.

This method assumes no service name is required. Call ExpandWithService to specify a service name.

public Expand ( ) : string
리턴 string

ExpandWithService() 공개 메소드

Validates that the given resource IDs are valid for this template, and returns a string representation
public ExpandWithService ( string serviceName ) : string
serviceName string The service name, which may be null.
리턴 string

ParseName() 공개 메소드

Attempts to parse the given resource name against this template, throwing ArgumentException on failure.
public ParseName ( string name ) : ResourceName
name string The resource name to parse against this template. Must not be null.
리턴 ResourceName

PathTemplate() 공개 메소드

Constructs a template from its textual representation, such as shelves/*/books/**.
public PathTemplate ( string template ) : System
template string The textual representation of the template. Must not be null.
리턴 System

ToString() 공개 메소드

Returns the textual representation of this template.
public ToString ( ) : string
리턴 string

TryParseName() 공개 메소드

Attempts to parse the given resource name against this template, returning null on failure.
Although this method returns null if a name is passed in which doesn't match the template, it still throws ArgumentNullException if name is null, as this would usually indicate a programming error rather than a data error.
public TryParseName ( string name, ResourceName &result ) : bool
name string The resource name to parse against this template. Must not be null.
result ResourceName When this method returns, the parsed resource name or null if parsing fails.
리턴 bool