Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

docs(samples): Adding a missing region tag #300

Merged
merged 2 commits into from
Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
docs(samples): Adding the missing compute_create_windows_instance_ext…
…ernal_ip region
  • Loading branch information
m-strzelczyk committed Jun 27, 2022
commit b8e6ecfc82cf2833fb1813bdf8a4932d3b54613a
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,15 @@ def create_windows_instance(project_id: str, zone: str, instance_name: str,
# that contain Windows instances with only internal IP addresses.
# More information about Private Google Access: https://cloud.google.com/vpc/docs/configure-private-google-access#enabling

instance = create_instance(project_id, zone, instance_name, disks,
machine_type=machine_type, network_link=network_link,
subnetwork_link=subnetwork_link, external_access=True,
)
instance = create_instance(
project_id,
zone,
instance_name,
disks,
machine_type=machine_type,
network_link=network_link,
subnetwork_link=subnetwork_link,
external_access=True, # Set this to False to disable external IP for your instance
)
return instance
# </INGREDIENT>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.
# flake8: noqa

# <REGION compute_create_windows_instance_external_ip>
# <REGION compute_create_windows_instance_internal_ip>
# <IMPORTS/>

Expand All @@ -29,3 +30,4 @@

# <INGREDIENT create_windows_instance />
# </REGION compute_create_windows_instance_internal_ip>
# </REGION compute_create_windows_instance_external_ip>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# directory and apply your changes there.


# [START compute_create_windows_instance_external_ip]
# [START compute_create_windows_instance_internal_ip]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2nd region start tag is redundant and should be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I want this sample to show up in the sample browser, and those two tags are different. In other languages we have different samples for external and internal, but due to the way Python samples are created, it's pointless to create a whole new sample just to change one boolean variable, so I want this to have a START for two different regions.

import re
import sys
Expand Down Expand Up @@ -305,9 +306,10 @@ def create_windows_instance(
machine_type=machine_type,
network_link=network_link,
subnetwork_link=subnetwork_link,
external_access=True,
external_access=True, # Set this to False to disable external IP for your instance
)
return instance


# [END compute_create_windows_instance_internal_ip]
# [END compute_create_windows_instance_external_ip]