Last active
May 20, 2020 01:06
-
-
Save mjmenger/62564cfdfde6ac785cddfa2e31b795b9 to your computer and use it in GitHub Desktop.
VS Code Rest Client calls for F5 Cloud Services
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@apihost = {{$dotenv cloudsvcsapihost}} | |
@apiversion = {{$dotenv cloudsvcsapiversion}} | |
@user = {{$dotenv cloudsvcsuser}} | |
@password = {{$dotenv cloudsvcspassword}} | |
@dnswebadmin = {{$dotenv cloudsvcsdnswebadmin}} | |
# The REST calls below come from https://github.com/f5devcentral/f5-cloudservicelab | |
# For more detailed instructions refer to its README | |
### | |
# @name apiLogin | |
POST https://{{apihost}}/{{apiversion}}/svc-auth/login | |
{ | |
"username": "{{user}}", | |
"password": "{{password}}" | |
} | |
### | |
# @name apiUser | |
GET https://{{apihost}}/{{apiversion}}/svc-account/user | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
### | |
# @name apiRoles | |
GET https://{{apihost}}/{{apiversion}}/svc-account/roles | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
### | |
# @name apiInvites | |
GET https://{{apihost}}/{{apiversion}}/svc-account/invites | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
### | |
# @name getZone | |
GET http://{{dnswebadmin}}/zone | |
Content-Type: application/json | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
@zonename = {{getZone.response.body.$.zone}} | |
### | |
# @name getUserMemberships | |
GET https://{{apihost}}/{{apiversion}}/svc-account/users/{{apiUser.response.body.$.id}}/memberships | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
@limitedAccount = {{getUserMemberships.response.body.$.memberships[?(@.role_name=='limited-user')].account_id}} | |
@ownerAccount = {{getUserMemberships.response.body.$.memberships[?(@.role_name=='owner')].account_id}} | |
### | |
# @name getCatalogs | |
GET https://{{apihost}}/{{apiversion}}/svc-catalog/catalogs | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
# @.name can be used to query for | |
# 'Essential App Protect' | |
# 'Beacon' | |
# 'DNS Load Balancer' | |
# 'DNS' | |
@EAPCatalog = {{getCatalogs.response.body.$.Catalogs[?(@.name=='Essential App Protect')].catalog_id}} | |
@DNSCatalog = {{getCatalogs.response.body.$.Catalogs[?(@.name=='DNS')].catalog_id}} | |
@BeaconCatalog = {{getCatalogs.response.body.$.Catalogs[?(@.name=='Beacon')].catalog_id}} | |
@DNSLBCatalog = {{getCatalogs.response.body.$.Catalogs[?(@.name=='DNS Load Balancer')].catalog_id}} | |
### | |
# @name subscribeEAPCatalog | |
POST https://{{apihost}}/{{apiversion}}/svc-account/accounts/{{ownerAccount}}/catalogs | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
{ | |
"account_id": "{{ownerAccount}}", | |
"catalog_id": "{{EAPCatalog}}" | |
} | |
### | |
# @name checkCatalogSubscriptions | |
GET https://{{apihost}}/{{apiversion}}/svc-account/accounts/{{ownerAccount}}/catalogs | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
### | |
# this doesn't respond as expected | |
# @name checkServiceSubscriptions | |
GET https://{{apihost}}/{{apiversion}}/svc-subscription/subscriptions?account_id={{ownerAccount}} | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
Content-Type: application/json | |
### | |
# this doesn't respond as expected | |
# @name checkEAPServiceSubscriptions | |
GET https://{{apihost}}/{{apiversion}}/svc-subscription/subscriptions?account_id={{ownerAccount}}&catalog_id={{EAPCatalog}}&service_type=waf | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
Content-Type: application/json | |
### | |
# @name subscribeDNSCatalog | |
POST https://{{apihost}}/{{apiversion}}/svc-account/accounts/{{ownerAccount}}/catalogs | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
{ | |
"account_id": "{{ownerAccount}}", | |
"catalog_id": "{{DNSCatalog}}" | |
} | |
### | |
# @name CreateDNSSubscription | |
POST https://{{apihost}}/{{apiversion}}/svc-subscription/subscriptions | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
{ | |
"account_id": "{{ownerAccount}}", | |
"catalog_id": "{{DNSCatalog}}", | |
"service_instance_name": "{{zonename}}", | |
"configuration": { | |
"adns_service": { | |
"zone": "{{zonename}}", | |
"master_servers": [ | |
"54.211.12.173" | |
] | |
} | |
}, | |
"service_type": "adns" | |
} | |
@DNSSubscriptionID = {{CreateDNSSubscription.response.body.$.subscription_id}} | |
### | |
# @name activateDNSSubscription | |
POST https://{{apihost}}/{{apiversion}}/svc-subscription/subscriptions/{{DNSSubscriptionID}}/activate | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
{ | |
"subscription_id": "{{DNSSubscriptionID}}", | |
"omit_config": true | |
} | |
### | |
# @name getDNSSubscriptionZones | |
POST https://{{apihost}}/{{apiversion}}/svc-subscription/subscriptions/{{DNSSubscriptionID}}/test | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
### | |
# @name createGSLBSubscription | |
POST https://{{apihost}}/{{apiversion}}/svc-subscription/subscriptions | |
Authorization: Bearer {{apiLogin.response.body.$.access_token}} | |
{ | |
"account_id": "{{ownerAccount}}", | |
"catalog_id": "{{DNSLBCatalog}}", | |
"service_instance_name": "{{zonename}}", | |
"configuration": { | |
"gslb_service": { | |
"zone": "{{zonename}}", | |
"load_balanced_records": { | |
"lbrs_auction": { | |
"aliases": [ | |
"auction" | |
], | |
"display_name": "auction.{{zonename}}", | |
"enable": true, | |
"persistence": false, | |
"proximity_rules": [ | |
{ | |
"pool": "pools_usa", | |
"region": "regions_usa", | |
"score": 1 | |
} | |
], | |
"rr_type": "A" | |
} | |
}, | |
"pools": { | |
"pools_usa": { | |
"display_name": "usa", | |
"enable": true, | |
"load_balancing_mode": "round-robin", | |
"max_answers": 1, | |
"members": [ | |
{ | |
"final": null, | |
"monitor": "basic", | |
"virtual_server": "ipEndpoint_na1_auction" | |
} | |
], | |
"remark": "", | |
"rr_type": "A", | |
"ttl": 30 | |
} | |
}, | |
"regions": { | |
"regions_usa": { | |
"display_name": "usa", | |
"sectors": [ | |
{ | |
"code": "NA", | |
"scale": "continent" | |
} | |
] | |
} | |
}, | |
"virtual_servers": { | |
"ipEndpoint_na1_auction": { | |
"address": "34.229.48.248", | |
"display_name": "na1-auction", | |
"monitor": "none", | |
"port": 80 | |
} | |
} | |
} | |
}, | |
"service_type": "gslb" | |
} | |
@GSLBSubscriptionID = {{createGSLBSubscription.response.body.$.subscription_id}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment