Skip to content

feat(2021-06-29): Update SDK to use VPC API version 2021-06-29 #25

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 2 commits into from
Jul 14, 2021
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: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ matrix:
- python: 3.6
- python: 3.7
- python: 3.8
- python: 3.9

before_install:
- npm install npm@latest -g
- sudo apt-get update
- sudo apt-get install pandoc
- pip install pypandoc
- '[ "${TRAVIS_PULL_REQUEST}" == "false" ] && openssl aes-256-cbc -K $encrypted_9d748cee9f61_key -iv $encrypted_9d748cee9f61_iv -in vpc.env.enc -out vpc.env -d || true'

install:
- pip install tox-travis
Expand Down
11 changes: 2 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# This makefile is used to make it easier to get the project set up
# to be ready for development work in the local sandbox.
# example: "make setup"

setup: deps dev_deps install

deps:
Expand All @@ -16,8 +12,5 @@ install:
unit-test:
pytest -v test/unit

test-int-gen1:
pytest -v test/integration/test_gen1.py --capture=tee-sys

test-int-gen2:
pytest -v test/integration/test_gen2.py --capture=tee-sys
test-int:
pytest -v test/integration --capture=tee-sys
57 changes: 0 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Python client library to interact with various [IBM Cloud Virtual Private Cloud

This SDK uses [Semantic Versioning](https://semver.org), and as such there may be backward-incompatible changes for any new `0.y.z` version.

**Note** As IBM continues to invest and innovate on the IBM Cloud Virtual Private Cloud (gen 2 compute) infrastructure, we're focusing on delivering maximum value in a single VPC Infrastructure platform. To support this effort, generation 1 compute infrastructure is being deprecated. The end of service date is 26 February 2021. For more information, see the [Start your migration](https://www.ibm.com/cloud/blog/announcements/start-your-vpc-gen1-to-vpc-gen2-migration) blog.

## Table of Contents

Expand All @@ -29,7 +28,6 @@ This SDK uses [Semantic Versioning](https://semver.org), and as such there may b
- [Installation](#installation)
- [Using the SDK](#using-the-sdk)
- [Setting up VPC service](#setting-up-vpc-service)
- [Setting up VPC on Classic service](#setting-up-vpc-on-classic-service)
- [Questions](#questions)
- [Issues](#issues)
- [Open source @ IBM](#open-source--ibm)
Expand All @@ -46,7 +44,6 @@ IBM Cloud services:
Service Name | Imported Class Name
--- | ---
[VPC](https://cloud.ibm.com/apidocs/vpc) | VpcV1
[VPC Gen 1](https://cloud.ibm.com/apidocs/vpc-on-classic) | VpcClassicV1

## Prerequisites

Expand Down Expand Up @@ -127,60 +124,6 @@ print(instance['id'], "\t", instance['name'])
```


## Setting up VPC on Classic service
```python
from ibm_vpc import VpcClassicV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from ibm_cloud_sdk_core import ApiException

authenticator = IAMAuthenticator("YOUR_IBMCLOUD_API_KEY")
service = VpcClassicV1('2020-06-02', authenticator=authenticator)

# Listing VPCs
print("List VPCs")
try:
vpcs = service.list_vpcs().get_result()['vpcs']
except ApiException as e:
print("List VPC failed with status code " + str(e.code) + ": " + e.message)
for vpc in vpcs:
print(vpc['id'], "\t", vpc['name'])
print("\n")

# Listing Subnets
print("List Subnets")
try:
subnets = service.list_subnets().get_result()['subnets']
except ApiException as e:
print("List subnets failed with status code " + str(e.code) + ": " + e.message)
for subnet in subnets:
print(subnet['id'], "\t", subnet['name'])

# Listing Instances
print("List Instances")
try:
instances = service.list_instances().get_result()['instances']
except ApiException as e:
print("List instances failed with status code " + str(e.code) + ": " + e.message)
for instance in instances:
print(instance['id'], "\t", instance['name'])

instanceId = instances[0]['id']
instanceName = instances[0]['name']

# Updating Instance
print("Updated Instance")
try:
newInstanceName = instanceName + "-1"
instance = service.update_instance(
id=instanceId,
name=newInstanceName,
).get_result()
except ApiException as e:
print("Update instance failed with status code " + str(e.code) + ": " + e.message)
print(instance['id'], "\t", instance['name'])

```

## Questions

If you are having difficulties using this SDK or have a question about the IBM Cloud services,
Expand Down
1 change: 0 additions & 1 deletion ibm_vpc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@

from .common import get_sdk_headers
from .version import __version__
from .vpc_classic_v1 import VpcClassicV1
from .vpc_v1 import VpcV1
Loading