public void DeleteNamespace( string projectId = "projectId", string locationId = "us-east1", string namespaceId = "test-namespace") { // Create client RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create(); // Initialize request argument(s) var namespaceName = NamespaceName.FromProjectLocationNamespace(projectId, locationId, namespaceId); registrationServiceClient.DeleteNamespace(namespaceName); }
public Endpoint CreateEndpoint( string projectId = "my-project", string locationId = "us-east1", string namespaceId = "test-namespace", string serviceId = "test-service", string endpointId = "test-endpoint") { RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create(); var serviceName = ServiceName.FromProjectLocationNamespaceService(projectId, locationId, namespaceId, serviceId); return(registrationServiceClient.CreateEndpoint(serviceName, new Endpoint(), endpointId)); }
public Namespace CreateNamespace( string projectId = "my-project", string locationId = "us-east1", string namespaceId = "test-namespace") { // Create client RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create(); // Initialize request argument(s) var locationName = LocationName.FromProjectLocation(projectId, locationId); return(registrationServiceClient.CreateNamespace(locationName, new Namespace(), namespaceId)); }
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); }
public void CreatesNamespace() { var namespaceId = _fixture.RandomResourceId; _fixture.TempNamespaceIds.Add(namespaceId); // Run the sample code. var createNamespaceSample = new CreateNamespaceSample(); var result = createNamespaceSample.CreateNamespace(_fixture.ProjectId, _fixture.LocationId, namespaceId); // Get the namespace. var namespaceName = NamespaceName.FromProjectLocationNamespace(_fixture.ProjectId, _fixture.LocationId, namespaceId); RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create(); var namespaceVal = registrationServiceClient.GetNamespace(namespaceName); Assert.Contains(namespaceVal.Name, result.Name); }
public void Dispose() { var registrationServiceClient = RegistrationServiceClient.Create(); foreach (var namespaceId in TempNamespaceIds) { try { var namespaceName = NamespaceName.FromProjectLocationNamespace(ProjectId, LocationId, namespaceId); registrationServiceClient.DeleteNamespace(namespaceName); } catch (Exception) { // Do nothing, we delete on a best effort basis. } } }
public void DeletesNamespace() { // Setup namespace for the test. var namespaceId = _fixture.RandomResourceId; _fixture.CreateNamespace(namespaceId); // Run the sample code. var deleteNamespaceSample = new DeleteNamespaceSample(); deleteNamespaceSample.DeleteNamespace(_fixture.ProjectId, _fixture.LocationId, namespaceId); // Try to get the namespace. RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create(); var namespaceName = NamespaceName.FromProjectLocationNamespace(_fixture.ProjectId, _fixture.LocationId, namespaceId); var exception = Assert.Throws <RpcException>(() => registrationServiceClient.GetNamespace(namespaceName)); Assert.Equal(StatusCode.NotFound, exception.StatusCode); }
public void CreatesService() { // Setup namespace for the test. var namespaceId = _fixture.RandomResourceId; _fixture.CreateNamespace(namespaceId); var serviceId = _fixture.RandomResourceId; // Run the sample code. var createServiceSample = new CreateServiceSample(); var result = createServiceSample.CreateService(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId); // Get the service. var serviceName = ServiceName.FromProjectLocationNamespaceService(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId); RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create(); var service = registrationServiceClient.GetService(serviceName); Assert.Contains(serviceId, service.Name); }
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); }