コード例 #1
0
    public void DeleteEndpoint(
        string projectId   = "my-project",
        string locationId  = "us-east1",
        string namespaceId = "test-namespace",
        string serviceId   = "test-service",
        string endpointId  = "test-endpoint")
    {
        // Create client
        RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create();
        // Initialize request argument(s)
        var endpointName = EndpointName.FromProjectLocationNamespaceServiceEndpoint(projectId, locationId, namespaceId, serviceId, endpointId);

        registrationServiceClient.DeleteEndpoint(endpointName);
    }
コード例 #2
0
    public void CreatesEndpoint()
    {
        // Setup namespace and service for test
        var namespaceId = _fixture.RandomResourceId;
        var serviceId   = _fixture.RandomResourceId;

        _fixture.CreateNamespace(namespaceId);
        _fixture.CreateService(namespaceId, serviceId);

        var endpointId           = _fixture.RandomResourceId;
        var createEndpointSample = new CreateEndpointSample();

        var result = createEndpointSample.CreateEndpoint(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId, endpointId);

        var endpointName = EndpointName.FromProjectLocationNamespaceServiceEndpoint(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId, endpointId);
        RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create();
        var endpoint = registrationServiceClient.GetEndpoint(endpointName);

        Assert.Equal(endpoint.Name, result.Name);
    }
コード例 #3
0
    public void DeletesEndpoint()
    {
        // Setup namespace, service, and endpoint for the test.
        var namespaceId = _fixture.RandomResourceId;
        var serviceId   = _fixture.RandomResourceId;
        var endpointId  = _fixture.RandomResourceId;

        _fixture.CreateNamespace(namespaceId);
        _fixture.CreateService(namespaceId, serviceId);
        _fixture.CreateEndpoint(namespaceId, serviceId, endpointId);
        // Run the sample code.
        var deleteEndpointSample = new DeleteEndpointSample();

        deleteEndpointSample.DeleteEndpoint(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId, endpointId);

        // Try to get the endpoint.
        RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create();
        var endpointName = EndpointName.FromProjectLocationNamespaceServiceEndpoint(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId, endpointId);
        var exception    = Assert.Throws <RpcException>(() => registrationServiceClient.GetEndpoint(endpointName));

        Assert.Equal(StatusCode.NotFound, exception.StatusCode);
    }