How to list all projects inside GCP organization using Resource Manager API? - api

I am trying to list all projects I have in GCP by using the projects.list method from the Resource Manager API but I cannot figure out what access token to be used.
Let's say I have three projects:
My Project 44572
Testing
My First Project
And when I use the projects.list method it should give me the output as this:
{
"projects": [
{
"name": "My Project 44572",
"parent": {
"type": "organization",
"id": "ORG_ID"
},
"projectId": "PROJECT_ID",
"projectNumber": "PROJECT_NUMBER",
"lifecycleState": "ACTIVE",
"createTime": "2020-06-15T08:38:04.712Z"
},
{
"name": "Testing ",
"parent": {
"type": "organization",
"id": "ORG_ID"
},
"projectId": "PROJECT_ID",
"projectNumber": "PROJECT_NUMBER",
"lifecycleState": "ACTIVE",
"createTime": "2020-06-15T08:35:59.480Z"
},
{
"name": "My First Project",
"parent": {
"type": "organization",
"id": "ORG_ID"
},
"projectId": "PROJECT_ID",
"projectNumber": "PROJECT_NUMBER",
"lifecycleState": "ACTIVE",
"createTime": "2020-06-15T08:33:23.859Z"
}
]
}
But if I am using the Access Token which I got by using service account of My Project 44572 I am getting the following output:
{
"projects": [
{
"name": "My Project 44572",
"parent": {
"type": "organization",
"id": "ORG_ID"
},
"projectId": "PROJECT_ID",
"projectNumber": "PROJECT_NUMBER",
"lifecycleState": "ACTIVE",
"createTime": "2020-06-15T08:38:04.712Z"
}
]
}
So, what access token I should use so that I would get all projects under my organization?

The projects.list method requires the permission resourcemanager.projects.get. You can grant the account any role containing the permission at org level to achieve your goal, e.g., -
roles/viewer
roles/editor
roles/owner
Alternatively, you can use the resources.searchAll method which requires the cloudasset.assets.searchAllResources permission. You can grant the account any role with this permission at org level:
roles/cloudasset.viewer
roles/cloudasset.owner
roles/viewer
roles/editor
roles/owner
To list all the projects within an organization 456:
gcloud asset search-all-resources \
--asset-types="cloudresourcemanager.googleapis.com/Project"
--scope=organizations/456
Documentation:
https://cloud.google.com/asset-inventory/docs/searching-resources
https://cloud.google.com/asset-inventory/docs/reference/rest/v1p1beta1/resources/searchAll
Related post:
How to find, list, or search resources across services (APIs) and projects in Google Cloud Platform?

I solved the problem by assigning the service account of "My Project 44572" Owner role at Organization level and now when i use the access token generated by this service account it would list all the projects in my organization

Related

2022: Get LinkedIn Posts via Access Token

I have been looking for an updated version of how to retrieve my own posts from LinkedIn via an access token which I have received from completing a three-legged OAuth process.
I have reviewed: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/share-api?view=li-lms-unversioned&tabs=http#permissions- but its now showing as legacy.
As it seems, LinkedIn unfortunately no longer wants us to retrieve this kind of content:
"Find Posts by authors is only supported for organization authors.
Finding by member authors is not supported."
Source
Neither a good, nor a solution within the LinkedIn-TOS (I assume) would be to use a webscraper. I have seen some solutions online but they are all very pricey in my opinion (and you never know if they get shut down by LinkedIn)
{
"activity": "urn:li:activity:12345657",
"content": {
"contentEntities": [
{
"entity": "urn:li:article:0",
"entityLocation": "https://www.example.com/content.html",
"thumbnails": [
{
"imageSpecificContent": {},
"resolvedUrl": "https://www.example.com/image.jpg"
}
]
}
],
"description": "content description",
"title": "Test Share with Content"
},
"created": {
"actor": "urn:li:person:A8xe03Qt10",
"time": 1471967236000
},
"distribution": {
"linkedInDistributionTarget": {}
},
"id": "6173878065928642560",
"lastModified": {
"actor": "urn:li:person:A8xe03Qt10",
"time": 1471967237000
},
"owner": "urn:li:organization:123456789",
"text": {
"text": "Test Share!"
}
}

Hashicorp Vault LDAP authentication issues

We use LDAP as our access into Hashicorp Vault.
One of our users was deleted and recreated in AD... This use cannot log into the vault any longer, receiving a "Authentication failed: internal error" (rather than a "Authentication failed: ldap operation failed" that we see for a user that is not in AD or with an invalid password)
The only error we see is in the vault_audit.log (with passwords, and assessors munged, ip changed, and replaced with my name as example):
{
"time": "2022-09-12T19:03:55.457492415Z",
"type": "response",
"auth": {
"client_token": "hmac-sha256:xxxxxxx",
"accessor": "hmac-sha256:yyyyyyy",
"display_name": "ldap-ssiegler",
"token_policies": [
"default"
],
"metadata": {
"username": "ssiegler"
},
"entity_id": "aca5c682-b0c4-2f51-9681-b4244a23720b",
"token_type": "service"
},
"request": {
"id": "275b5b49-80ff-ee5f-a7f8-1e0c5a3dc645",
"operation": "update",
"namespace": {
"id": "root"
},
"path": "auth/ldap/login/ssiegler",
"data": {
"password": "hmac-sha256:zzzzzzz"
},
"remote_address": "192.168.205.23"
},
"response": {},
"error": "internal error"
}
"error": "internal error"
being the only information...
I have removed the entities that referenced this user, with no change, and created a new entity that was able to have this ad user as an alias, so AD sees him...
Ideas?

Zoho Recruit API Register / Login Candidate

Could someone guide me an idea of how to create the registration and login for candidates with the Recruit api? I'm making a flutter app and I need my candidates to register and log in trow the app and see the job opening, post jobs.
At the moment I created the user with [POST] https://recruit.zoho.com/recruit/v2/Candidates
{
"data": [
{
"Email": "mail#gmail.com",
"First_Name": "TheName",
"Last_Name": "TheLastName",
"Mobile": "000000000",
"Expected_Salary": "8000000",
"Country": "PY",
"Departamento": "Central",
"C_I": "37114594",
"Ciudad_de_residencia": "City",
"$Password":"myPassWord199**"
}
],
"trigger": [
"approval",
"workflow",
"blueprint"
]
}
Works Well, got success
{
"data": [
{
"code": "SUCCESS",
"details": {
"Modified_Time": "2022-06-15T20:47:23-04:00",
"Modified_By": {
"name": "Admin",
"id": "00000000000000"
},
"Created_Time": "2022-06-15T20:47:23-04:00",
"id": "00000000000000",
"Created_By": {
"name": "Admin",
"id": "00000000000000"
}
},
"message": "record added",
"status": "success"
}
]
}
But If I try to log in in the web version (for testing the new candidate) don't work, but if it see the dashboard, the user exist. Need to add something else?
Basically I need a register api and a login one for the created record of the candidate.
Any help will be awesome, Thanks

How to display data in table using Keystone6 component in custom page so it looks same?

I have build custom page in Keystone6 using this docs
Now I am getting data from GraphQL query.
{
"members": [
{
"__typename": "Member",
"id": "ckwluj7jd1675l4l8e9yfcwtt",
"name": "User 2",
"companyName": "company1",
},
{
"__typename": "Member",
"id": "ckwltsw620162l4l88g8ox4zo",
"name": "User 1",
"companyName": "company2",
},
{
"__typename": "Member",
"id": "ckwm061f8436554l8ab4ic3dsd5o",
"name": "User 3",
"companyName": "",
}
]
}
Now I am trying to display it on custom page but I am not sure how to use Keystone6 admin component to display data.
Ronald here from the Keystone Team.
At the moment there’s no way to do this using official Keystone components. We’re working on a next-gen Admin UI in 2022 that will make it easier for you to achieve this.

How to get number of googleplus page followers?

is there actually a possibility to get the number of followers of my googleplus-page. the following script - which I found here in an earlier post - doesn't work (no output):
$google_api_key = 'XYZXYZXYZXYZXYZXYZ';
$page_id = 'MYNUMERICPAGEID';
$data = #file_get_contents("https://www.googleapis.com/plus/v1/people/$page_id?key=$google_api_key");
$data = json_decode($data, true);
echo $data['plusOneCount'];
thank you!
There could be a few things wrong:
Don't have an updated project on the Developer Console.
Didn't enable the API for that project.
Are past thresholds/quotas.
Try the following:
Login to your Google Developers Console
You'll need a project.
If you don't have a project, create one.
Enable "Google Plus API" on that project.
Confirm usage/quotes are within tolerance and you haven't gone past.
From there, your call should work as normal:
GET https://www.googleapis.com/plus/v1/people/{USER_ID}?key={YOUR_API_KEY}
In my case, I'm querying Google's's page, so {USER_ID} = 116899029375914044550. I can then see the plusOneCount:
{
"kind": "plus#person",
"etag": "\"RqKWnRU4WW46-6W3rWhLR9iFZQM/bTf-sq_Sg3fLAFijixPfjtKM5f8\"",
"urls": [
{
"value": "http://www.google.com",
"type": "website",
"label": "www.google.com"
},
{
"value": "http://www.google.com/support/",
"type": "other",
"label": "Google Help"
},
{
"value": "http://googleblog.blogspot.com/",
"type": "other",
"label": "Official Blog"
},
{
"value": "http://twitter.com/#!/google",
"type": "other",
"label": "#google"
},
{
"value": "http://www.google.com/about/corporate/company/",
"type": "other",
"label": "Company Info"
},
{
"value": "http://www.google.com/press/",
"type": "other",
"label": "News"
},
{
"value": "http://www.google.com/press/google-directory.html",
"type": "other",
"label": "More Google pages"
}
],
"objectType": "page",
"id": "116899029375914044550",
"displayName": "Google",
"tagline": "News and updates on Google's products, technology and more",
"aboutMe": "<p>Welcome to Google's official page. Here, you'll find product news and announcements, company updates, glimpses into what it's like to work at Google, discussions on technology and the web, and much more. </p><p><span>Given the volume of feedback we receive here, we may not be able to respond individually to every comment and we're not able to provide product support (if you're having product issues, please visit our Help Center). Rest assured we're paying attention, and we're always eager to hear from you.</span></p>",
"url": "https://plus.google.com/+google",
"image": {
"url": "https://lh4.googleusercontent.com/-v0soe-ievYE/AAAAAAAAAAI/AAAAAAAC9wQ/JD8tdz3bFTM/photo.jpg?sz=50",
"isDefault": false
},
"isPlusUser": true,
"plusOneCount": 10757884,
"circledByCount": 7692912,
"verified": true,
"cover": {
"layout": "banner",
"coverPhoto": {
"url": "https://lh4.googleusercontent.com/-PLPoXvnN0XI/UTdr4xTtuHI/AAAAAAAA_1U/p1n_Za3BZUg/s630-fcrop64=1,00000000fe06fe97/g_plus_background.png",
"height": 528,
"width": 940
},
"coverInfo": {
"topImageOffset": 0,
"leftImageOffset": 0
}
}
}