Skip to content

chore(servicedirectory): add region tags #4403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions servicedirectory/quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START servicedirectory_quickstart]
from google.cloud import servicedirectory_v1beta1


Expand All @@ -30,3 +31,4 @@ def list_namespaces(project_id, location_id):
print(f'Namespace: {namespace.name}')

return response
# [END servicedirectory_quickstart]
14 changes: 14 additions & 0 deletions servicedirectory/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from google.cloud import servicedirectory_v1beta1


# [START servicedirectory_create_namespace]
def create_namespace(project_id, location_id, namespace_id):
"""Creates a namespace in the given location."""

Expand All @@ -34,8 +35,10 @@ def create_namespace(project_id, location_id, namespace_id):
print(f'Created namespace {response.name}.')

return response
# [END servicedirectory_create_namespace]


# [START servicedirectory_delete_namespace]
def delete_namespace(project_id, location_id, namespace_id):
"""Deletes a namespace in the given location."""

Expand All @@ -46,8 +49,10 @@ def delete_namespace(project_id, location_id, namespace_id):
client.delete_namespace(name=namespace_name)

print(f'Deleted namespace {namespace_name}.')
# [END servicedirectory_delete_namespace]


# [START servicedirectory_create_service]
def create_service(project_id, location_id, namespace_id, service_id):
"""Creates a service in the given namespace."""

Expand All @@ -66,8 +71,10 @@ def create_service(project_id, location_id, namespace_id, service_id):
print(f'Created service {response.name}.')

return response
# [END servicedirectory_create_service]


# [START servicedirectory_delete_service]
def delete_service(project_id, location_id, namespace_id, service_id):
"""Deletes a service in the given namespace."""

Expand All @@ -79,8 +86,10 @@ def delete_service(project_id, location_id, namespace_id, service_id):
client.delete_service(name=service_name)

print(f'Deleted service {service_name}.')
# [END servicedirectory_delete_service]


# [START servicedirectory_resolve_service]
def resolve_service(project_id, location_id, namespace_id, service_id):
"""Resolves a service in the given namespace."""

Expand All @@ -97,8 +106,10 @@ def resolve_service(project_id, location_id, namespace_id, service_id):
print(f'{endpoint.name} -- {endpoint.address}:{endpoint.port}')

return response
# [END servicedirectory_resolve_service]


# [START servicedirectory_create_endpoint]
def create_endpoint(project_id, location_id, namespace_id, service_id,
endpoint_id, address, port):
"""Creates a endpoint in the given service."""
Expand All @@ -121,8 +132,10 @@ def create_endpoint(project_id, location_id, namespace_id, service_id,
print(f'Created endpoint {response.name}.')

return response
# [END servicedirectory_create_endpoint]


# [START servicedirectory_delete_endpoint]
def delete_endpoint(project_id, location_id, namespace_id, service_id,
endpoint_id):
"""Deletes a endpoin in the given service."""
Expand All @@ -135,3 +148,4 @@ def delete_endpoint(project_id, location_id, namespace_id, service_id,
client.delete_endpoint(name=endpoint_name)

print(f'Deleted endpoint {endpoint_name}.')
# [END servicedirectory_delete_endpoint]